is there a one liner - terminal ssh command to get the expiration date of your hostname SSL Certificate?

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
hi,
Just wondering how can you check the date of expiration of your hostname SSL certificate?
I know it shows for the domains in WHM but not for the Hostname?
is there a one liner for this or can this be added as well to WHM in another Colum to show when the cert will expire like auto SSL for domains ?

Thanks
Spiro
 

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
549
255
138
IN
cPanel Access Level
Root Administrator
You can check with below command:

Code:
# openssl s_client -servername your.hostname.com -connect your.hostname.com:443 | openssl x509 -noout -dates

Replace your.hostname.com in the above command with the server name you wish to check.

The output will show dates and other information:

depth=3 C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
verify return:1
depth=2 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA Certification Authority
verify return:1
depth=1 C = US, ST = TX, L = Houston, O = "cPanel, Inc.", CN = "cPanel, Inc. Certification Authority"
verify return:1
depth=0 CN = your.hostname.com
verify return:1
notBefore=Feb 26 00:00:00 2022 GMT
notAfter=May 27 23:59:59 2022 GMT
 
  • Like
Reactions: Spirogg and cPRex

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
openssl s_client -servername your.hostname.com -connect your.hostname.com:443 | openssl x509 -noout -dates
this did the trick, I search on google late last night and found something similar but it gave me errors but this CLI works perfect :)

thanks @kodeslogic much appreciated :)



@cPRex this would be nice if we had the expiration date in another column and RSA as well
  • when we go to Home /SSL/TLS /SSL Storage Manager
Have add another column for expiration
and add the RSA in the first column like the self sign certificates show

maybe with the other request to allow AutoSSL to reset cert for hostname and apply. ?

kinda goes hand in hand I would think

thanks so much for your help always @cPRex and @kodeslogic
 

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
I like it - you want to put in a feature request and I'll get it reviewed?
@cPRex
ok I expanded on the Idea a little which would make sense ?
here is the Feature Request Hopefully


Thanks again as always
Kind Regards,
Spiro