Why silent certificate failures happen on data exchange endpoints
- Leaf certificate expires. The endpoint certificate has a validity period. When it passes, TLS handshakes fail — but if the client application swallows errors or falls back to unverified mode, nobody notices.
- Intermediate certificate missing or expired. The server needs to send the full chain (leaf + intermediates) during the TLS handshake. If an intermediate is missing, clients that do not have it cached will reject the connection. Some clients silently skip verification.
- Revocation data unreachable. If the OCSP (Online Certificate Status Protocol) responder is down or the CRL (Certificate Revocation List) distribution point is unreachable, clients may soft-fail — meaning they accept the certificate anyway, even if it has been revoked.
Step 1: Pull the certificate and check expiry dates
data-exchange.example.go.id and the port with the actual hostname and port of the service you need to verify.
BASH
# Connect and display the leaf certificate details
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates -serialTEXT
subject=CN = data-exchange.example.go.id
issuer=CN = National Intermediate CA G2, O = National PKI Authority
notBefore=Jan 1 00:00:00 2024 GMT
notAfter=Jan 1 00:00:00 2025 GMT
serial=0A1B2C3D4E5F- notAfter — if this date is in the past, the certificate is expired. Done. Renew it.
- notBefore — if this date is in the future, the certificate is not yet valid (clock skew on the server can cause this).
- issuer — note the issuer CN. You will need this to verify the chain.
BASH
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id </dev/null 2>/dev/null | openssl x509 -noout -checkend 2592000-checkend 2592000 flag checks whether the certificate expires within the next 2,592,000 seconds (30 days). Exit code 0 means it is still valid beyond that window; exit code 1 means it expires within 30 days or is already expired.
Step 2: Verify the full chain of trust
BASH
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id -showcerts </dev/null 2>/dev/null-----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----). Count them. Typically you should see at least two: the leaf and one or more intermediates. The root CA is usually not sent by the server because clients are expected to have it in their local trust store.
To verify the chain against your system's trust store:
BASH
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id -verify_return_error </dev/null 2>&1 | grep -E 'Verify return code|depth'Verify return code: 0 (ok). Anything else means the chain is broken. Common error codes:
- error 10 (certificate has expired) — one of the certificates in the chain is past its notAfter date.
- error 20 (unable to get local issuer certificate) — the root CA is not in your trust store, or an intermediate is missing from the chain the server sent.
- error 21 (unable to verify the first certificate) — the server sent only the leaf certificate with no intermediates.
BASH
openssl verify -CAfile /path/to/national-root-ca.pem -untrusted /path/to/intermediate-ca.pem /path/to/leaf-cert.pem-CAfile flag points to the trusted root. The -untrusted flag provides intermediates that need to be validated (not blindly trusted). This distinction matters.
Step 3: Check revocation status via OCSP
BASH
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id </dev/null 2>/dev/null | openssl x509 -noout -ocsp_urihttp://ocsp.national-pki.go.id. Then query it:
BASH
# Save the leaf and issuer certs first
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id -showcerts </dev/null 2>/dev/null > fullchain.pem
# Extract leaf cert (first PEM block) and issuer cert (second PEM block)
# Then query OCSP
openssl ocsp -issuer issuer.pem -cert leaf.pem -url http://ocsp.national-pki.go.id -resp_textleaf.pem: good. If it says revoked, the certificate has been explicitly revoked. If the OCSP responder is unreachable or returns an error, that is a problem in itself — it means revocation checking is not functioning, and clients doing soft-fail OCSP will accept potentially revoked certificates.
You can also check whether the server supports OCSP stapling (where the server fetches and caches the OCSP response, saving the client a round trip):
BASH
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id -status </dev/null 2>&1 | grep -A 5 'OCSP Response'OCSP Response Status: successful, stapling is working. If you see no OCSP response data at all, stapling is not configured on the server.
Step 4: Check the CRL as a fallback
BASH
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id </dev/null 2>/dev/null | openssl x509 -noout -text | grep -A 2 'CRL Distribution'BASH
wget -q http://crl.national-pki.go.id/intermediate-g2.crl -O intermediate.crl
openssl crl -in intermediate.crl -inform DER -noout -text | grep -i 'serial\\|last update\\|next update'What to do when verification fails
curl to reject certificates that browsers accept, because browsers cache intermediates and curl does not. For more on that specific behavior, see Why curl Rejects an SSL Certificate That Works in Your Browser.
Untrusted root CA — if the national PKI root CA is not in your system's default trust store, you need to add it manually. On most Linux distributions, this means placing the root CA PEM file in the appropriate directory and running update-ca-certificates (Debian/Ubuntu) or update-ca-trust (RHEL/CentOS). The exact path and command depend on the distribution.
OCSP responder unreachable — this is an infrastructure problem on the CA side. Document it, report it to the PKI operator, and in the meantime, verify revocation via CRL if available. Be aware that if both OCSP and CRL are unreachable, most TLS clients default to soft-fail (accept the certificate anyway), which is a security gap.
Make this a scheduled check, not a one-time thing
-checkend for upcoming expiry, a monitoring probe that hits the OCSP responder weekly, or a script that compares CRL "Next Update" against the current date.
For agencies participating in national data exchange under frameworks like Satu Data Indonesia, where the cryptographic infrastructure underpins data integrity and authenticity across the entire government, a silently expired certificate is not a cosmetic issue. It means the guarantee that data came from who it claims to come from, and was not modified in transit, is no longer being enforced. Verify the chain of trust now, and set up something that verifies it again next month.