Verify TLS certificates with openssl & security verify-cert on Mac
Cross-check SWG bar's SHA-256 certificate fingerprints and trust verdicts on macOS using openssl s_client, openssl x509, and macOS security verify-cert.
SWG bar · Updated
While SWG bar summarizes certificate trust, issuers, and SHA-256 fingerprints right from the menu bar, security engineers and network admins often want to cross-check a suspicious domain independently using standard macOS and OpenSSL command-line tools.
1. Record SWG bar’s probe evidence first
Before running raw CLI checks, inspect the target hostname in SWG bar → Domains (or via CLI):
swgbar probe example.com --json
swgbar domains detail example.com --json
swgbar certificates detail "<certificate-name>" --json
Note three values for comparison: the Issuer / Common name (CN), the SHA-256 fingerprints, and whether macOS trust differs from public CA validation (Confirmed or Suspected). See Inspect MITM root certificates in SWG bar.
2. Fetch the live TLS certificate chain with OpenSSL
Use openssl s_client to connect to port 443 with SNI (-servername) and inspect the certificate chain presented to your Terminal session:
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null
Save the first -----BEGIN CERTIFICATE----- block as leaf.pem and any intermediate block(s) as intermediate.pem, then inspect the leaf’s subject, issuer, validity dates, hostname match, and SHA-256 fingerprint:
openssl x509 -in leaf.pem -noout -subject -issuer -dates -fingerprint -sha256 -checkhost example.com
If the Issuer or SHA-256 Fingerprint differs from what you expect from the origin server (and matches the inspection root shown in SWG bar), the connection was terminated by an intermediary such as a corporate SWG.
3. Cross-check macOS Keychain trust with security verify-cert
Next, verify how macOS System Trust evaluates that saved chain using Apple’s built-in security verify-cert utility:
security verify-cert -c leaf.pem -c intermediate.pem -p ssl -s example.com
- When an MDM-installed SWG root CA is present in macOS Keychain,
security verify-certsucceeds—matching SWG bar’smacOS System Trustpass—even though an unprivileged public root store (or a CLI runtime’s bundled CA file) rejects the chain. - Note that these commands inspect a connection and saved PEM blocks only; they do not install trust roots or modify system proxy settings.
Account for differences between tools and browsers
If openssl s_client shows a different certificate from your browser, remember that applications may take different routes (for instance, explicit proxy settings, browser HTTP/3 vs. TCP, or tool-specific VPN exclusions), and SWG bar itself runs an independent IPv4 TCP probe rather than reading Chrome’s live socket. Always record the exact hostname, timestamp, network interface, and application tested—and review Confirmed vs. Suspected HTTPS inspection to interpret results consistently.