1

I am trying to set up postfix on Ubuntu 14.04 to use an external SMTP Server.

I installed the libsasl2-modules to deal with authentication.

I created my credentials file:

sudo vim /etc/postfix/sasl_passwd

using:

[mail.mydomain.com]:587 username:password

Created the hash db:

sudo postmap /etc/postfix/sasl_passwd

Used this settings in /etc/postfix/main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
#myhostname = web.mydomain.com
mydomain = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = www.mydomain.com, web.mydomain.com, localhost.mydomain.com, localhost
relayhost = [mail.mydomain.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

# enable SASL authentication 
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication. 
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption 
smtp_use_tls = yes
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

However, whenever I send a test mail authentication fails because postfix is not using my credentials at sasl_passwd but the current user instead. Please check my /var/log/mail.log:

Mar  4 09:10:20 web postfix/smtp[9214]: 4087042522: to=<myadress@gmail.com>, relay=mail.mydomain.com[xx.xx.xxx.xx]:587, delay=4.9, delays=4.8/0.01/0.12/0.01, dsn=5.0.0, status=bounced (host mail.mydomain.com[xx.xx.xxx.xx] said: 550-Verification failed for <root@mydomain.com> 550-No Such User Here 550 Sender verify failed (in reply to RCPT TO command))

Verification failed for <root@mydomain.com> When I want to use my username:password in sasl_passwd.

I can't find documentation on how to dig into this. Why postfix is not using the the sasl_passw file?

  • Not sure it's 100% necessary but I have the line smtp_sasl_mechanism_filter = login in my main.cf file. – Arronical Mar 4 '16 at 10:21
  • Thanks @Arronical, just tried it, restarted postfix and same error. – Marc Mar 4 '16 at 10:36
0

To anyone with same problem, I just created email accounts at my ISP for each user in the machine sending emails (root@mydomain.com, users@mydomain.com, and apache-user@mydomain.com) and works.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.