Improve handling of short-lived certificates (#3097) [3.2 backport]

Backport of the short-lived certificate handling from 3.3dev (commit
26a75cf7) to the 3.2 branch, as the issue was reported against 3.2.4.

Certificates with a short validity period (e.g. Let's Encrypt's 6-day
"shortlived" profile, now GA) always tripped the days2warn expiry
thresholds and were shown in red on the "Certificate Validity (UTC)"
line, even seconds after issuance. That red is misleading for a cert
that is intentionally short-lived.

Detect short-lived certificates by their validity period (notAfter -
notBefore) using a new DAYS_VALID_SHORTLIVED threshold (default 10 days,
per the CA/Browser Forum BR 1.6.1 "Short-lived Subscriber Certificate"
definition, which also covers the LE 6-day profile). For such certs:

  - show them as good (not red) with a "short-lived cert (N days)" remark, and
  - warn (HIGH) only when less than 24h of validity is left, and only for
    certificates whose total lifetime exceeds 24h.

Regular certificates are unaffected. The threshold is overridable via the
DAYS_VALID_SHORTLIVED env var (documented in doc/testssl.1.md next to
DAYS2WARN1/2) and added to CHANGELOG.md. The 3.2 man/HTML docs are
Ronn-NG generated, so the entry was added to match that format.
This commit is contained in:
Eric Gu
2026-07-15 16:39:10 -04:00
parent 4c52b36fc2
commit e2de42f93f
5 changed files with 28 additions and 0 deletions
+2
View File
@@ -411,6 +411,8 @@ DAYS2WARN1 is the first threshold when you'll be warning of a certificate expira
.IP "\[ci]" 4
DAYS2WARN2 is the second threshold when you'll be warning of a certificate expiration of a host, preset to 30 (days)\. For Let's Encrypt this value will be divided internally by 2\.
.IP "\[ci]" 4
DAYS_VALID_SHORTLIVED is preset to 10 (days)\. Certificates with a total validity period (notAfter \- notBefore) of this many days or fewer are treated as intentionally short\-lived (see "Short\-lived Subscriber Certificate" in the CA/Browser Forum Baseline Requirements, e\.g\. Let's Encrypt's 6\-day profile)\. They are not being warned of for their short lifespan\. A warning is issued only when less than 24 hours of validity are left, and only for certificates whose total validity period is more than 24 hours\.
.IP "\[ci]" 4
TESTSSL_INSTALL_DIR is the derived installation directory of testssl\.sh\. Relatively to that the \fBbin\fR and mandatory \fBetc\fR directory will be looked for\.
.IP "\[ci]" 4
CA_BUNDLES_PATH: If you have an own set of CA bundles or you want to point testssl\.sh to a specific location of a CA bundle, you can use this variable to set the directory which testssl\.sh will use\. Please note that it overrides completely the builtin path of testssl\.sh which means that you will only test against the bundles you point to\. Also you might want to use \fB~/utils/create_ca_hashes\.sh\fR to create the hashes for HPKP\.