Extract expiry dates of all SSL certificates for virtual servers

Hi,

I have spent some time today to add a script that would be used to check on virtual servers (domains) SSL certificates expiry date and report out the results.

Usage:

perl virtualmin-get-domains-ssl-status.pl

Output:

.---------------------------------------------------------------------------------------------------------------------.
|                                          SSL CERTIFICATES EXPIRATION DATES                                          |
+---------------------+-------------------------------------------+-----------------------------+------------+--------+
| DOMAIN NAME         | PATH TO CERTIFICATE FILE                  | VALID UNTIL                 | EXPIRES IN | STATUS |
+---------------------+-------------------------------------------+-----------------------------+------------+--------+
| site1.com           | /etc/pki/domains/site1.com.cert           | Mar 08, 2020 (Sun 09:44:56) | 61 days    | VALID  |
| mywebsite.io        | /etc/pki/domains/mywebsite.io.cert        | Mar 08, 2020 (Sun 11:49:48) | 61 days    | VALID  |
| myothersite007.com  | /etc/pki/domains/myothersite007.com.cert  | Mar 19, 2020 (Thu 05:24:46) | 72 days    | VALID  |
| mywebsite.io        | /etc/pki/domains/mywebsite.io.cert        | Feb 15, 2020 (Sat 07:43:05) | 39 days    | VALID  |
| example.io          | /etc/pki/domains/example.io.cert          | Mar 08, 2020 (Sun 09:50:05) | 61 days    | VALID  |
'---------------------+-------------------------------------------+-----------------------------+------------+--------'

Regards,
Ilia

2 Likes