Bootstrap FreeKB - Postfix (Email) - Resolve "authentication failed"
Postfix (Email) - Resolve "authentication failed"

Updated:   |  Postfix (Email) articles

Authentication failed can appear in a variety of different areas. For example, authentication failed may appear in the /var/log/maillog.

warning: client.example.com[192.168.0.12]: SASL LOGIN authentication failed: UGFzc3dvcmQ6

 

Authentication failed may also appear when using the mailx command.

[root@server1 ~]# echo "Hello World" | mailx -v -s "Test Email" -A default user1@example.com
Resolving host mail.example.com . . . done.
Connecting to 192.168.0.10:587 . . . connected.
220 mail.example.com ESMTP Postfix
>>> EHLO client.example.com
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITTIME
250 DSN
>>> STARTTLS
220 2.0.0 Ready to start TLS
Comparing common name: "mail.example.com"
host certificate does not match "mail.example.com"
SSL parameters: cipher=missing, keysize=256, secretkeysize=256,
issuer=E=admin@example.com,CN=mail.example.com,OU=example,O=example,L=City,ST=State,C=US
subject=E=admin@example.com,CN=mail.example.com,OU=example,O=example,L=City,ST=State,C=US
>>>EHLO client.example.com
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ESTN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITTIME
250 DSN
>>> AUTH LOGIN
334 VXN1cm5hbWU6
>>> cm9vdA==
334 UGFzc3dvcmQ6
>>> c2VjcmV0
535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6

 

Notice near the end of this utput are a few lines of encrypted data. VXN1cm5hbWU6 is username.

[root@server1 ~]# perl -MMIME::Base64 -e \ 'print_decode_base64("VXN1cm5hbWU6")'
Username

 

cm9vdA== is root, the username being used.

[root@server1 ~]# perl -MMIME::Base64 -e \ 'print_decode_base64("cm9vdA==")'
root

 

UGFzc3dvcmQ6 is Password.

[root@server1 ~]# perl -MMIME::Base64 -e \ 'print_decode_base64("UGFzc3dvcmQ6")'
Password

 

c2VjcmV0 is secret, the password being used.

[root@server1 ~]# perl -MMIME::Base64 -e \ 'print_decode_base64("c2VjcmV0")'
secret

 

Notice the mailx command includes -A default. This means that mailx is getting the username and password from the /etc/mail.rc file. Typically, this would be necessary when using a Linux machine that is not the Postfix email server. In the /etc/mail.rc file, ensure root and roots password are being used. You would use root's password for the Postfix email server.

[root@server1 ~]# cat /etc/mail.rc
. . .
set smtp-auth-user=root
set smtp-auth-password="roots_password"
. . .

 

Once /etc/mail.rc is configured to use root and roots password, the authentication error should no longer appear.

[root@server1 ~]# echo "Hello World" | mailx -v -s "Test Email" -A default user1@example.com
Resolving host mail.example.com . . . done.
Connecting to 192.168.0.10:587 . . . connected.
220 mail.example.com ESMTP Postfix
>>> EHLO client.example.com
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITTIME
250 DSN
>>> STARTTLS
220 2.0.0 Ready to start TLS
Comparing common name: "mail.example.com"
host certificate does not match "mail.example.com"
SSL parameters: cipher=missing, keysize=256, secretkeysize=256,
issuer=E=admin@example.com,CN=mail.example.com,OU=example,O=example,L=City,ST=State,C=US
subject=E=admin@example.com,CN=mail.example.com,OU=example,O=example,L=City,ST=State,C=US
>>>EHLO client.example.com
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ESTN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITTIME
250 DSN
>>> AUTH LOGIN
334 VXN1cm5hbWU6
>>> cm9vdA==
334 UGFzc3dvcmQ6
>>> c2VjcmV0
235 2.7.0 Authentication successful
>>> MAIL FROM:<user1@example.com>
250 2.1.5 Ok
>>> DATA
354 End data with <CR><LF>.<CR><LF>
>>> .
250 2.0.0 Ok: queued as A96586012F
>>> QUIT
221 2.0.0 Bye

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter aca4ee in the box below so that we can be sure you are a human.