Wednesday, October 19, 2011

Lazy postfix address masquerade with external ssl smtp

To provide our postfix with  a "smart host" using an external SSL smtp account we need to:
  • Create the file  /etc/postfix/sasl-password  with the respective relay host credentials. Use this syntax:
 our-external-smtp.server.com:smtp-port myusername:mypassword
  •  Create the file /etc/postfix/generic containing the email address to masquerade from our local domain:
 @localhost.localdomain myemailaddress@our-external-smtp.server.com
  • Now we postmap both files:
[root@localhost postfix]# postmap /etc/postfix/sasl-passwd
[root@localhost postfix]# postmap /etc/postfix/generic
  • Add the following lines to the file main.cf:
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl-passwd
    smtp_sasl_security_options = [noanonymous]
    relayhost = our-smtp.server.com:smtp-port
    smtp_sasl_mechanism_filter = plain,login
    smtp_tls_security_level = may
    smtp_generic_maps = hash:/etc/postfix/generic
  •  Reload postfix with postfix reload. It should be working by now.

No comments:

Post a Comment