Get information about the certificate from one or more hostnames.
Usage:
certinfo HOSTNAME [HOSTNAME ...] [flags]
Flags:
--timeout TIMEOUT Dial timeout (Default: 5s)
--retry RETRY Retry attempts for TCP connect (Default: 2)
--output <text|json|none> Output format: (Default: text)
--threshold THRESHOLD Warn if cert expires within this duration (e.g. 720h) (Default: 0s)
--proxy PROXY Proxy URL (http[s]:// or socks5[h]://). Overrides env. [Group: proxy-choice (One Of)]
--no-proxy Bypass all proxies. Overrides --proxy and env. [Group: proxy-choice (One Of)]
-s, --silent Suppress normal output; only print expiration warnings
-h, --help Show help
--version Show version
certinfo google.io
output:
Host: google.io:443
Certs:
Issuer: GTS CA 1C3 (Google Trust Services LLC)
Subject: *.google.io
Not Before: Monday, 12 July 2021 at 07:24:53 (CEST)
Not After: Monday, 4 October 2021 at 07:24:52 (CEST)
DNS names: *.google.io google.io
certinfo --output json --verbose google.io
output:
2018/11/04 19:19:15 connecting to google.io:443
[
{
"Host": "google.io",
"Port": 443,
"Certs": [
{
// snip many fields!
}
]
}
]
certinfo --output none --threshold 30 google.io
output:
there is no output if the certificate expires more than 30 days
certinfo --output none --threshold 20 google.io
output:
Problem running certinfo: certificate for *.google.io expires in 60.10 days (at 2021-09-14T17:47:02Z)
certinfo --output json example.io | jq -r '.[].Certs[].NotBefore'
output:
2021-06-22T17:47:03Z
0 2 * * * root result=$(certinfo google.io); curl -fsS -X POST --data-raw "$result" "https://healthchecks.example.com/ping/<UID>$([ $? != 0 ] && echo -n /fail)" > /dev/null
inspired by certinfo