Hi everyone, I have two gmail accounts, and I want to configure my local postfix server as a client which does SASL authentication with smtp.gmail.com:587 with credentials that depend on the sender address.
So, let's say that my gmail accounts are: a...@gmail.com and a...@gmail.com. If I sent a mail from a...@gmail.com, then postfix should use the credentials: a...@gmail.com:passwd1 to do SASL authentication with gmail. Similarly with a...@gmail.com, it should use a...@gmail.com:passwd2. Sounds fairly simple. The reason I want to do this is that I want to implement profiles by diffrentiating Mutt configurations and sourcing the relevant configurations according to the desired profile. Typically each profile would have a different value for the FROM header field, so postfix should be willing to cooperate and do sender dependent SASL authentication based on those addresses. Well, I followed the postfix official documentation at http://www.postfix.org/SASL_README.html, and I ended up with the following relevant configurations: /etc/postfix/main.cf: smtp_sasl_auth_enable = yes smtp_sasl_security_options = noanonymous smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sender_dependent_authentication = yes sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay relayhost = smtp.gmail.com:587 /etc/postfix/sasl_passwd: a...@gmail.com a...@gmail.com:passwd1 a...@gmail.com a...@gmail.com:passwd2 smtp.gmail.com:587 a...@gmail.com:passwd1 /etc/postfix/sender_relay: a...@gmail.com smtp.gmail.com:587 a...@gmail.com smtp.gmail.com:587 After that I updated the mapping databases: # postmap /etc/postfix/sasl_passwd # postmap /etc/postfix/sender_relay # /etc/init.d/postfix restart The problem is that when I send a mail from a...@gmail.com, the message ends up in the destination with sender address a...@gmail.com and NOT a...@gmail.com. If I changed that last line in sasl_passwd (the default credentials) to include a...@gmail.com:passwd2, the mail gets to the destination from a...@gmail.com. So, apparently, postfix ignores the per-sender configurations in sasl_passwd and always uses the default configurations. In turn, this means that Mutt's configurations "means nothing" to postfix. So, if changing the "FROM" header field with Mutt doesn't affect the sender address that postfix sees, What does? Someone pointed me that what counts for postfix is the address in the MAIL FROM commmand, but I don't know of anyway of changing this using Mutt (and apparently, there isn't). Here are the logs when I sent a mail from a...@gmail.com to some other obsfucated account "a...@isp.net": Sep 12 17:28:24 host postfix/pickup[13235]: D0E71A4167D: uid=1000 from=<marwan> Sep 12 17:28:24 host postfix/cleanup[13259]: D0E71A4167D: message-id=<20120911152824.GX10881@host> Sep 12 17:28:24 host postfix/qmgr[13236]: D0E71A4167D: from=<marwan@host>, size=413, nrcpt=1 (queue active) Sep 12 17:28:25 host postfix/smtp[13263]: setting up TLS connection to smtp.gmail.com[173.194.70.108]:587 Sep 12 17:28:25 host postfix/smtp[13263]: Verified TLS connection established to smtp.gmail.com[173.194.70.108]:587: TLSv1 with cipher RC4-SHA (128/128 bits) Sep 11 17:28:32 host postfix/smtp[13263]: D0E71A4167D: to=<a...@isp.net>, relay=smtp.gmail.com[173.194.70.108]:587, delay=7.8, delays=0.1/0/2.7/5, dsn=2.0.0, status=sent (250 2.0.0 OK 1347377285 25sm9995878bkx.9) Sep 11 17:28:32 host postfix/qmgr[13236]: D0E71A4167D: removed Pretty normal logs, right? I checked the configurations multiple times and even compared them to those in various blog posts (not to mention the official documentation) addressing the same issue but found them to be more or less the same as mine. here is the output from "postconf -n": alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no config_directory = /etc/postfix html_directory = /usr/share/doc/postfix/html inet_interfaces = all mailbox_command = maildrop -d "$EXTENSION" mailbox_size_limit = 0 message_size_limit = 52428800 mydestination = host, localhost.localdomain, , localhost myhostname = host mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 readme_directory = /usr/share/doc/postfix recipient_delimiter = + relayhost = smtp.gmail.com:587 sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_sender_dependent_authentication = yes smtp_tls_CAfile = /etc/ssl/certs/Equifax_Secure_CA.pem smtp_tls_CApath = /etc/ssl/certs smtp_tls_loglevel = 2 smtp_tls_security_level = secure smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache smtp_tls_session_cache_timeout = 3600s smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes tls_random_source = dev:/dev/urandom Now, I got stuck, and I really consider this list to be my last resort. So, please, can anyone point me in the right direction, in case I'm missing something? And please, excuse me if I missed something obvious. I am still learning my way to postfix. Thanks for your time. Marwan