Skip to content

CICD-323 · TLS certificate expiry checking ​

Encyclopedia · Advanced networking and API testing · All snippets

Previous · CICD-322 · Next · CICD-324

1. Where it fits ​

  • Placement CI run step or authorized lab terminal.
  • Prerequisites authorized test service, known endpoint or local fixture and the named test CLI.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters SERVICE_HOST.

2. Copy the snippet ​

bash
set -o pipefail
openssl s_client -connect "${SERVICE_HOST:?}:443" -servername "$SERVICE_HOST" </dev/null 2>/dev/null | openssl x509 -noout -checkend 1209600

3. How it works ​

The connection uses the supplied TLS endpoint and server name. Trust, hostname and expiry are independent checks.

4. Verify the result ​

Fail if the leaf expires within 14 days. Use CICD-322 for separate trust validation.

Validation syntax-validated (Bash parse). Status definitions.