Add --warn-days alerting to ssl-check, run it daily - #231
Open
jasperf wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Let's Encrypt stopped sending expiry reminder emails in June 2025, so a failed auto-renewal on a host we don't manage now goes unnoticed until visitors hit a browser warning.
ssl-checkcould report a certificate's dates but not alert on them.Change
ssl-check --warn-days Nexits2when any certificate expires within N days, has already expired, or doesn't match the hostname it was served for. The hostname check is deliberate: on Sep 11, 2026 a client site on shared hosting was serving the host's own wildcard certificate instead of its Let's Encrypt one — valid for months, so an expiry-only check would have passed it.1(certificate couldn't be retrieved) takes precedence over2.openssl x509 -checkendrather than parsingnotAfter, so the alert doesn't depend on macOS/GNUdatedifferences.-checkhost's output; an openssl without-checkhost(macOS's LibreSSL/usr/bin/openssl) skips the check instead of failing it.--warn-days, exit codes are unchanged; the only output change is a printed hostname mismatch..github/workflows/ssl-expiry.ymlruns it daily (06:17 UTC, plus manual dispatch) against theSSL_CHECK_DOMAINSrepository secret, threshold from theSSL_CHECK_WARN_DAYSvariable (default 21). The failed scheduled run is the alert. The list is a secret because this repo and its logs are public: each domain and its parent domains are masked before anything prints, since a wildcard certificate's subject names the parent.scripts/README.mdupdated, CHANGELOG 5.24.0.Setup after merge: add the
SSL_CHECK_DOMAINSsecret (domains separated by spaces, commas or newlines). Until it exists, the scheduled run fails with an explicit "secret is not set" error.Testing
bash -nunder macOS/bin/bash3.2,shellcheckclean--warn-days 21against badssl.com (valid), expired.badssl.com and wrong.host.badssl.com →ALERTfor the expired one,does NOT matchfor the wrong host, exit 2--warn-days 1000on one of them → exit 2/usr/bin/opensslagainst wrong.host.badssl.com → no verdict, exit 0 (check skipped, not failed)--warn-days, unknown option) → exit 1bash -eo pipefailmasks each domain plus its parentsgo generate ./...,go vet ./...,go test ./...andgo test .all pass