Monday, June 28, 2010

openssl s_client with POP3 connections

Troubleshooting an email checking issue, I decided to connect to the mail server from the command line and try it manually to see what was going on. I connected with openssl's s_client, and tried to read one of the messages:
openssl s_client -connect mailserver.domain.com:995
...
+OK DBMAIL pop3 server ready to rock
USER username
+OK Password required for username
PASS password
+OK username has 45 messages (103973 octets)
RETR 1
RENEGOTIATING
...
A quick search revealed that any command starting with "R" will result in renegotiation. To prevent it, simply add the -ign_eof switch:
openssl s_client -connect mailserver.domain.com:995 -ign_eof