~drscream

Postfix smart host in SmartOS zone

Default mail system in SmartOS zones is Postfix, so why not using it. I only need a configuration for smart host with sasl authentication.

We only need an minimal configuration in /opt/local/etc/postfix/main.cf. I think some of my stuff could also be removed. You need only to change relayhost to your mail server.

# LOCAL PATHNAME INFORMATION
queue_directory = /var/spool/postfix
command_directory = /opt/local/sbin
daemon_directory = /opt/local/libexec/postfix
data_directory = /var/db/postfix

# QUEUE AND PROCESS OWNERSHIP
mail_owner = postfix
setgid_group = maildrop

# INTERNET HOST AND DOMAIN NAMES
#myhostname = host.domain.tld
#mydomain = domain.tld

# SENDING MAIL
#myorigin = $myhostname
#myorigin = $mydomain

# RECEIVING MAIL
inet_protocols = ipv4
inet_interfaces = loopback-only
mynetworks = 127.0.0.0/8
mynetworks_style = host

# REJECTING MAIL FOR UNKNOWN LOCAL USERS
unknown_local_recipient_reject_code = 550

# INTERNET OR INTRANET
relayhost = [submission.example.com]:25
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = dbm:/opt/local/etc/postfix/relay_passwords
smtp_sasl_type = cyrus
smtp_sasl_security_options = noanonymous
smtp_always_send_ehlo = yes

# ALIAS DATABASE
alias_maps = dbm:/opt/local/etc/postfix/aliases
alias_database = dbm:/opt/local/etc/postfix/aliases

# INSTALL-TIME CONFIGURATION INFORMATION
sendmail_path = /opt/local/sbin/sendmail
newaliases_path = /opt/local/bin/newaliases
mailq_path = /opt/local/bin/mailq
html_directory = no
manpage_directory = /opt/local/man
sample_directory = /opt/local/share/examples/postfix
readme_directory = /opt/local/share/doc/postfix

The password and username should be added to the file /opt/local/etc/postfix/relay_passwords from smtp_sasl_password_maps. Use the following format:

# relayhost username:password
submission.example.com smtp@example.com:qwe123

Maybe you also like to send all root emails to an special email account. So change the /opt/local/etc/postfix/aliases file.

# local: remote
root: admin@example.com

Because of the dbm: option in the main.cf you must postmap and postalias the files.

cd /opt/local/etc/postfix/
postmap /opt/local/etc/postfix/relay_passwords
postalias /opt/local/etc/postfix/aliases

Enable the service via svcadm enable postfix. That’s all.


Send your comment by mail.