Postfix gmail relay SASL authentication failed invalid parameter supplied

Hi there, im using leap 15.5, trying to send emails thru gmail relay and getting crazy.
Send my configuration for someone to helpme
wen im trying to send the email the error is:

postfix/pickup[30145]: CFC982C034E: uid=0 from=<root>
postfix/cleanup[30149]: CFC982C034E: message-id=<20240228100831.CFC982C034E@localhost>
postfix/qmgr[30144]: CFC982C034E: from=<root@localhost>, size=428, nrcpt=1 (queue active)
postfix/smtp[31278]: CFC982C034E: to=<email@gmail.com>, relay=smtp.gmail.com[64.233.167.109]:587, delay=5.5, delays=0.05/0/5.4/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.gmail.com[64.233.167.109]: invalid parameter supplied)

In the gmail account i have created a apps password

In the file /etc/postfix/sasl_passwd

[smtp.gmail.com]:587 nuno.catarino@xxxx.pt:zzzz zzzz zzzz zzzz

the result of the command
postmap -q β€œ[smtp.gmail.com]:587” lmdb:/etc/postfix/sasl_passwd
is:

nuno.catarino@xxxx.pt:zzzz zzzz zzzz zzzz

I did the
postmap /etc/postfix/sasl_passwd
and restarted the postfix service

The configuration file /etc/postfix/master.cf
is

smtp      inet  n       -       n       -       -       smtpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
relay     unix  -       -       n       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
postlog   unix-dgram n  -       n       -       1       postlogd

result of the command postconf -n

alias_maps = lmdb:/etc/aliases
biff = no
canonical_maps = lmdb:/etc/postfix/canonical
command_directory = /usr/sbin
compatibility_level = 3.6
content_filter =
daemon_directory = /usr/lib/postfix/bin/
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
defer_transports =
delay_warning_time = 1h
disable_dns_lookups = no
disable_mime_output_conversion = no
disable_vrfy_command = yes
html_directory = /usr/share/doc/packages/postfix-doc/html
inet_interfaces = localhost
inet_protocols = ipv4
mail_owner = postfix
mail_spool_directory = /var/mail
mailbox_command =
mailbox_size_limit = 0
mailbox_transport =
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_domains =
masquerade_exceptions = root
message_size_limit = 0
message_strip_characters = \0
mydestination = $myhostname, localhost.$mydomain
myhostname = localhost
mynetworks_style = subnet
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/packages/postfix-doc/README_FILES
relay_clientcerts =
relay_domains = $mydestination, lmdb:/etc/postfix/relay
relayhost = [smtp.gmail.com]:587
relocated_maps = lmdb:/etc/postfix/relocated
sample_directory = /usr/share/doc/packages/postfix-doc/samples
sender_canonical_maps = lmdb:/etc/postfix/sender_canonical
sendmail_path = /usr/sbin/sendmail
setgid_group = maildrop
smtp_enforce_tls = no
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = lmdb:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_tls_CAfile = /etc/ssl/ca-bundle.pem
smtp_tls_CApath =
smtp_tls_cert_file =
smtp_tls_key_file =
smtp_tls_session_cache_database =
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP
smtpd_client_restrictions =
smtpd_delay_reject = yes
smtpd_helo_required = no
smtpd_helo_restrictions =
smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination
smtpd_sasl_auth_enable = no
smtpd_sender_restrictions = lmdb:/etc/postfix/access
smtpd_tls_CAfile =
smtpd_tls_CApath =
smtpd_tls_ask_ccert = no
smtpd_tls_cert_file =
smtpd_tls_key_file =
smtpd_tls_received_header = no
smtpd_use_tls = no
strict_8bitmime = no
strict_rfc821_envelopes = no
transport_maps = lmdb:/etc/postfix/transport
unknown_local_recipient_reject_code = 550
virtual_alias_domains = lmdb:/etc/postfix/virtual
virtual_alias_maps = lmdb:/etc/postfix/virtual

Result of the command
systemctl status postfix.service

postfix.service - Postfix Mail Transport Agent
     Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-02-27 17:03:12 WET; 17h ago
    Process: 28975 ExecStartPre=/bin/echo Starting mail service (Postfix) (code=exited, status=0/SUCCESS)
    Process: 28976 ExecStartPre=/usr/lib/postfix/systemd/config_postfix (code=exited, status=0/SUCCESS)
    Process: 28977 ExecStartPre=/usr/lib/postfix/systemd/update_chroot (code=exited, status=0/SUCCESS)
    Process: 28978 ExecStartPre=/usr/lib/postfix/systemd/update_postmaps (code=exited, status=0/SUCCESS)
    Process: 28990 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
    Process: 29062 ExecStartPost=/usr/lib/postfix/systemd/wait_qmgr 60 (code=exited, status=0/SUCCESS)
    Process: 29069 ExecStartPost=/usr/lib/postfix/systemd/cond_slp register (code=exited, status=0/SUCCESS)
   Main PID: 29059 (master)
      Tasks: 8 (limit: 4915)
     CGroup: /system.slice/postfix.service
             β”œβ”€ 29059 /usr/lib/postfix/bin//master -w
             β”œβ”€ 30144 qmgr -l -t fifo -u
             β”œβ”€ 30145 pickup -l -t fifo -u
             β”œβ”€ 30149 cleanup -z -t unix -u
             β”œβ”€ 30150 trivial-rewrite -n rewrite -t unix -u
             β”œβ”€ 30152 tlsmgr -l -t unix -u
             β”œβ”€ 30165 local -t unix
             └─ 31278 smtp -t unix -u

Thx in advance

1 Like

Perhaps you could try with a normal hash table to rule out any LDAP/driver issues.
I haven’t used the lmdb driver, so can’t help out there!

Thx for your answer, but in the documentation of opensuse i read

Blockquote
NOTE: With SLES 15 SP3, the postfix package has been updated to 3.5.9. Support for β€œhash” file type has been dropped and a new type of β€œlmdb” is recommended.

Ah okay, I did not know this!
We use Postfix at work but on Debian, so not bleeding edge like TW!

I found a similar thread from some years ago:

Perhaps could you check if postfix check throws any warnings?

Perhaps being more explicit could be useful, for example instead of postmap /etc/postfix/sasl_passwd do postmap lmdb:/etc/postfix/sasl_passwd

SOLVED by Wietse Venema via Postfix-users

The solution could be as simple as:

/etc/postfix/main.cf:
smtp_sasl_mechanism_filter = login plain

1 Like

Postfix check was no warnings

The legend himself :exploding_head:

smtp_sasl_mechanism_filter = login plain

Completely new config for me too. We use dovecot as SASL backend, so this is configured in there, it supports only PLAIN and LOGIN so never had to limit the mechanisms from Postfix itself.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.