certinspect 2.3.3__tar.gz → 2.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {certinspect-2.3.3/src/certinspect.egg-info → certinspect-2.4.1}/PKG-INFO +98 -50
  2. {certinspect-2.3.3 → certinspect-2.4.1}/README.md +97 -49
  3. {certinspect-2.3.3 → certinspect-2.4.1}/pyproject.toml +1 -1
  4. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/__init__.py +1 -1
  5. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/args.py +11 -5
  6. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/cli.py +46 -36
  7. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/exit_codes.py +26 -0
  8. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/fetch.py +40 -8
  9. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/formatter.py +28 -12
  10. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/httpfetch.py +33 -6
  11. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/models.py +2 -1
  12. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/parser.py +40 -12
  13. certinspect-2.4.1/src/certinspect/revocation.py +445 -0
  14. {certinspect-2.3.3 → certinspect-2.4.1/src/certinspect.egg-info}/PKG-INFO +98 -50
  15. {certinspect-2.3.3 → certinspect-2.4.1}/tests/test_cli.py +282 -4
  16. {certinspect-2.3.3 → certinspect-2.4.1}/tests/test_fetch.py +602 -1
  17. {certinspect-2.3.3 → certinspect-2.4.1}/tests/test_formatter.py +87 -0
  18. {certinspect-2.3.3 → certinspect-2.4.1}/tests/test_parser.py +33 -0
  19. certinspect-2.3.3/src/certinspect/revocation.py +0 -257
  20. {certinspect-2.3.3 → certinspect-2.4.1}/LICENSE +0 -0
  21. {certinspect-2.3.3 → certinspect-2.4.1}/setup.cfg +0 -0
  22. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/completion.py +0 -0
  23. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/config.py +0 -0
  24. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/discover.py +0 -0
  25. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect/render.py +0 -0
  26. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect.egg-info/SOURCES.txt +0 -0
  27. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect.egg-info/dependency_links.txt +0 -0
  28. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect.egg-info/entry_points.txt +0 -0
  29. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect.egg-info/requires.txt +0 -0
  30. {certinspect-2.3.3 → certinspect-2.4.1}/src/certinspect.egg-info/top_level.txt +0 -0
  31. {certinspect-2.3.3 → certinspect-2.4.1}/tests/test_discover.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: certinspect
3
- Version: 2.3.3
3
+ Version: 2.4.1
4
4
  Summary: Command-line TLS certificate inspector
5
5
  Author-email: Michele Angrisano <michele.angrisano@gmail.com>
6
6
  License-Expression: MIT
@@ -61,7 +61,7 @@ Subject: CN=example.com
61
61
  Status: VALID
62
62
  Days to expiry: 64
63
63
  Signature: ecdsa-with-SHA256
64
- Key size: 256 bit
64
+ Key size: 256 bit (EC)
65
65
  TLS version: TLSv1.3
66
66
  Cipher: TLS_AES_256_GCM_SHA384
67
67
  Hostname match: True
@@ -161,7 +161,7 @@ $ echo $? # 0 = healthy, 3 = expiring, 4 = expired, 6 = revoked, ...
161
161
  | Triage helpers | Only certs expiring within N days (`--max-days`), sort by host or soonest expiry (`--sort`), one-line tally (`--summary`), tighter CRITICAL threshold (`--critical-days`) |
162
162
  | Protocols | Direct TLS plus STARTTLS — SMTP, IMAP, POP3, FTP (`--starttls`) |
163
163
  | Connectivity | Mutual-TLS client certificates (`--client-cert`/`--client-key`) and HTTP CONNECT proxy tunnelling — explicit (`--proxy`) or from the environment (`HTTPS_PROXY`/`NO_PROXY`, like curl; `--no-proxy` to opt out) — for hosts behind a corporate/cloud egress proxy |
164
- | Automation | Meaningful exit codes for cron/CI (or force success with `--exit-zero`), no telemetry, single runtime dependency, defaults from a `--config` file, low-noise recurring runs with `--state-file`/`--only-changed`, shell completion (`--print-completion`) |
164
+ | Automation | Meaningful exit codes for cron/CI (or force success with `--exit-zero`), no telemetry, single runtime dependency, defaults from a `--config` file, low-noise recurring runs with `--state-file`/`--only-changed`, shell completion (`--print-completion`) |
165
165
 
166
166
  ## Requirements
167
167
 
@@ -318,7 +318,7 @@ Total validity: 396 days
318
318
 
319
319
  Serial number: 1587345912129534630556007389588586994
320
320
  Signature: sha256WithRSAEncryption
321
- Key size: 2048 bit
321
+ Key size: 2048 bit (RSA)
322
322
  Fingerprint: 15:58:1C:41:02:3F:07:89:85:31:4E:7D:4C:4F:8A:CA:BF:05:C7:F6:...
323
323
  CA: False
324
324
  Self-Signed: False
@@ -488,11 +488,11 @@ certinspect internal.example.lan --verify --cafile ./internal-ca.pem
488
488
 
489
489
  ### Catch a revoked certificate
490
490
 
491
- `--verify` queries OCSP and falls back to the CRL; a revoked leaf fails with
492
- exit `6`:
491
+ Verification is on by default: it queries OCSP and falls back to the CRL, and a
492
+ revoked leaf fails with exit `6`:
493
493
 
494
494
  ```bash
495
- certinspect revoked.example.com --verify
495
+ certinspect revoked.example.com
496
496
  ```
497
497
 
498
498
  ### Spot an expired intermediate before it breaks the chain
@@ -614,8 +614,8 @@ certinspect example.com --export ./example.com.pem
614
614
  | Option | Description |
615
615
  | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
616
616
  | `target...` | One or more domains, URLs or `host:port` to inspect. Omit when using `--file`. |
617
- | `--config PATH` | Load default option values from a TOML file (keys use the argparse destination name); an explicit flag always overrides it. Auto-discovered at `~/.config/certinspect/config.toml` when omitted. |
618
- | `--file PATH` | Inspect a local certificate (PEM or DER) instead of a host. Use `-` to read from standard input. Repeatable to inspect several files in one run; cannot be combined with host targets. |
617
+ | `--config PATH` | Load default option values from a TOML file (keys use the argparse destination name); an explicit flag always overrides it. Auto-discovered at `~/.config/certinspect/config.toml` when omitted. |
618
+ | `--file PATH` | Inspect a local certificate (PEM or DER) instead of a host. Use `-` to read from standard input. Repeatable to inspect several files in one run; cannot be combined with host targets. |
619
619
  | `--port N` | TCP port to connect to (default: 443). |
620
620
  | `--timeout N` | Connection timeout in seconds (default: 5). Used for both connect and read unless the two below are set. |
621
621
  | `--connect-timeout N` | TCP connect timeout in seconds (default: `--timeout`). |
@@ -640,7 +640,7 @@ certinspect example.com --export ./example.com.pem
640
640
  | `--expect-san NAME` | Assert the certificate's SAN covers `NAME` (wildcards honored); exit 8 if missing. Repeatable; works for host and `--file` targets. |
641
641
  | `--not-after-max N` | Fail (exit 9) when the total validity exceeds N days (use 398 for the CA/Browser Forum maximum). Opt-in; works for host and `--file` targets. |
642
642
  | `--cab-forum` | Fail (exit 9) when the total validity exceeds the CA/Browser Forum maximum in effect today (398 days now, then 200, 100 and 47 on 2026/2027/2029-03-15). Date-aware shorthand for `--not-after-max`; mutually exclusive with it. |
643
- | `--min-key-size N` | Fail (exit 9) when the public key is smaller than N bits (e.g. 2048 for RSA). Opt-in. |
643
+ | `--min-key-size N` | Fail (exit 9) when an RSA/DSA public key is smaller than N bits (e.g. 2048). EC/EdDSA keys are not size-checked. Opt-in. |
644
644
  | `--fail-weak` | Turn the weak-crypto warnings (small key, SHA-1/MD5 signature) into a hard failure (exit 9) instead of a mere warning. |
645
645
  | `--require-sct` | Fail (exit 9) when the certificate embeds no Signed Certificate Timestamps (Certificate Transparency). Checks embedded SCTs only, not those from the TLS handshake or OCSP. Opt-in. |
646
646
  | `--require-must-staple` | Fail (exit 9) when the certificate lacks the OCSP Must-Staple extension (RFC 7633 TLS Feature `status_request`). Opt-in. |
@@ -648,7 +648,7 @@ certinspect example.com --export ./example.com.pem
648
648
  | `--min-tls-version VER` | Fail (exit 9) when the connection negotiates a TLS version older than `VER` (`TLSv1`, `TLSv1.1`, `TLSv1.2`, `TLSv1.3`). Host targets only; opt-in. |
649
649
  | `--profile {lenient,standard,strict}` | Apply a named bundle of the opt-in policy checks in one go (exit 9 on violation). Intensity ladder, not an official standard; explicit flags override it. See [Policy profiles](#policy-profiles). |
650
650
  | `--input PATH` | Read extra targets from a file, one per line ('-' for stdin). |
651
- | `--discover DOMAIN` | Discover hostnames from Certificate Transparency logs (crt.sh) for DOMAIN and inspect each one, surfacing forgotten or shadow certificates. Repeatable (queried concurrently per `--concurrency`); host targets only. |
651
+ | `--discover DOMAIN` | Discover hostnames from Certificate Transparency logs (crt.sh) for DOMAIN and inspect each one, surfacing forgotten or shadow certificates. Repeatable (queried concurrently per `--concurrency`); host targets only. |
652
652
  | `--discover-only` | With `--discover`, list the CT inventory (expiry, issuer, hostnames, soonest expiry first, wildcards included) for the domain(s) without connecting, then exit. Good for a fast audit or spotting a certificate from an unexpected CA. Supports `--json`/`--csv`. |
653
653
  | `--expect-issuer SUBSTRING` | With `--discover-only`, flag any certificate whose issuer matches none of these substrings (case-insensitive) and exit 9 — a Certificate Transparency mis-issuance check. Repeatable. |
654
654
  | `--discover-timeout N` | Timeout in seconds for the `--discover` crt.sh query (default: 30), separate from `--timeout` since a log search can be slower than a handshake. |
@@ -659,13 +659,13 @@ certinspect example.com --export ./example.com.pem
659
659
  | `--summary` | Print a one-line tally (valid/expiring/expired/errors) to stderr; counts every target before filtering. |
660
660
  | `--field NAME` | Print only the given field(s), one tab-separated line per target (repeatable; `target` for the host). For scripting without a JSON tool. |
661
661
  | `--exit-zero` | Always exit 0, even on problems or fetch errors. Report-only mode for dashboards/CI that read the output, not the exit code. |
662
- | `--export PATH` | Save the inspected certificate as a PEM file at PATH. |
662
+ | `--export PATH` | Save the inspected certificate as a PEM file at PATH. Single target only. |
663
663
  | `--starttls {smtp,imap,pop3,ftp}` | Upgrade a plaintext connection to TLS before inspecting (standard port unless `--port` is given). |
664
664
  | `--exporter {nagios,prometheus}` | Emit machine-readable monitoring output (ignores `--quiet`). |
665
665
  | `--concurrency N` | Inspect up to N hosts in parallel in batch mode (default: 1; order is preserved). Also governs `--discover`'s per-domain concurrency. |
666
- | `--state-file PATH` | Persist each host target's status across runs at PATH (JSON) and compare against the previous run. Host targets only. |
667
- | `--only-changed` | Show only targets whose status differs from the previous `--state-file` run (a first-seen target counts as changed). Requires `--state-file`; display only. |
668
- | `--print-completion {bash,zsh}` | Print a shell completion script for bash or zsh to stdout, then exit. Generated from the parser, so it always matches the installed flags. |
666
+ | `--state-file PATH` | Persist each host target's status across runs at PATH (JSON) and compare against the previous run. Host targets only. |
667
+ | `--only-changed` | Show only targets whose status differs from the previous `--state-file` run (a first-seen target counts as changed). Requires `--state-file`; display only. |
668
+ | `--print-completion {bash,zsh}` | Print a shell completion script for bash or zsh to stdout, then exit. Generated from the parser, so it always matches the installed flags. |
669
669
  | `--version` | Print the version and exit. |
670
670
 
671
671
  ## Options in action
@@ -689,7 +689,7 @@ Total validity: 90 days
689
689
 
690
690
  Serial number: 35428337808578903465180920265426569102
691
691
  Signature: ecdsa-with-SHA256
692
- Key size: 256 bit
692
+ Key size: 256 bit (EC)
693
693
  Fingerprint: BE:AB:14:CF:39:67:8F:DA:0E:F1:60:6E:ED:B8:18:C2:...
694
694
  CA: False
695
695
  Self-Signed: False
@@ -707,6 +707,10 @@ SAN:
707
707
  ```
708
708
 
709
709
  Passing several hosts prints one `=== host ===` block per target (batch mode).
710
+ A target on a non-default port is labelled `host:port` (e.g.
711
+ `=== example.com:8443 ===`) there and in every other output, the
712
+ `--state-file` and the Prometheus `target` label, so several services on the
713
+ same host stay apart.
710
714
 
711
715
  ### `--file PATH` — inspect a local certificate
712
716
 
@@ -787,6 +791,7 @@ $ certinspect example.com --json
787
791
  "is_ca": false,
788
792
  "san": ["example.com", "*.example.com"],
789
793
  "key": {
794
+ "type": "EC",
790
795
  "size": 256,
791
796
  "signature_algorithm": "ecdsa-with-SHA256",
792
797
  "usage": ["digital_signature"],
@@ -815,6 +820,10 @@ The `status` field mirrors the human report's `Status` line (`VALID`,
815
820
  honors `--days` / `--critical-days`, so a JSON consumer gets the verdict
816
821
  without re-deriving it from the dates.
817
822
 
823
+ `key.type` is the key family (`RSA`, `EC`, `DSA`, `Ed25519` or `Ed448`).
824
+ EdDSA keys have a fixed size, so for them `key.size` is `null` (`n/a` in the
825
+ text report).
826
+
818
827
  Need the pre-2.0 flat array (no envelope, dates via `str()`, integer serial)?
819
828
  Pass `--schema 1`:
820
829
 
@@ -891,6 +900,19 @@ $ certinspect --file ./bundle.pem --verify
891
900
  Chain trusted: True
892
901
  ```
893
902
 
903
+ For a host, revocation is checked over OCSP first, falling back to the CRL. An
904
+ answer only counts when it is authentic: the OCSP response must be about this
905
+ certificate and signed by its issuer (or by a responder the issuer delegated
906
+ with the OCSP Signing EKU); the CRL must be signed by the issuer, name it and
907
+ cover this kind of certificate. The issuer itself, taken from the verified
908
+ chain or downloaded from the certificate's AIA URL, must have signed the leaf.
909
+ Anything else is reported as `UNAVAILABLE` — a browser-like soft-fail that
910
+ leaves the exit code alone; add
911
+ [`--require-revocation-check`](#--require-revocation-check) to make it fail.
912
+ The OCSP, CRL and issuer URLs come from the certificate, so certinspect
913
+ refuses to fetch loopback, link-local (cloud metadata) or other internal
914
+ addresses — also after an HTTP redirect — and caps each response at 16 MB.
915
+
894
916
  ### `--chain`
895
917
 
896
918
  ```console
@@ -1047,13 +1069,16 @@ $ echo $?
1047
1069
 
1048
1070
  ### `--min-key-size N`
1049
1071
 
1050
- Fail (exit code 9) when the public key is smaller than N bits — e.g. reject
1051
- any RSA key below 2048 bit. Opt-in.
1072
+ Fail (exit code 9) when an RSA or DSA public key is smaller than N bits — e.g.
1073
+ reject any RSA key below 2048 bit. EC and EdDSA keys are not compared against
1074
+ N (their bit lengths are on a different scale: a 256-bit EC key is roughly as
1075
+ strong as 3072-bit RSA); `--fail-weak` still flags an EC key below 256 bit.
1076
+ Opt-in.
1052
1077
 
1053
1078
  ```console
1054
1079
  $ certinspect example.com --min-key-size 2048
1055
1080
  ...
1056
- Key size: 1024 bit
1081
+ Key size: 1024 bit (RSA)
1057
1082
  ...
1058
1083
  Policy: FAIL
1059
1084
  WARNING: policy violation (key size 1024 bit is below the 2048-bit minimum)
@@ -1168,13 +1193,13 @@ you had passed the flags yourself.
1168
1193
 
1169
1194
  Each stricter tier is a superset of the one below it:
1170
1195
 
1171
- | Check (flag) | `lenient` | `standard` | `strict` |
1172
- | --------------------------------------------- | :-------: | :--------: | :---------: |
1173
- | Minimum TLS version (`--min-tls-version`) | TLSv1.2 | TLSv1.2 | **TLSv1.3** |
1174
- | Fail on weak crypto (`--fail-weak`) | yes | yes | yes |
1175
- | Minimum key size (`--min-key-size`) | — | 2048 bit | 2048 bit |
1176
- | Require CT SCTs (`--require-sct`) | — | — | yes |
1177
- | CA/Browser Forum validity cap (`--cab-forum`) | — | — | yes |
1196
+ | Check (flag) | `lenient` | `standard` | `strict` |
1197
+ | --------------------------------------------- | :-------: | :----------------: | :----------------: |
1198
+ | Minimum TLS version (`--min-tls-version`) | TLSv1.2 | TLSv1.2 | **TLSv1.3** |
1199
+ | Fail on weak crypto (`--fail-weak`) | yes | yes | yes |
1200
+ | Minimum key size (`--min-key-size`) | — | 2048 bit (RSA/DSA) | 2048 bit (RSA/DSA) |
1201
+ | Require CT SCTs (`--require-sct`) | — | — | yes |
1202
+ | CA/Browser Forum validity cap (`--cab-forum`) | — | — | yes |
1178
1203
 
1179
1204
  Precedence and edge cases a sysadmin should know:
1180
1205
 
@@ -1192,7 +1217,7 @@ Precedence and edge cases a sysadmin should know:
1192
1217
  ```console
1193
1218
  $ certinspect example.com --profile standard
1194
1219
  ...
1195
- Key size: 1024 bit
1220
+ Key size: 1024 bit (RSA)
1196
1221
  TLS version: TLSv1.3
1197
1222
  Policy: FAIL
1198
1223
  WARNING: policy violation (key size 1024 bit is below the 2048-bit minimum)
@@ -1283,7 +1308,9 @@ summary: 1 valid · 0 expiring · 0 expired · 1 error (2 targets)
1283
1308
  Print only the fields you ask for, one tab-separated line per target, so you
1284
1309
  can pull values straight into a script without a JSON tool. Repeat `--field`
1285
1310
  for several columns; the pseudo-field `target` is the inspected host and list
1286
- fields (like `san`) are comma-joined.
1311
+ fields (like `san`) are comma-joined. Any key of the `--json --schema 1`
1312
+ output is a valid name (e.g. `issuer`, `key_type`, `key_size`,
1313
+ `revocation_status`).
1287
1314
 
1288
1315
  ```console
1289
1316
  $ certinspect example.com github.com --field target --field days_to_expire --field status
@@ -1312,7 +1339,9 @@ $ echo $?
1312
1339
 
1313
1340
  ### `--export PATH`
1314
1341
 
1315
- Save the fetched certificate as PEM and still print the report.
1342
+ Save the fetched certificate as PEM and still print the report. It takes a
1343
+ single target; with several (hosts, `--file`s or a `--discover` result) the
1344
+ command stops with a usage error rather than overwriting the same file.
1316
1345
 
1317
1346
  ```console
1318
1347
  $ certinspect example.com --export ./fetched.pem
@@ -1389,7 +1418,7 @@ Machine-readable monitoring output (full examples in
1389
1418
 
1390
1419
  ```console
1391
1420
  $ certinspect example.com --exporter nagios
1392
- OK: example.com certificate VALID (64 days to expiry) | days=64;30;0
1421
+ OK: example.com certificate VALID (64 days to expiry) | days=64;30:;0:
1393
1422
  ```
1394
1423
 
1395
1424
  ### `--version`
@@ -1430,7 +1459,7 @@ the repository with the most commonly-set options — copy the ones you want.
1430
1459
 
1431
1460
  ### `--state-file PATH` / `--only-changed`
1432
1461
 
1433
- For a recurring job (cron, CI) where you only care when something *changes* —
1462
+ For a recurring job (cron, CI) where you only care when something _changes_ —
1434
1463
  not being reminded every run that a certificate is still fine. `--state-file`
1435
1464
  records each host's status in a small JSON file; `--only-changed` then limits
1436
1465
  the report to targets whose status differs from the previous run (a target
@@ -1446,7 +1475,10 @@ Status: EXPIRING
1446
1475
  ```
1447
1476
 
1448
1477
  The state file is always brought up to date, whether or not `--only-changed`
1449
- is given, so the next run has a fresh baseline to compare against.
1478
+ is given, so the next run has a fresh baseline to compare against. A target
1479
+ that cannot be reached keeps its last known status, so a transient outage is
1480
+ reported as an error on that run (exit code 1) but not as a change once the
1481
+ host is back; a target removed from the list is dropped from the file.
1450
1482
 
1451
1483
  ### `--print-completion {bash,zsh}`
1452
1484
 
@@ -1481,10 +1513,15 @@ host is CRITICAL:
1481
1513
 
1482
1514
  ```console
1483
1515
  $ certinspect example.com expired.example.com --exporter nagios
1484
- OK: example.com certificate VALID (217 days to expiry) | days=217;30;0
1485
- CRITICAL: expired.example.com certificate EXPIRED (-3 days to expiry) | days=-3;30;0
1516
+ OK: example.com certificate VALID (217 days to expiry) | days=217;30:;0:
1517
+ CRITICAL: expired.example.com certificate EXPIRED (-3 days to expiry) | days=-3;30:;0:
1486
1518
  ```
1487
1519
 
1520
+ The perfdata thresholds use the `N:` range form, "alert below N": `30:` is the
1521
+ `--days` warning, `0:` the critical one (expired), or `--critical-days` when set
1522
+ (`days=12;30:;7:`), so graphers colour each series exactly as the plugin rates
1523
+ it.
1524
+
1488
1525
  `prometheus` emits textfile-collector metrics (`certinspect_up`,
1489
1526
  `certinspect_cert_expiry_days`, `certinspect_cert_valid`), keeping the normal
1490
1527
  worst-status exit code:
@@ -1504,7 +1541,7 @@ certinspect_cert_valid{target="example.com"} 1
1504
1541
 
1505
1542
  Three further gauges appear only for the targets whose check actually ran, so a
1506
1543
  scrape never carries a misleading `0` for a check that was not requested:
1507
- `certinspect_hostname_match` (host targets), and — with `--verify` —
1544
+ `certinspect_hostname_match` (host targets), and — unless `--no-verify` —
1508
1545
  `certinspect_chain_trusted` and `certinspect_cert_revoked` (the latter only when
1509
1546
  OCSP/CRL returns a definitive answer). This lets you alert directly on chain,
1510
1547
  hostname and revocation problems without parsing text:
@@ -1539,21 +1576,32 @@ certinspect_policy_ok{target="example.com"} 0
1539
1576
 
1540
1577
  ## Exit codes
1541
1578
 
1542
- Designed for automation (cron, CI, monitoring scripts). In batch mode the
1543
- worst code across all targets is returned.
1544
-
1545
- | Code | Meaning |
1546
- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
1547
- | 0 | Valid certificate |
1548
- | 1 | Runtime error (network, file, parse) |
1549
- | 2 | Command-line usage error |
1550
- | 3 | Expiring within the `--days` threshold |
1551
- | 4 | Expired, not yet valid, or with invalid dates |
1552
- | 5 | Hostname does not match the certificate |
1553
- | 6 | Chain not trusted or revoked (`--verify`) |
1554
- | 7 | Fingerprint does not match `--pin` |
1555
- | 8 | Expected SAN missing (`--expect-san`) |
1556
- | 9 | Policy violation (`--not-after-max`/`--cab-forum`, `--min-key-size`, `--fail-weak`, `--require-sct`, `--require-must-staple`, `--require-revocation-check`, `--min-tls-version`) |
1579
+ Designed for automation (cron, CI, monitoring scripts). A single number can
1580
+ report only one problem, so when a certificate has several (e.g. expired _and_
1581
+ a weak key), or a batch has several targets, the **most severe** one is
1582
+ returned. The codes are labels, not a scale; severity follows this order, most
1583
+ severe first:
1584
+
1585
+ `6` untrusted/revoked → `7` pin mismatch → `4` expired/not yet valid → `5`
1586
+ hostname mismatch → `1` runtime error (e.g. unreachable host) → `8` SAN
1587
+ missing → `9` policy → `3` expiring → `0` valid.
1588
+
1589
+ Two options replace these codes: `--exporter nagios` exits with the plugin
1590
+ convention (`0` OK, `1` WARNING, `2` CRITICAL) and `--exit-zero` always exits
1591
+ `0`.
1592
+
1593
+ | Code | Meaning |
1594
+ | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1595
+ | 0 | Valid certificate |
1596
+ | 1 | Runtime error (network, file, parse) |
1597
+ | 2 | Command-line usage error |
1598
+ | 3 | Expiring within the `--days` threshold |
1599
+ | 4 | Expired, not yet valid, with invalid dates, or expiring within `--critical-days` |
1600
+ | 5 | Hostname does not match the certificate |
1601
+ | 6 | Chain not trusted or certificate revoked (verification is on by default; `--no-verify` skips it) |
1602
+ | 7 | Fingerprint does not match `--pin` |
1603
+ | 8 | Expected SAN missing (`--expect-san`) |
1604
+ | 9 | Policy violation (`--profile`, `--not-after-max`/`--cab-forum`, `--min-key-size`, `--fail-weak`, `--require-sct`, `--require-must-staple`, `--require-revocation-check`, `--min-tls-version`), or an unexpected issuer with `--discover-only --expect-issuer` |
1557
1605
 
1558
1606
  Example in a script:
1559
1607