Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

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

Wednesday, March 3, 2010

UNIX sort by multiple columns

Sometimes the "obvious" stuff isn't so obvious (at least to me...)

I had a text file with multiple columns of numbers. I wanted to sort it by the first column, then the second, then the third. It wasn't immediately obvious to me how to do it. The man page for 'sort' of course does not mention that you can specify the '-k' option multiple times, and I didn't have the GNU 'info' utility installed:
sort -k1n -k2n -k3n file