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 user@example.com 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.

ste
  • 381
  • 1
  • 3
  • 8

1 Answers1

2

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

echo -ne '\0username@domain.com\0password!'|base64

You could also try the PERL approach:

perl -MMIME::Base64 -e 'print encode_base64("\000user\@domain.com\000password")'
Antonius Bloch
  • 4,680
  • 6
  • 29
  • 41