Postfix as secondary mail server (relay issue..)

Alright, so I've got postfix + courier working as a primary server (using MySQL to handle the virtual domains and users).. I followed the (amazing) guide in the linode library..

But now, I've setup my domain to work with google apps, and so I've configured the relay_host option in postfix to "forward" all mail to google. Problem is that gmail wants authentication:

> postfix/smtp[27974]: 9628ACA5B: to=<andrew@domain.com>, relay=smtp.gmail.com[74.125.113.109]:25, delay=0.18, delays=0.01/0.01/0.12/0.04, dsn=5.7.0, status=bounced (host smtp.gmail.com[74.125.113.109] said: 530 5.7.0 Must issue a STARTTLS command first. 21sm2893506vws.9 (in reply to MAIL FROM command))

everything online points that I need to enable "smtpsaslpassword_maps", except all the examples use the hash files (a simple plain text document…). I'd rather continue using MySQL for this…

Just setting it to the: "smtpsaslpasswordmaps = proxy:mysql:/etc/postfix/mysql-virtualmailboxes.cf" didn't seem to work :(

soooo any ideas?

4 Replies

I'd suggest trying the plain-text approach with "smtpsaslpasswordmaps = hash:/etc/postfix/saslpasswd" first. If that works, you know client SASL is functional. Then it's just a matter of figuring out the right way of getting Postfix to pull the credentials from MySQL correctly (sorry, don't know anything about that).

@Vance:

I'd suggest trying the plain-text approach with "smtpsaslpasswordmaps = hash:/etc/postfix/saslpasswd" first. If that works, you know client SASL is functional. Then it's just a matter of figuring out the right way of getting Postfix to pull the credentials from MySQL correctly (sorry, don't know anything about that).

well you were right about that.. it didn't work with the plain text approach… BUT i did manage to fix it after awhile…

but still nothing on getting it into a MySQL database :(

alright, I figured it out… so for the benefit of others:

ASSUMING everything works with saslpassword as plaintext (or using the hash approach)… ie. "smtpsaslpasswordmaps = hash:/etc/postfix/saslpasswd". Also, I'm assuming you've setup MySQL and saslauthd for use with postfix (see the email guide in linode library)

For MySQL:

in main.cf:
> smtpsaslpasswordmaps = mysql:/etc/postfix/mysql-saslpasswd.cf

mysql-saslpasswd.cf: > user = mailadmin

password = mysqlpasswordformailadmin

dbname = mail

query = SELECT CONCAT(user,':',AESDECRYPT(pass,'encryptionkey')) FROM saslpasswd WHERE relayhost = '%s';

hosts = 127.0.0.1

I used AESENCRYPT/AESDECRYPT in order to have SOME level of encryption on the passwords..

I plan on writing a more detailed version on my mini blog in the next few days.. but hopefully others who have the same problem may find this useful..

Great, glad you got it working!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct