Friday, March 30, 2012

Using Postfix SASL Mail Relay in CentOS6

One day I setup a new CentOS6 machine with Postfix mail relay with SASL auth to a provider.

At the start, I received lots of "no worthy mechs" errors in the mail log.

Reason: you must install paket "cyrus-sasl-plain" for it.

yum install cyrus-sasl-plain

Here is an example postfix config excerpt:

# enable SASL-AUTH
smtp_sasl_auth_enable = yes
# Sasl Users/passwords in this file.
# NOTE: you must compile the file on every change with "postmap smtp_auth"
smtp_sasl_password_maps = hash:/etc/postfix/smtp_auth
# never use anonymous login
smtp_sasl_security_options = noanonymous
# relayhost with SASL-AUTH
relayhost = <your_providers_mail_relay_server_name>


The smtp_auth file contains the mail-relay-hostname, account and password:


relayhost.your-provider.example  example-user:example-password