The original post: /r/ubuntu by /u/Traditional-Bite541 on 2025-01-21 09:33:04.

#Propersec

Are there any Ubuntu geniuses out there who can help me gain SASL authentication to my Postfix and Dovecot mail server?

NB: No confidential information is given out in the terminal content below.

I am configuring a mail server on my Raspberry Pi running an Ubuntu OS. I have set up the Postfix server and a domain (using Apache) in addition to a user. I can see all of these correctly configured in the Postfix Admin browser GUI. However, when testing my email address I retrieve the following mail log error:

sudo tail -f /var/log/mail.log

[sudo] password for rebekah:

Jan 19 10:45:48 localhost postfix/qmgr[40702]: 7076982DF9: from=[email protected], size=369, nrcpt=1 (queue active)

Jan 19 10:45:48 localhost postfix/qmgr[40702]: 6165A82DF5: from=[email protected], size=348, nrcpt=1 (queue active)

Jan 19 10:45:48 localhost postfix/qmgr[40702]: 6312B831D2: from=[email protected], size=369, nrcpt=1 (queue active)

Jan 19 10:45:49 localhost postfix/smtp[41378]: 7076982DF9: to=[email protected], relay=smtp.gmail.com[74.125.130.109]:587, delay=2152, delays=2151/0.08/1.6/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[74.125.130.109] said: 535-5.7.8 Username and Password not accepted. For more information, go to?535 5.7.8 https://support.google.com/mail/?p=BadCredentials 98e67ed59e1d1-2f77629ac23sm4673152a91.39 - gsmtp)

Jan 19 10:45:49 localhost postfix/smtp[41379]: 6165A82DF5: to=[email protected], relay=smtp.gmail.com[74.125.24.108]:587, delay=4430, delays=4428/0.1/1.7/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[74.125.24.108] said: 535-5.7.8 Username and Password not accepted. For more information, go to?535 5.7.8 https://support.google.com/mail/?p=BadCredentials d2e1a72fcca58-72dab9c8d7csm4372604b3a.101 - gsmtp)

Jan 19 10:45:49 localhost postfix/smtp[41380]: 6312B831D2: to=[email protected], relay=smtp.gmail.com[74.125.130.109]:587, delay=2203, delays=2201/0.15/1.6/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[74.125.130.109] said: 535-5.7.8 Username and Password not accepted. For more information, go to?535 5.7.8 https://support.google.com/mail/?p=BadCredentials 98e67ed59e1d1-2f72c15012asm7801558a91.9 - gsmtp)

Jan 19 10:46:07 localhost postfix/pickup[40701]: E458380CE9: uid=1001 from=rebekah@localhost

Jan 19 10:46:07 localhost postfix/cleanup[41387]: E458380CE9: message-id=20250118234607.E458380CE9@localhost

Jan 19 10:46:07 localhost postfix/qmgr[40702]: E458380CE9: from=[email protected], size=369, nrcpt=1 (queue active)

Jan 19 10:46:07 localhost postfix/error[41389]: E458380CE9: to=[email protected], relay=none, delay=0.04, delays=0.02/0.01/0/0.01, dsn=4.7.8, status=deferred (delivery temporarily suspended: SASL authentication failed; server smtp.gmail.com[74.125.130.109] said: 535-5.7.8 Username and Password not accepted. For more information, go to?535 5.7.8 https://support.google.com/mail/?p=BadCredentials 98e67ed59e1d1-2f72c15012asm7801558a91.9 - gsmtp)

Here is my main.cf file:

#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)

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

See http://www.postfix.org/COMPATIBILITY_README.html – default to 3.6 on

fresh installs.

compatibility_level = 3.6

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_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs

smtp_tls_security_level=may

smtp_tls_session_cache_database =

btree:${data_directory}/smtp_scache

smtpd_relay_restrictions = permit_mynetworks

permit_sasl_authenticated defer_unauth_destination

myhostname = localhost

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

myorigin = rapidwater.au

mydestination = localhost

relayhost = [smtp.gmail.com]:587

mynetworks = 127.0.0.0/8

mailbox_size_limit = 0

recipient_delimiter = +

inet_interfaces = all

inet_protocols = ipv4

smtpd_use_tls = yes

smtpd_tls_auth_only = yes

smtpd_sasl_type = dovecot

smtpd_sasl_path = private/auth

smtpd_sasl_auth_enable = yes

smtpd_recipient_restrictions = permit_sasl_authenticated,

permit_mynetworks, reject_unauth_destination

virtual_transport = lmtp:unix:private/lmtp

virtual_mailbox_domains =

proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf

virtual_alias_maps =

proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf,

proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf

virtual_mailbox_maps =

proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf

smtp_sasl_auth_enable = yes

smtp_sasl_security_options = noanonymous

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

maillog_file = /var/log/mail.log

smtp_sender_dependent_authentication = yes

sender_canonical_maps = hash:/etc/postfix/sender_canonical

smtp_tls_policy_maps = hash:/etc/postfix/tls_policy

smtp_sasl_mechanism_filter = login plain

I have configured my SASL password file with the “to” email specified above and the 16-character App Password generated by Google, so I’m unsure why the username and password are not accepted.

Can someone please help with this? Any assistance would be greatly appreciated.

Cheers,