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,--filefile β Local file path or URI. And like, with-fyou'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,--hosthost β 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,--clientcertpath β Use client certificate to authenticate.-c,--criticaldays β 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-ciphersgrade β Check the offered ciphers.--check-ciphers-warningsβ Critical ifnmapreports a warning for an offered cipher.--check-http-headersβ Check the HTTP headers for best practices.--check-ssl-labs-warngrade β SSL Labs grade on which to warn.--clientpassphrase β Set passphrase for client certificate.--configurationfile β Read options from the specified file.--crlβ Check revocation via CRL (requires--rootcert-file).--curl-binpath β Path of thecurlbinary to be used.--custom-http-headerstring β 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.--datepath β Path of thedatebinary 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-filefile β Write the debug messages to file.--debug-headersβ Store the retrieved HTLM headers in theheaders.txtfile.--debug-timeβ Write timing information in the debugging output.--default-formatβ Print the default output format and exit.--dig-binpath β Path of thedigbinary 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,--emailaddress β 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.--elementnumber β Check up to the N cert element from the beginning of the chain.--file-binpath β Path of thefilebinary to be used.--fingerprinthash β Pattern to match the fingerprint.--fingerprint-algalgorithm β Algorithm for fingerprint. Defaultsha1.--first-element-onlyβ Verify just the first cert element, not the whole chain.--force-dconv-dateβ Force the usage ofdconvfor date computations.--force-perl-dateβ Force the usage of Perl for date computations.--formatFORMAT β 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-binpath β Path of thegrepbinary to be used.-h,--help,-?β This help message.--http-headers-pathpath β The path to be used to fetch HTTP headers.--http-use-getβ Use GET instead of HEAD (default) for the HTTP related checks.-i,--issuerissuer β 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--alland--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.--inetprotoprotocol β Force IP version 4 or 6.--infoβ Print certificate information.--init-host-cacheβ Initialize the host cache.--issuer-cert-cachedir β Directory where to store issuer certificates cache.--jks-aliasalias β Alias name of the Java KeyStore entry (requires--file).-K,--clientkeypath β Use client certificate key to authenticate.-L,--check-ssl-labsgrade β SSL Labs assessment (please checkhttps://www.ssllabs.com/about/terms.html). Critical if the grade is lower than specified.--long-outputlist β 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_uriandfingerprint.'all'will include all the available attributes.-m,--matchname β 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 (default397). This check is automatic for HTTPS.--nmap-binpath β Path of thenmapbinary to be used.--nmap-with-proxyβ Allownmapto be used with a proxy.--no-perfβ Do not show performance data.--no-proxyβ Ignore thehttp_proxyandhttps_proxyenvironment variables.--no-proxy-curlβ Ignore thehttp_proxyandhttps_proxyenvironment variables forcurl.--no-proxy-s_clientβ Ignore thehttp_proxyandhttps_proxyenvironment variables foropenssl 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-byissuer β Check that the issuer of the certificate does not match the given pattern.--not-valid-longer-thandays β Critical if the certificate validity is longer than the specified period.-o,--orgorg β Pattern to match the organization of the certificate.--ocsp-criticalhours β Minimum number of hours an OCSP response has to be valid to issue a critical status.--ocsp-warninghours β Minimum number of hours an OCSP response has to be valid to issue a warning status.--opensslpath β Path of theopensslbinary to be used.-p,--portport β TCP port (default443).--precisiondigits β Number of decimal places for durations: defaults to0if critical or warning are integers,2otherwise.-P,--protocolprotocol β 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.--pathpath β Set thePATHvariable to path.--passwordsource β Password source for a local certificate, see the PASS PHRASE ARGUMENTS sectionopenssl(1).--prometheusβ Generate Prometheus/OpenMetrics output.--proxyproxy β Sethttp_proxyand thes_client -proxyoption.--python-binpath β Path of thepythonbinary 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,--rootcertcert β the root cert or directory used for validating certs. It gets passed straight to openssl's-CAfileor-CApath. So like, the trust anchor, you know? π--require-client-cert[list] β the server must accept a client cert. The optionallistis 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-headerheader β 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-headerheader β 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-purposeusage β 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-headerheader β 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-PolicyPermissions-PolicyReferrer-Policystrict-transport-securityX-Content-Type-OptionsX-Frame-OptionsLike, if any are missing, it's a whole thing. π
--resolveip β 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-dirdir β root directory used for cert validation (passed to openssl's-CApath). This overrides option-r,--rootcert. So it wins. π--rootcert-filecert β 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-levelnumber β set the security level to the specified value. SeeSSL_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. πͺ--serialserialnum β pattern to match the serial number. Like a fingerprint, but for certs. π--skip-elementnumber β skip checks on the Nth cert element. Can be specified multiple times. So like, "ignore that one, and that one too." π--sniname β set the TLS SNI (Server Name Indication) extension in the ClientHello message toname. 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,--timeoutseconds β timeout after the specified time (defaults to 120 seconds). Like, "I'm not waiting forever." β°--tempdir β 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,--urlURL β HTTP request URL. Like, where we're sending the request. π--user-agentstring β 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 -vfor maximum yapping. π£οΈ-V,--versionβ version. Just tells you what version this is. π-w,--warningdays β 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. β οΈ--xmpphostname β 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-nwith alternate names too (enabled by default). So it's already on, but you can say it again. π€·ββοΈ-n,--cnname β pattern to match the CN or AltName. Can be specified multiple times. Like, "I'm looking for this name, or this one." π·οΈ--curl-user-agentstring β user agent that curl shall use to obtain the issuer cert. So curl gets its own disguise. π-d,--daysdays β minimum number of days a certificate has to be valid (see--criticaland--warning). Like--warningbut 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-pathpath β 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 theX-Frame-OptionsHTTP header.pathis the optional path to be used in the URL to check for the header (deprecated, use--require-security-header X-Frame-Optionsand--require-security-headers-pathpath). So like, check for this header at this path. πΌοΈ-S,--sslversion β force SSL version (2,3) (see:--ssl2or--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:
0if it finds no errors,1for warnings,2for critical errors,3for 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 π
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! π
π¦ where this page comes from
- debian trixie: monitoring-plugins-contrib 48.20250420
- ubuntu questing: monitoring-plugins-contrib 48.20250420ubuntu2
- ubuntu resolute: monitoring-plugins-contrib 48.20250420ubuntu3
- ubuntu stonking: monitoring-plugins-contrib 48.20250420ubuntu3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms