check_ssl_cert(1)

πŸŽ€ NAME πŸŽ€

Hii bestie πŸ’– welcome to check_ssl_cert(1), straight out of the USER COMMANDS section of the manual β€” she checks the validity of X.509 certificates and honestly? she ate, no cap.


✨ SYNOPSIS ✨

check_ssl_cert -H host [OPTIONS]
check_ssl_cert -f file [OPTIONS]

πŸ’– DESCRIPTION πŸ’–

check_ssl_cert is a shell script β€” and yes, she can absolutely be used as a Nagios/Icinga plugin 🫢 β€” that checks an SSL/TLS connection.


🌸 ARGUMENTS 🌸

  • -f, --file file β€” Local file path or URI. And like, with -f you're not limited to a plain x509 certificate file, okay? You can also pass her a certificate revocation list (CRL) to check the validity period, or a Java KeyStore file. versatile queen πŸ’…
  • -H, --host host β€” the server. that's it, that's the girl.

πŸ‘‘ OPTIONS πŸ‘‘

  • -A, --noauth β€” Ignore authority warnings (expiration only).
  • --all β€” Enable all the possible optional checks at the maximum level. the whole menu, periodt.
  • --all-local β€” Enable all the possible optional checks at the maximum level (without SSL-Labs). same energy, just not leaving the house.
  • --allow-empty-san β€” Allow certificates without Subject Alternative Names (SANs).
  • -C, --clientcert path β€” Use client certificate to authenticate.
  • -c, --critical days β€” Minimum number of days a certificate has to be valid to issue a critical status. Can be a floating point number, e.g., 0.5. Default: 15.
  • --check-chain β€” The certificate chain cannot contain double or root certificates.
  • --check-ciphers grade β€” Check the offered ciphers.
  • --check-ciphers-warnings β€” Critical if nmap reports a warning for an offered cipher.
  • --check-http-headers β€” Check the HTTP headers for best practices.
  • --check-ssl-labs-warn grade β€” SSL Labs grade on which to warn.
  • --clientpass phrase β€” Set passphrase for client certificate.
  • --configuration file β€” Read options from the specified file.
  • --crl β€” Check revocation via CRL (requires --rootcert-file).
  • --curl-bin path β€” Path of the curl binary to be used.
  • --custom-http-header string β€” Custom HTTP header sent when getting the cert. example: 'X-Check-Ssl-Cert: Foobar=1'
  • --dane β€” Verify that valid DANE records exist (since OpenSSL 1.1.0).
  • --dane 211 β€” Verify that a valid DANE-TA(2) SPKI(1) SHA2-256(1) TLSA record exists.
  • --dane 301 β€” Verify that a valid DANE-EE(3) Cert(0) SHA2-256(1) TLSA record exists.
  • --dane 302 β€” Verify that a valid DANE-EE(3) Cert(0) SHA2-512(2) TLSA record exists.
  • --dane 311 β€” Verify that a valid DANE-EE(3) SPKI(1) SHA2-256(1) TLSA record exists.
  • --dane 312 β€” Verify that a valid DANE-EE(3) SPKI(1) SHA2-512(1) TLSA record exists.
  • --date path β€” Path of the date binary to be used.
  • -d, --debug β€” Produce debugging output (can be specified more than once). stack her up, she loves it.
  • --debug-cert β€” Store the retrieved certificates in the current directory.
  • --debug-file file β€” Write the debug messages to file.
  • --debug-headers β€” Store the retrieved HTLM headers in the headers.txt file.
  • --debug-time β€” Write timing information in the debugging output.
  • --default-format β€” Print the default output format and exit.
  • --dig-bin path β€” Path of the dig binary to be used.
  • --do-not-resolve β€” Do not check if the host can be resolved.
  • --dtls β€” Use the DTLS protocol.
  • --dtls1 β€” Use the DTLS protocol 1.0.
  • --dtls1_2 β€” Use the DTLS protocol 1.2.
  • -e, --email address β€” Pattern (extended regular expression) to match the email address contained in the certificate. You can specify different addresses separated by a pipe (e.g., 'addr1|addr2').
  • --ecdsa β€” Signature algorithm selection: force ECDSA certificate.
  • --element number β€” Check up to the N cert element from the beginning of the chain.
  • --file-bin path β€” Path of the file binary to be used.
  • --fingerprint hash β€” Pattern to match the fingerprint.
  • --fingerprint-alg algorithm β€” Algorithm for fingerprint. Default sha1.
  • --first-element-only β€” Verify just the first cert element, not the whole chain.
  • --force-dconv-date β€” Force the usage of dconv for date computations.
  • --force-perl-date β€” Force the usage of Perl for date computations.
  • --format FORMAT β€” Format output template on success, for example: '%SHORTNAME% OK %CN% from %CA_ISSUER_MATCHED%'

List of possible variables:

  • %CA_ISSUER_MATCHED%
  • %CHECKEDNAMES%
  • %CN%
  • %DATE%
  • %DAYS_VALID%
  • %DYSPLAY_CN%
  • %HOST%
  • %OCSP_EXPIRES_IN_HOURS%
  • %OPENSSL_COMMAND%
  • %PORT%
  • %SELFSIGNEDCERT%
  • %SHORTNAME%
  • %SIGALGO%
  • %SSL_LABS_HOST_GRADE%

See --default-format for the default.

  • --grep-bin path β€” Path of the grep binary to be used.
  • -h, --help, -? β€” This help message.
  • --http-headers-path path β€” The path to be used to fetch HTTP headers.
  • --http-use-get β€” Use GET instead of HEAD (default) for the HTTP related checks.
  • -i, --issuer issuer β€” Pattern (extended regular expression) to match the issuer of the certificate. You can specify different issuers separated by a pipe (e.g., 'issuer1|issuer2').
  • --ignore-altnames β€” Ignore alternative names when matching pattern specified in -n (or the host name).
  • --ignore-connection-problems [state] β€” In case of connection problems returns OK or the optional state.
  • --ignore-crl β€” Ignore CRLs.
  • --ignore-dh β€” Ignore too small DH keys.
  • --ignore-exp β€” Ignore expiration date.
  • --ignore-http-headers β€” Ignore checks on HTTP headers with --all and --all-local.
  • --ignore-host-cn β€” Do not complain if the CN does not match the host name.
  • --ignore-incomplete-chain β€” Do not check chain integrity.
  • --ignore-maximum-validity β€” Ignore the certificate maximum validity.
  • --ignore-ocsp β€” Do not check revocation with OCSP.
  • --ignore-ocsp-errors β€” Continue if the OCSP status cannot be checked.
  • --ignore-ocsp-timeout β€” Ignore OCSP result when timeout occurs while checking.
  • --ignore-sct β€” Do not check for signed certificate timestamps (SCT).
  • --ignore-sig-alg β€” Do not check if the certificate was signed with SHA1 or MD5.
  • --ignore-ssl-labs-cache β€” Force a new check by SSL Labs (see -L).
  • --ignore-ssl-labs-errors β€” Ignore errors if SSL Labs is not accessible or times out.
  • --ignore-tls-renegotiation β€” Ignore the TLS renegotiation check.
  • --ignore-unexpected-eof β€” Ignore unclean TLS shutdowns.
  • --inetproto protocol β€” Force IP version 4 or 6.
  • --info β€” Print certificate information.
  • --init-host-cache β€” Initialize the host cache.
  • --issuer-cert-cache dir β€” Directory where to store issuer certificates cache.
  • --jks-alias alias β€” Alias name of the Java KeyStore entry (requires --file).
  • -K, --clientkey path β€” Use client certificate key to authenticate.
  • -L, --check-ssl-labs grade β€” SSL Labs assessment (please check https://www.ssllabs.com/about/terms.html). Critical if the grade is lower than specified.
  • --long-output list β€” Append the specified comma separated (no spaces) list of attributes to the plugin output on additional lines. Valid attributes are: enddate, startdate, subject, issuer, modulus, serial, hash, email, ocsp_uri and fingerprint. 'all' will include all the available attributes.
  • -m, --match name β€” Pattern to match the CN or AltName (can be specified multiple times).
  • --maximum-validity [days] β€” The maximum validity of the certificate must not exceed days (default 397). This check is automatic for HTTPS.
  • --nmap-bin path β€” Path of the nmap binary to be used.
  • --nmap-with-proxy β€” Allow nmap to be used with a proxy.
  • --no-perf β€” Do not show performance data.
  • --no-proxy β€” Ignore the http_proxy and https_proxy environment variables.
  • --no-proxy-curl β€” Ignore the http_proxy and https_proxy environment variables for curl.
  • --no-proxy-s_client β€” Ignore the http_proxy and https_proxy environment variables for openssl s_client.
  • --no-ssl2 β€” Disable SSL version 2.
  • --no-ssl3 β€” Disable SSL version 3.
  • --no-tls1 β€” Disable TLS version 1.
  • --no-tls1_1 β€” Disable TLS version 1.1.
  • --no-tls1_3 β€” Disable TLS version 1.3.
  • --no-tls1_2 β€” Disable TLS version 1.2.
  • --not-issued-by issuer β€” Check that the issuer of the certificate does not match the given pattern.
  • --not-valid-longer-than days β€” Critical if the certificate validity is longer than the specified period.
  • -o, --org org β€” Pattern to match the organization of the certificate.
  • --ocsp-critical hours β€” Minimum number of hours an OCSP response has to be valid to issue a critical status.
  • --ocsp-warning hours β€” Minimum number of hours an OCSP response has to be valid to issue a warning status.
  • --openssl path β€” Path of the openssl binary to be used.
  • -p, --port port β€” TCP port (default 443).
  • --precision digits β€” Number of decimal places for durations: defaults to 0 if critical or warning are integers, 2 otherwise.
  • -P, --protocol protocol β€” Use the specific protocol: dns, ftp, ftps, http, https (default), h2 (HTTP/2), h3 (HTTP/3), imap, imaps, irc, ircs, ldap, ldaps, mqtts, mysql, pop3, pop3s, postgres, sieve, sips, smtp, smtps, tds, xmpp, xmpp-server. ftp, imap, irc, ldap, pop3, postgres, sieve, smtp: switch to TLS using StartTLS. These protocols switch to TLS using StartTLS: ftp, imap, irc, ldap, mysql, pop3, smtp.
  • --path path β€” Set the PATH variable to path.
  • --password source β€” Password source for a local certificate, see the PASS PHRASE ARGUMENTS section openssl(1).
  • --prometheus β€” Generate Prometheus/OpenMetrics output.
  • --proxy proxy β€” Set http_proxy and the s_client -proxy option.
  • --python-bin path β€” Path of the python binary to be used.
  • --quic β€” Use QUIC.
  • -q, --quiet β€” shhh 🀫 bestie, this one produces zero output. Not a single peep. Like, absolutely no vibe check feedback. πŸ’…
  • -r, --rootcert cert β€” the root cert or directory used for validating certs. It gets passed straight to openssl's -CAfile or -CApath. So like, the trust anchor, you know? πŸ”’
  • --require-client-cert [list] β€” the server must accept a client cert. The optional list is a comma-separated list of expected client cert CAs. Like, "prove you belong here" energy. πŸͺͺ
  • --require-dnssec β€” require DNSSEC. No DNSSEC, no peace. ✨
  • --require-http-header header β€” require the specified HTTP header (for example, strict-transport-security). Like, if it's not there, we're gonna have a problem. 😀
  • --require-no-http-header header β€” require the absence of the specified HTTP header (for example, X-Powered-By). So like, if it shows up, that's a no from me. πŸ™…β€β™€οΈ
  • --require-no-ssl2 β€” critical if SSL version 2 is offered. Ancient vibes, not in a good way. πŸ’€
  • --require-no-ssl3 β€” critical if SSL version 3 is offered. Also ancient, also not it. 🚫
  • --require-no-tls1 β€” critical if TLS 1 is offered. Old news, bestie. πŸ“‰
  • --require-no-tls1_1 β€” critical if TLS 1.1 is offered. Like, why is this still here? 😭
  • --require-no-tls1_2 β€” critical if TLS 1.2 is offered. Okay this one is still kinda common but if you require it off, we'll flag it. πŸ”₯
  • --require-ocsp-stapling β€” require OCSP stapling. It's giving "I need that fresh revocation status". 🌿
  • --require-purpose usage β€” require the specified key usage. Can be specified more than once. Like, stack 'em up. πŸ“š
  • --require-purpose-critical β€” the key usage must be critical. Periodt. πŸ’…
  • --require-security-header header β€” require the specified HTTP security header (for example, X-Frame-Options). Security check, bestie. πŸ›‘οΈ
  • --require-security-headers β€” require all the HTTP security headers. The whole squad:
    • Content-Security-Policy
    • Permissions-Policy
    • Referrer-Policy
    • strict-transport-security
    • X-Content-Type-Options
    • X-Frame-Options Like, if any are missing, it's a whole thing. πŸ‘‘
  • --resolve ip β€” provide a custom IP address for the specified host. Like, "I know you said this host, but actually go here." πŸ“
  • --resolve-over-http [server] β€” resolve the host over HTTP using Google or the specified server. So like, DNS over HTTP? Google it. 🌐
  • --rootcert-dir dir β€” root directory used for cert validation (passed to openssl's -CApath). This overrides option -r, --rootcert. So it wins. πŸ†
  • --rootcert-file cert β€” root cert used for cert validation (passed to openssl's -CAfile). Also overrides option -r, --rootcert. Same energy. πŸ“
  • --rsa β€” signature algorithm selection: force RSA certificate. Like, "I only want RSA, thanks." πŸ”‘
  • --security-level number β€” set the security level to the specified value. See SSL_CTX_set_security_level(3) for what each level means. Higher number, higher standards. πŸ’―
  • -s, --selfsigned β€” allow self-signed certificates. Sometimes you gotta trust yourself. πŸͺž
  • --serial serialnum β€” pattern to match the serial number. Like a fingerprint, but for certs. πŸ”
  • --skip-element number β€” skip checks on the Nth cert element. Can be specified multiple times. So like, "ignore that one, and that one too." πŸ™ˆ
  • --sni name β€” set the TLS SNI (Server Name Indication) extension in the ClientHello message to name. It's giving "hey server, I'm looking for this name". πŸ“›
  • --ssl2 β€” force SSL version 2. Danger, bestie. This is ancient and broken. πŸ’€
  • --ssl3 β€” force SSL version 3. Also ancient and broken. Please don't. 🚫
  • -t, --timeout seconds β€” timeout after the specified time (defaults to 120 seconds). Like, "I'm not waiting forever." ⏰
  • --temp dir β€” directory where to store the temporary files. Gotta put the temp stuff somewhere. πŸ“‚
  • --terse β€” terse output. Also see --verbose. Short and sweet, no fluff. βœ‚οΈ
  • --tls1 β€” force TLS version 1. Old. πŸ¦–
  • --tls1_1 β€” force TLS version 1.1. Also old. πŸ¦•
  • --tls1_2 β€” force TLS version 1.2. Still hanging on. πŸ§“
  • --tls1_3 β€” force TLS version 1.3. Fresh and modern. ✨
  • -u, --url URL β€” HTTP request URL. Like, where we're sending the request. πŸ”—
  • --user-agent string β€” user agent that shall be used for HTTPS connections. Like, "I'm a browser, trust me." πŸ•΅οΈβ€β™€οΈ
  • -v, --verbose β€” verbose output. Can be specified more than once. So like, -v -v -v for maximum yapping. πŸ—£οΈ
  • -V, --version β€” version. Just tells you what version this is. πŸ“Œ
  • -w, --warning days β€” minimum number of days a certificate has to be valid to issue a warning status. Might be a floating point number, e.g., 0.5. Default: 20. So if it expires in less than this, warning. ⚠️
  • --xmpphost name β€” specify the host for the 'to' attribute of the stream element. XMPP vibes. πŸ’¬
  • -4 β€” force IPv4. Old school IP. πŸ“ž
  • -6 β€” force IPv6. New school IP. πŸ“±

πŸ’€ DEPRECATED OPTIONS πŸ’€

These are still here, but like, they're deprecated. Use the new ones, bestie. πŸ‘΅

  • --altnames β€” match the pattern specified in -n with alternate names too (enabled by default). So it's already on, but you can say it again. πŸ€·β€β™€οΈ
  • -n, --cn name β€” pattern to match the CN or AltName. Can be specified multiple times. Like, "I'm looking for this name, or this one." 🏷️
  • --curl-user-agent string β€” user agent that curl shall use to obtain the issuer cert. So curl gets its own disguise. 🎭
  • -d, --days days β€” minimum number of days a certificate has to be valid (see --critical and --warning). Like --warning but also for critical? Anyway, deprecated. πŸ“…
  • -N, --host-cn β€” match CN with the host name (enabled by default). Already on. βœ…
  • --no_ssl2 β€” disable SSLv2 (deprecated, use --no-ssl2). Note the underscore, bestie. 🚫
  • --no_ssl3 β€” disable SSLv3 (deprecated, use --no-ssl3). Underscore again. 🚫
  • --no_tls1 β€” disable TLSv1 (deprecated, use --no-tls1). Underscore. 🚫
  • --no_tls1_1 β€” disable TLSv1.1 (deprecated, use --no-tls1_1). Underscore. 🚫
  • --no_tls1_2 β€” disable TLSv1.1 (deprecated, use --no-tls1_2). Yes, it says 1.1, we're just the messenger πŸ’€
  • --no_tls1_3 β€” disable TLSv1.1 (deprecated, use --no-tls1_3). Same energy. πŸ’€
  • --ocsp β€” check revocation via OCSP (enabled by default). Already on. βœ…
  • --require-hsts β€” require HTTP Strict Transport Security (deprecated, use --require-security-header strict-transport-security). Old way. πŸ—οΈ
  • --require-security-headers-path path β€” the path to be used to fetch HTTP security headers. Like, where to look for them. πŸ›£οΈ
  • --require-san β€” require the presence of a Subject Alternative Name extension. Like, "I need to see your SANs." πŸ“‡
  • --require-x-frame-options [path] β€” require the presence of the X-Frame-Options HTTP header. path is the optional path to be used in the URL to check for the header (deprecated, use --require-security-header X-Frame-Options and --require-security-headers-path path). So like, check for this header at this path. πŸ–ΌοΈ
  • -S, --ssl version β€” force SSL version (2,3) (see: --ssl2 or --ssl3). Old way to pick SSL version. πŸ•°οΈ

βš™οΈ CONFIGURATION βš™οΈ

You can put command line options in a config file at ${HOME}/.check_ssl_certrc. For example:

$ cat ${HOME}/.check_ssl_certrc
--verbose
--critical 20
--warning 40

Options in the config file are read before processing the arguments, and they can be overridden. So like, defaults, but you can still change your mind. πŸ’…


πŸ“ NOTES πŸ“

If the host has multiple certificates and the installed openssl version supports the -servername option, you can specify the TLS SNI (Server Name Identificator) with the -N (or --host-cn) option. So like, pick which cert you want. 🎯


🚦 EXIT STATUS 🚦

check_ssl_cert returns:

  • 0 if it finds no errors,
  • 1 for warnings,
  • 2 for critical errors,
  • 3 for unknown problems.

So like, zero is good, higher is bad. Got it. πŸ’―


πŸ› BUGS πŸ›

Please report bugs to: https://github.com/matteocorti/check_ssl_cert/issues

Like, if you find a bug, tell the devs. They wanna know. 🫢


🌟 EXAMPLE 🌟

check_ssl_cert --host github.com --all-local

That's it. That's the example. ✨


πŸ”— SEE ALSO πŸ”—

openssl(1), openssl-x509(1)

Go read those if you want more. πŸ“š


This page is from version 2.92.0, dated April 2025, and it's the manual for check_ssl_cert(1). Stay secure, bestie! πŸ’–