Ubuntu – Auto-configuring postfix using dpkg-set-selections

debianpostfixUbuntu

On Ubuntu 12.04, I'm trying to use dpkg-set-selections to automagically configure postfix on deployed machines with the following:

debconf-set-selections <<EOF
postfix postfix/main_mailer_type select Satellite system 
postfix postfix/root_address string admin@mydomain.org
postfix postfix/mailname string mydomain.org
postfix postfix/relayhost string gw.mydomain.internal
postfix postfix/destinations string $(hostname -f), localhost
EOF
DEBIAN_FRONTEND=noninteractive apt-get install postfix mailutils

Unfortunately, the configurator insists on adding mydomain.org to the postfix/destinations (aka mydestinations) config parameter:

postfix postfix/destinations    string  mydomain.org, myserver.mydomain.internal, localhost

How can I configure this properly? I want any unqualified mail to go out as user@mydomain.org and be relayed through the smarthost.

Best Answer

I think the problem is in the install scripts, postfix.preinst has some interesting code about it, and some comments:

Add a 'mydomain' entry in main.cf for upgrade? Postfix version 2.3.3-2 and later require changes in main.cf. Specifically, mydomain must be specified, since hostname(1) is not a fully qualified domain name (FQDN). . Failure to fix this will result in a broken mailer. Decline this option to abort the upgrade, giving you the opportunity to add this configuration yourself. Accept this option to automatically set mydomain based on the FQDN of the machine.*

Related Topic