Skip to content

CICD-322 · TLS certificate validation ​

Encyclopedia · Advanced networking and API testing · All snippets

Previous · CICD-321 · Next · CICD-323

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
openssl s_client -connect "${SERVICE_HOST:?}:443" -servername "$SERVICE_HOST" -verify_hostname "$SERVICE_HOST" -verify_return_error </dev/null

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 ​

Require a successful chain and hostname check. The connect and servername host should match the intended ingress.

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