GoAdmio

checkssl

Audit SSL certificates for all hosted domains, renew those close to expiry, and send expiry alerts

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/checkssl checks the SSL certificate of every domain hosted on the server. For each domain it:

A second mode, count, finds main domains whose certificate covers few names (or that have no certificate) and can install SSL for them in one run (see Count mode).

[!WARNING] When a certificate has 1 to 3 days left, checkssl deletes its files from /etc/letsencrypt/live/ and /etc/letsencrypt/archive/ before requesting a new one. If the new request fails, the domain is left without certificate files. See Expiry thresholds.


Quick start

# Check every domain and send alerts if anything needs attention
/go/checkssl

Syntax

# Check all domains
/go/checkssl

# List main domains whose certificate covers 10 or fewer names
/go/checkssl count

# Same list, and run ssl for each domain listed
/go/checkssl count --install
Form Behavior
/go/checkssl Checks every domain folder in /home whose name contains a dot.
/go/checkssl count Lists main domains with a small or missing certificate. Changes nothing.
/go/checkssl count --install Lists the same domains and runs ssl for each one.

If you run the command without root privileges, it restarts itself through sudo. Every run is appended to /var/log/go/checkssl.log with a timestamp and the arguments used.


Options

checkssl has no -- options. It reads two positional words:

Argument Required Default Notes
count No — Must be the first argument. Switches to Count mode.
--install No — Only has an effect together with count. Runs ssl for every domain the count lists.

Any other argument is ignored, apart from being written to the log.


Output

The command prints one progress line per domain, in red for problems, and sends alerts when it finds any.

Situation Console output Alerted by email and WhatsApp
Certificate found, more than 14 days left [N/Total] Checking <domain> (<days> days)... No
14 days or fewer left SSL Certificate Expiring in <days> Days (<domain>) Yes
No Certbot certificate, HTTPS check fails SSL Certificate not installed (<domain>) Yes
No Certbot certificate, HTTPS check passes Can not verify SSL Certificate (<domain>) Yes
Certificate found, site returns no page SSL Installed but website not responding (<domain>) No
Certificate found, webmail. or go. returns no page SSL Not Installed for (webmail.<domain>) or (go.<domain>) No

Sites behind Cloudflare are not reported as "not responding", because the proxy's answer is skipped.

Alerts

At the end of the run, one alert is sent through /go/sendmail and /go/sendwhatsapp:

Condition Alert subject Alert body
At least one priority domain (1 to 10 days left) SSL Certificate Checker (<n> Domains), category SSL Expiry Priority domains only.
No priority domains, but at least one error SSL Certificate Checker (<n> Domains), category SSL Checker Every error found.
Nothing found No alert —

[!NOTE] When a priority domain exists, the alert lists only the priority domains. Other errors from the same run, such as a domain with no certificate, appear on the console but are not in that alert. They are reported in the next run that has no priority domains.

Exit status

Mode Exit status
Check all domains The status of the last command run, normally 0.
count and count --install Always 1, even when the list was printed correctly.

Examples

# Full check, typically run on a schedule
/go/checkssl
[1/3] Checking example.com (63 days)...
[2/3] Checking shop.example.org (9 days)...
SSL Certificate Expiring in 9 Days (shop.example.org)
SSL Certificate not installed (old-site.net)
# Find main domains with a small or missing certificate
/go/checkssl count
[1] example.com (3) - Domains: example.com www.example.com go.example.com
[2] new-site.com (0) -
# Find them and install SSL for each one
/go/checkssl count --install

Troubleshooting

Symptom Likely cause Fix
SSL Certificate not installed (<domain>) Certbot has no certificate for the domain and HTTPS fails verification. DNS may not point to this server. Point the A record to this server, then run ssl <domain>.
Can not verify SSL Certificate (<domain>) HTTPS verifies, but Certbot has no record of the certificate. It was probably installed another way (a paid certificate, or Cloudflare's edge certificate on a proxied domain). No action if intended. Its expiry is not tracked here.
SSL Installed but website not responding HTTPS works, but the page has no closing </html> or </body> tag. The site may be down or return an empty or non-HTML response. Open the site and check the web server and PHP-FPM with heal.
SSL Not Installed for (webmail.<domain>) or (go.<domain>) The webmail. or go. host has no certificate or isn't answering. Run ssl <domain> again.
Domain has no certificate files after a run It had 1 to 3 days left, its files were deleted, and the new request failed. Run ssl <domain>. If the web server fails to reload, run checkapache or checknginx, then web.
Domain with 0 days left is not renewed The renewal only runs for 1 to 10 days left. Run ssl <domain> manually.
No alert received Nothing needed attention, or another run's priority alert hid the error. Check the console output and /var/log/go/checkssl.log.
The run is slow Domains are checked one at a time, and the HTTPS requests have no timeout. Run it from a scheduled job rather than interactively.
count returns status 1 Expected. This mode always exits with 1. Don't treat it as a failure in scripts.

Details

What it checks

flowchart TD
    A["checkssl"] --> B{"First argument is count?"}
    B -- "Yes" --> CN["Count mode"]
    B -- "No" --> D["For each /home/domain folder"]
    D --> E{"Certbot has a certificate?"}
    E -- "No" --> F["HTTPS check: report not installed or cannot verify"]
    E -- "Yes" --> G["Save expiry and days left in database"]
    G --> H{"Days left"}
    H -- "More than 14" --> K
    H -- "11 to 14" --> I["Record warning"]
    H -- "4 to 10" --> J["Record priority error, run ssl"]
    H -- "1 to 3" --> L["Record priority error, delete certificate files, run ssl"]
    I --> K["Test site, webmail and go over HTTPS"]
    J --> K
    L --> K
    F --> M
    K --> M["Send one email and WhatsApp alert if needed"]

Which domains are checked

The command looks at every folder directly under /home whose name contains a dot. Each one is read with certbot certificates -d <domain>, and the last line containing days supplies the expiry date and days left.

If Certbot reports no days value, the domain is treated as having no managed certificate. This includes expired certificates.

Expiry thresholds

Days left Recorded as Action
15 or more Healthy Database updated only.
11 to 14 Error Listed in the alert. No renewal.
4 to 10 Priority error Listed in the alert, then ssl is run for the domain.
1 to 3 Priority error Certificate files are deleted from /etc/letsencrypt/live/<domain> and /etc/letsencrypt/archive/<domain>, then ssl is run.
0 Error Listed in the alert. No renewal.

The database is updated before renewal, so SSLDaysLeft shows the value from before the renewal until the next run.

Website, webmail and go checks

For a domain with a Certbot certificate, the command fetches https://<domain>. The page counts as responding if the result contains </html> or </body>. Otherwise a red message is printed, unless the response mentions Cloudflare.

For a main domain it repeats the check for https://webmail.<domain> and https://go.<domain>. A domain counts as a main domain when it has one dot, or when removing a recognized two-part suffix (such as .co.uk, .com.au, .in.net, or .com.museum) leaves no dots. Anything else is treated as a subdomain and gets no webmail. or go. check.

These three checks are shown on the console only. They are not added to the alert.

Count mode

/go/checkssl count [--install]

Count mode looks at main domains that have a www folder under /home/<domain>/. For each one it counts the names on the Certbot certificate named after the domain. Domains whose certificate covers 10 or fewer names, including domains with no certificate (shown as (0)), are printed as:

[<n>] <domain> (<count>) - <list of certificate names>

With --install, ssl is run for each domain printed. The command then exits with status 1.

Files and services used

Item Purpose
/var/log/go/checkssl.log Log of every run and its arguments.
/var/lib/sqlite/site.db Receives SSLExpiresOn and SSLDaysLeft in the Site table.
certbot Source of the certificate and expiry information.
ssl Called to renew or install certificates.
sendmail and sendwhatsapp Deliver the alerts (used internally).

See also

Command Description
ssl Install an SSL certificate for a domain in GoAdmio
installssl Install Let's Encrypt SSL on GoAdmio
openssl Generate, install, or delete a paid SSL certificate
zerossl Install a ZeroSSL certificate via the command line
mailssl Install SSL certificates for SMTP and IMAP
sslsync Copy domain account SSL certificates from a local to a remote server
expire Check hosting and domain expiry dates and send email/WhatsApp notifications
sendmail Send the alert email (used internally)
sendwhatsapp Send the alert WhatsApp message (used internally)