How to check SSL Certificate Expiration Date through command line on CentOS server ?

How to check SSL Certificate Expiration Date through command line on CentOS server ?

An SSL Certificate Contains a lot of information about issuer(Who issued the SSL Certificate), Subject(To whom it is issued), Validity dates(date till it is valid) and many other stuff like Hash values and MD5 Fingerprint. Checking for SSL Certificate Expiration date and it's validity is quite a common job in Hosting industry. Server admins usually check it through command line, it is quite simple and easy. But, for newbie it's really hard to get it easily. Nothing to worry about it, today we will tell you how to check SSL Certificate related information through command line.

First of all, you have to connect to server as root.
Synatx :
-----
# echo | openssl s_client -connect site: port 2>/dev/null | openssl x509 -noout -dates
-----

Let's check Expiry date for hoststud . com :
-----
# echo | openssl s_client -connect hoststud.com:443 2>/dev/null | openssl x509 -noout -dates
-----
This will provide result for expiry date of SSL certificate installed on server for this domain.

Now, to check "Who issued the certificate" we can run this command :
-----
# echo | openssl s_client -connect hoststud.com:443 2>/dev/null | openssl x509 -noout -issuer
-----

To check "To whom it is issued" :
-----
# echo | openssl s_client -connect hoststud.com:443 2>/dev/null | openssl x509 -noout -subject
-----

Validity of the SSL Certificate :
-----
# echo | openssl s_client -connect hoststud.com:443 2>/dev/null | openssl x509 -noout -dates
-----

To check Hash value :
-----
# echo | openssl s_client -connect hoststud.com:443 2>/dev/null | openssl x509 -noout -hash
-----

To check MD5 fingerprint :
-----
# echo | openssl s_client -connect hoststud.com:443 2>/dev/null | openssl x509 -noout -fingerprint
-----

To get all information from an SSL certificate at once :
-----
# echo | openssl s_client -connect hoststud.com:443 2>/dev/null | openssl x509 -noout -text
-----
Author
bhawanisingh
Views
5,079
First release
Last update
Rating
0.00 star(s) 0 ratings
Top