Previous Section  < Day Day Up >  Next Section

Recipe 20.10. Using smtp-auth to Authenticate Postfix to Another Server

20.10.1 Problem

You want to relay off your service provider's SMTP server, but it requires a login and password. You already have smtp-auth set up and working for your users.

20.10.2 Solution

Create or edit /etc/postfix/sasl_passwd, and store your login information in it:

mail.tuxcomputing.com  carla:sekritword

Set restrictive file permissions:

# chown root:root /etc/postfix/sasl_passwd && chmod 600 /etc/postfix/sasl_passwd

Now convert it to a hashed DB:

# postmap hash:/etc/postfix/sasl_passwd

This creates /etc/postfix/sasl_passwd.db.

Add one more line to /etc/postfix/main.cf:

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

and activate the changes:

# postfix reload

Now Postfix will authenticate itself to your relay server.

20.10.3 Discussion

/etc/postfix/sasl_passwd may have multiple entries for different hosts, as long as each one has a different hostname:

mail.tuxcomputing.com     carla:sekritword

smtp.goodeats.com         carla:sekkritword

mail.saddles.net          horselady:secritword

20.10.4 See Also

  • /usr/share/doc/postfix/examples/, for descriptions of the main.cf options

  • /usr/share/doc/postfix/examples/sample-auth.cf.gz, for explanations of the authentication options

  • Recipe 20.7

  • Recipe 20.9

    Previous Section  < Day Day Up >  Next Section