Validate that SASL Authentication Works

Very simply, use the testsaslauthd command as root to test if the basic sasl-authd service is working correctly:

 tethys:/etc/mail> sudo testsaslauthd -u test -p test -s smtp
0: OK "Success."
 tethys:/etc/mail>

Testing on Port 587

Port 25 on my system and others doesn't offer authentication while port 587 does. So, in order to test, telnet to your mail server on port 587. For this test, you will need to encode your username and password in base64. I have provided a handy javascript utility below to do just that.

Base64 encoding

Username or Password:

 

However, if you don't want to use the above and you have a unix system, you can use the base64 program as follows:

[tethys]:/home/rnejdl> echo -n 'test123' | gbase64
dGVzdDEyMw==
[tethys]:/home/rnejdl> echo 'dGVzdDEyMw==' | gbase64 -d 
test123
[tethys]:/home/rnejdl>

Testing SASL Authentication through SMTP

After connecting to your server on port 587, type ehlo yourdomainname.com. Then, type AUTH LOGIN followed by your base64 encrypted username and hit enter. Next, enter your base64 encrypted password. From there, you can follow the normal progression for sending email through SMTP. Below is the full run through:

tethys:/etc/mail>telnet localhost 587
Trying 127.0.0.1...                   
Connected to localhost.               
Escape character is '^]'.             
220 tethys.ringofsaturn.com ESMTP Sendmail 8.14.3/8.14.3; Fri, 31 Jul 2009 22:34:05 -0500 (CDT)                                                                 
ehlo ringofsaturn.com                                                           
250-tethys.ringofsaturn.com Hello localhost [127.0.0.1], pleased to meet you    
250-ENHANCEDSTATUSCODES                                                         
250-PIPELINING                                                                  
250-8BITMIME                                                                    
250-SIZE
250-DSN
250-AUTH PLAIN GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN
250-DELIVERBY
250 HELP
AUTH LOGIN dGVzdA==
334 UGFzc3dvcmQ6
dGVzdDEyMw==
235 2.0.0 OK Authenticated
mail from:test@test.com
250 2.1.0 test@test.com... Sender ok
rcpt to:rnejdl@ringofsaturn.com
250 2.1.5 rnejdl@ringofsaturn.com... Recipient ok
data
354 Enter mail, end with "." on a line by itself
Subject: Test
Test
.
250 2.0.0 n713Y5rh055422 Message accepted for delivery
quit
221 2.0.0 tethys.ringofsaturn.com closing connection
Connection closed by foreign host.
Exit 1
 tethys:/etc/mail>