Linux 4 All

Best Linux tricks source

Posts in the openssl category

Here is how to test IMAP, POP and SMTP authentication using telnet or openssl:

POP3 test:

telnet $SERVER_IP 110
+OK Hello there. 
USER user@example.com
+OK Password required.
PASS Password
+OK logged in.

IMAP test:

telnet $SERVER_IP 143
a1 LOGIN user@example.com Password
a1 OK LOGIN Ok.

POP3-SSL test:

openssl s_client -connect $SERVER_IP:995
+OK Hello there. 
USER user@example.com
+OK Password required.
PASS Password
+OK logged in.

IMAP-SSL test:

openssl s_client -connect $SERVER_IP:993
a1 LOGIN user@example.com Password
a1 OK LOGIN Ok.

For the SMTP test, first we need to generate base64 encrypted username/password hash and then we can test it:

printf '\0%s\0%s' 'user@example.com' 'Password' | openssl base64
AHVzZXJAZXhhbXBsZS5jb20AUGFzc3dvcmQ=

telnet $SERVER_IP 25
AUTH PLAIN AHVzZXJAZXhhbXBsZS5jb20AUGFzc3dvcmQ=
235 2.7.0 Authentication successful AHVzZXJAZXhhbXBsZS5jb20AUGFzc3dvcmQ=

e-mail

photo credit: Micky.! via photopin cc

Check SSL keys

  • In Linux
  • On 3 Nov | '2014

Before installing a SSL certificate, it worth checking if the private or CSR key match with the certificate.

openssl x509 -noout -modulus -in certificate.crt | openssl md5
openssl rsa -noout -modulus -in privateKey.key | openssl md5
openssl req -noout -modulus -in CSR.csr | openssl md5