I don't understand why this command is failing
openssl s_client -connect smtp.gmail.com:587 -starttls smtp < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout -in /dev/stdin | cut -d'=' -f2
I am trying to initiate a TLS smtp session with the smtp server of Gmail and then redirect the output of the console to the x509 function in order to extract the fingerprint.
Here is what I get when I run the command without filtering the errors
$ openssl s_client -connect smtp.gmail.com:587 -starttls smtp < /dev/null
connect: Bad file number
connect:errno=9
What am I doing wrong?
There is a firewall upstream of my connexion which seems to block my query. Adding torify at the beginning of the command (I have Tor installed on my computer) solved the issue.
user@home:~$ torify openssl s_client -connect smtp.gmail.com:587 -starttls smtp < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout | cut -d'=' -f2
D3:7C:82:FC:D0:5F:8F:D7:DA:A2:59:8C:42:D7:B2:9F:C1:9F:7E:60