How do I check SSL certificate in Linux?
For a Linux desktop user, checking SSL certificate is typically a breeze.
When the system prompts me for my password, my browser may say "Not secure" and there are several tools for quick diagnosis at However, Linux server admins have a much more difficult time: How do I check SSL certificate for www.openssl. What kind of commands do I need to install?
5
6
The following procedure is specific to openssl.org, so you'd need to change a few lines in this procedure if you want to run similar commands with another website such as bitlbee (the default openssl command is not working with that one). However, openssl.org has signed the certificate, so they probably won't change any details and this procedure will still work with it - hopefully.
The following commands will work as root with openssl.org's certificate./CN=openssl.org/OU=VeriSign Trust Network/emailAddress=root@openssl.org/O=OpenSSL>
If it doesn't work and you see lots of warnings, just use -v to get more info.
How to check SSL version in Linux?
I am trying to check if the TLS version is 1.
2. However, I found a way to check that using python 2.7 as follows:
#!/usr/bin/env python. Import socket, sys. S=socket.socket(socket.AFINET,socket.SOCKSTREAM)
Print s.getsockopt(socket.SOLSOCKET,socket.SOTLSVERSION)
S.close() The above code gives me the result 0. However, when I tried this for Python 3.7, it gave me the following error:
Traceback (most recent call last): File "./checktlsversion.py", line 11, in
print s.getsockopt(socket.
I'm sure that's not the only way to do this but here's my quick and dirty example: def checksslversion(): sock = socket.socket(socket.AFINET, socket.SOCKSTREAM)
sock.connect(('www.google.com', 443))
if hasattr(sock, 'getsockopt'): try: val = sock.getsockopt(socket.SOLSOCKET, socket.SOTLSVERSION)
except socket.error as e: if e.errno != errno.ENOPROTOOPT:
raise. return False. else: return True. If checksslversion(): print('SSL version is at least TLSv1.
Related Answers
What is TLS/SSL Protocol?
TLS stands for Transport Layer Security and it is a protocol used to create a secure connect...
Which is more secure SSL TLS or HTTPS?
and SSL? I know the difference between TCP/IP vs. IP, or S...
Is SSL TLS certificate free?
If you are going to use the certificate in production environment, I sugg...