How to check SSL certificate in Linux command line?
Let's say I have a server that requires the following connection to another server (lets call it example.com), SSL for this connection is important for security reasons and I know that for this server the connection has to be in https. My question is, how do I check if an ssl connection is actually going to the server, with port 443?
Also, if possible, is there any way to only use the command line, no GUI available? I've tried: openssl sclient -connect example.com:443 -showcerts but it only works with the GUI, it shows nothing if used in the cli, the help option isn't working either. To verify you're connecting to your host name's main site you can use the SSL Labs test page. It says it works on Firefox for Windows but I don't know about others. You can look up how to use it in your browser and use that as your reference.
To check your SSL connection when you can run openssl from the terminal you can type in this command.pem The above command is what will be included in the certbot-auto tool mentioned in the link supplied by @Michael.
How do I check if a SSL certificate is valid Linux?
I have a Linux web server running an Apache webserver.
I am looking for a way to check that the SSL certificate installed on the server is valid. I was thinking of checking to see if the CN (Common Name) field in the certificate matches the DNS name for the server. Is there a way to do this with the OpenSSL command-line tool? For example, if I did:
Openssl x509 -in certificate.pem -noout -text the command line should print the certificate Common Name and the DNS name. Is there a way to check this from a bash script? OpenSSL can output various information about a certificate by using -noout, which means it won't display the data it outputs. To display all the information that it does output, use -text.
From your question it sounds like you already have a working script; if you don't, consider making one.
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...