====== Ubuntu - SSL - Connect to an SSL-enabled service ======
openssl s_client -connect mail.sharewiz.net:995
returns:
CONNECTED(00000003)
[ ..... ]
user ME
+OK Name is a valid mailbox
pass SOMETHING_OR_ANOTHER
+OK Mailbox locked and ready
list
+OK scan listing follows
1 1225
2 1863
3 1668
4 963
5 1969
6 1437
7 2357
8 3316
9 3517
10 8952
11 9616
quit
+OK
**NOTE:** The SSL and TLS connection setup process consists of four stages:
- The client and server negotiate security capabilities, such as the public-key algorithm, the symmetric key algorithm, and compression algorithms.
- The server transmits digital certificates and key information to the client, allowing the client to validate the identity of the server.
- The client exchanges key information with the server, and optionally authenticate itself with a digital certificate.
- The client and server use the negotiated parameters.
----
===== Print each high-level stage of a SSL-enabled service =====
openssl s_client -connect mail.sharewiz.net:443 -state -nbio 2>&1 | grep "^SSL"
returns:
SSL_connect:before SSL initialization
SSL_connect:SSLv3/TLS write client hello
SSL_connect:error in SSLv3/TLS write client hello
SSL_connect:SSLv3/TLS write client hello
SSL_connect:SSLv3/TLS read server hello
SSL_connect:SSLv3/TLS read server certificate
SSL_connect:SSLv3/TLS read server key exchange
SSL_connect:SSLv3/TLS read server done
SSL_connect:SSLv3/TLS write client key exchange
SSL_connect:SSLv3/TLS write change cipher spec
SSL_connect:SSLv3/TLS write finished
SSL_connect:error in SSLv3/TLS write finished
SSL_connect:SSLv3/TLS write finished
SSL_connect:SSLv3/TLS read server session ticket
SSL_connect:SSLv3/TLS read change cipher spec
SSL_connect:SSLv3/TLS read finished
SSL handshake has read 3101 bytes and written 402 bytes
SSL-Session:
----