2

I've set up an email server using Postfix and Dovecot and I'm able to send and receive mail using various mail clients but for some reason I get an authentication error when I try to connect via openssl in the terminal.

This is pretty much how it goes down:

openssl s_client -connect mail.example.com:587 -starttls smtp

[a connection to the server is established]

EHLO mail.example.com
AUTH PLAIN cGFzc3dvcmQ=
535 5.7.8 Error: authentication failed:

I've used each of the following to produce my AUTH PLAIN message, none of which have authenticated me:

echo -en '\0username\0password!'|base64

echo -en '\000username\000password!'|base64

echo -e '\0username\0password!'|base64

echo -e '\000username\000password!'|base64

The tutorial I used to set up the mail server suggested I use:

echo -en '\000username\000password!'|base64

but that has never worked for me.

My username is in the format [email protected] and this works when using mail clients to connect to the server.

Does anyone know why I might be getting the error? I'm assuming it's because I'm not generating the base64 authentication message correctly but I'm fairly new to Linux so I might be overlooking something simple.

I've followed the tutorial to the letter and I've double checked my settings several times. Other than that one problem, everything else is working as expected.

The server is running Debian 7 (64 bit) and the tutorial is here: https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/

Thanks.

4
  • 1
    Compare your base64 output with: perl -MMIME::Base64 -e 'print encode_base64("\000user\@domain.com\000password")' Mar 30, 2015 at 18:29
  • @AntoniusBloch Please add this comment to your answer so I can accept it. You were spot on. Thank you.
    – ste
    Mar 31, 2015 at 10:29
  • You mean that the 'base64' command didn't work, but the PERL approach did? Apr 7, 2015 at 22:15
  • Exactly, the PERL approach worked for me. Thanks again.
    – ste
    Apr 8, 2015 at 23:00

1 Answer 1

2

Most setups include the domain in the username. (At least most of mine.) Try:

echo -ne '\[email protected]\0password!'|base64

You could also try the PERL approach:

perl -MMIME::Base64 -e 'print encode_base64("\000user\@domain.com\000password")'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .