certinspect 2.3.2__tar.gz → 2.3.3__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.
- {certinspect-2.3.2/src/certinspect.egg-info → certinspect-2.3.3}/PKG-INFO +1 -1
- {certinspect-2.3.2 → certinspect-2.3.3}/pyproject.toml +1 -1
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/__init__.py +1 -1
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/args.py +2 -2
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/cli.py +8 -8
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/config.py +2 -2
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/discover.py +2 -2
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/httpfetch.py +1 -1
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/render.py +3 -3
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/revocation.py +4 -4
- {certinspect-2.3.2 → certinspect-2.3.3/src/certinspect.egg-info}/PKG-INFO +1 -1
- {certinspect-2.3.2 → certinspect-2.3.3}/tests/test_cli.py +1 -1
- {certinspect-2.3.2 → certinspect-2.3.3}/tests/test_discover.py +5 -5
- {certinspect-2.3.2 → certinspect-2.3.3}/tests/test_fetch.py +15 -15
- {certinspect-2.3.2 → certinspect-2.3.3}/LICENSE +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/README.md +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/setup.cfg +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/completion.py +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/exit_codes.py +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/fetch.py +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/formatter.py +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/models.py +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect/parser.py +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect.egg-info/SOURCES.txt +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect.egg-info/dependency_links.txt +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect.egg-info/entry_points.txt +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect.egg-info/requires.txt +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/src/certinspect.egg-info/top_level.txt +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/tests/test_formatter.py +0 -0
- {certinspect-2.3.2 → certinspect-2.3.3}/tests/test_parser.py +0 -0
|
@@ -8,7 +8,7 @@ run logic; the completion and --config machinery introspect this parser.
|
|
|
8
8
|
import argparse
|
|
9
9
|
|
|
10
10
|
from certinspect import __version__
|
|
11
|
-
from certinspect.config import
|
|
11
|
+
from certinspect.config import DEFAULT_CONFIG_PATH
|
|
12
12
|
from certinspect.fetch import STARTTLS_PORTS
|
|
13
13
|
from certinspect.parser import POLICY_PROFILES
|
|
14
14
|
|
|
@@ -31,7 +31,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
31
31
|
f"TOML file of default option values (keys use the argparse "
|
|
32
32
|
f"destination name, e.g. 'days = 14' or 'verify = false'); an "
|
|
33
33
|
f"explicit command-line flag always overrides it. Without "
|
|
34
|
-
f"--config, {
|
|
34
|
+
f"--config, {DEFAULT_CONFIG_PATH} is loaded automatically if it "
|
|
35
35
|
"exists."
|
|
36
36
|
),
|
|
37
37
|
)
|
|
@@ -51,8 +51,8 @@ from certinspect.parser import (
|
|
|
51
51
|
from certinspect.exit_codes import EXIT_BY_STATUS, ExitCode
|
|
52
52
|
from certinspect.models import CertificateInfo
|
|
53
53
|
from certinspect.completion import bash_completion_script, zsh_completion_script
|
|
54
|
-
from certinspect.config import
|
|
55
|
-
from certinspect.render import
|
|
54
|
+
from certinspect.config import DEFAULT_CONFIG_PATH, load_config
|
|
55
|
+
from certinspect.render import load_state, render, save_state
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
@dataclass(frozen=True)
|
|
@@ -588,13 +588,13 @@ def main() -> None:
|
|
|
588
588
|
if not Path(pre_args.config).is_file():
|
|
589
589
|
parser.error(f"--config file not found: {pre_args.config}")
|
|
590
590
|
config_path: Path | None = Path(pre_args.config)
|
|
591
|
-
elif
|
|
592
|
-
config_path =
|
|
591
|
+
elif DEFAULT_CONFIG_PATH.is_file():
|
|
592
|
+
config_path = DEFAULT_CONFIG_PATH
|
|
593
593
|
else:
|
|
594
594
|
config_path = None
|
|
595
595
|
if config_path is not None:
|
|
596
596
|
try:
|
|
597
|
-
parser.set_defaults(**
|
|
597
|
+
parser.set_defaults(**load_config(str(config_path), parser))
|
|
598
598
|
except ValueError as err:
|
|
599
599
|
parser.error(str(err))
|
|
600
600
|
|
|
@@ -714,14 +714,14 @@ def main() -> None:
|
|
|
714
714
|
|
|
715
715
|
changed_targets: set[str] | None = None
|
|
716
716
|
if args.state_file:
|
|
717
|
-
previous_state =
|
|
717
|
+
previous_state = load_state(args.state_file)
|
|
718
718
|
current_state = {t: info["status"] for t, info, _ in results if t is not None}
|
|
719
719
|
changed_targets = {
|
|
720
720
|
t for t, status in current_state.items() if previous_state.get(t) != status
|
|
721
721
|
}
|
|
722
|
-
|
|
722
|
+
save_state(args.state_file, current_state)
|
|
723
723
|
|
|
724
|
-
override =
|
|
724
|
+
override = render(
|
|
725
725
|
results,
|
|
726
726
|
as_json=args.json,
|
|
727
727
|
days=args.days,
|
|
@@ -10,7 +10,7 @@ import tomllib
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
12
|
# Default location for --config, checked only when the flag is not given.
|
|
13
|
-
|
|
13
|
+
DEFAULT_CONFIG_PATH = Path.home() / ".config" / "certinspect" / "config.toml"
|
|
14
14
|
|
|
15
15
|
# Destination groups the parser makes mutually exclusive: a --config file
|
|
16
16
|
# setting more than one member of a group would silently defeat argparse's own
|
|
@@ -23,7 +23,7 @@ _CONFIG_EXCLUSIVE_GROUPS = (
|
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def
|
|
26
|
+
def load_config(path: str, parser: argparse.ArgumentParser) -> dict:
|
|
27
27
|
"""Load a --config TOML file and return it as a dest -> value mapping.
|
|
28
28
|
|
|
29
29
|
Every key must be a known argparse destination (checked against ``parser``
|
|
@@ -14,7 +14,7 @@ import json
|
|
|
14
14
|
from dataclasses import dataclass
|
|
15
15
|
from urllib.parse import urlencode
|
|
16
16
|
|
|
17
|
-
from certinspect.httpfetch import
|
|
17
|
+
from certinspect.httpfetch import fetch
|
|
18
18
|
|
|
19
19
|
# crt.sh search front end. The `%` in the query is a SQL LIKE wildcard matching
|
|
20
20
|
# any subdomain label; `output=json` asks for machine-readable results.
|
|
@@ -69,7 +69,7 @@ def _fetch_records(domain: str, timeout: float) -> list[dict]:
|
|
|
69
69
|
Raises ValueError when the response is not the expected JSON array.
|
|
70
70
|
"""
|
|
71
71
|
query = urlencode({"q": f"%.{domain}", "output": "json"})
|
|
72
|
-
body =
|
|
72
|
+
body = fetch(f"{_CRT_SH_URL}?{query}", timeout=timeout)
|
|
73
73
|
try:
|
|
74
74
|
records = json.loads(body)
|
|
75
75
|
except json.JSONDecodeError as err:
|
|
@@ -62,7 +62,7 @@ def _guard_fetch_host(url: str) -> None:
|
|
|
62
62
|
)
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
def
|
|
65
|
+
def fetch(url: str, *, data: bytes | None = None, timeout: float) -> bytes:
|
|
66
66
|
"""Perform a minimal HTTP(S) GET/POST and return the response body.
|
|
67
67
|
|
|
68
68
|
Only ``http`` and ``https`` URLs are accepted; the URLs come from the
|
|
@@ -22,7 +22,7 @@ from certinspect.formatter import (
|
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def
|
|
25
|
+
def render(
|
|
26
26
|
results: list[tuple[str | None, dict, int]],
|
|
27
27
|
*,
|
|
28
28
|
as_json: bool,
|
|
@@ -113,7 +113,7 @@ def _render(
|
|
|
113
113
|
return None
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
def
|
|
116
|
+
def load_state(path: str) -> dict[str, str]:
|
|
117
117
|
"""Return the target -> status mapping saved by a previous --state-file run.
|
|
118
118
|
|
|
119
119
|
A missing, unreadable or malformed file is treated as an empty history (the
|
|
@@ -127,7 +127,7 @@ def _load_state(path: str) -> dict[str, str]:
|
|
|
127
127
|
return data if isinstance(data, dict) else {}
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
def
|
|
130
|
+
def save_state(path: str, state: dict[str, str]) -> None:
|
|
131
131
|
"""Persist the target -> status mapping for the next --state-file run.
|
|
132
132
|
|
|
133
133
|
Failing to write is reported as a warning rather than aborting the run:
|
|
@@ -13,7 +13,7 @@ from cryptography.hazmat.primitives import hashes, serialization
|
|
|
13
13
|
from cryptography.x509 import ocsp
|
|
14
14
|
from cryptography.x509.oid import AuthorityInformationAccessOID, ExtensionOID
|
|
15
15
|
|
|
16
|
-
from certinspect.httpfetch import
|
|
16
|
+
from certinspect.httpfetch import fetch
|
|
17
17
|
|
|
18
18
|
# Clock-skew tolerance when judging whether an OCSP response is still fresh.
|
|
19
19
|
_OCSP_CLOCK_SKEW = timedelta(minutes=5)
|
|
@@ -51,7 +51,7 @@ def _fetch_issuer(cert: x509.Certificate, timeout: float) -> x509.Certificate |
|
|
|
51
51
|
_, issuer_urls = _aia_urls(cert)
|
|
52
52
|
for url in issuer_urls:
|
|
53
53
|
try:
|
|
54
|
-
return x509.load_der_x509_certificate(
|
|
54
|
+
return x509.load_der_x509_certificate(fetch(url, timeout=timeout))
|
|
55
55
|
except (OSError, ValueError):
|
|
56
56
|
continue
|
|
57
57
|
return None
|
|
@@ -122,7 +122,7 @@ def _check_ocsp(
|
|
|
122
122
|
der_request = builder.build().public_bytes(serialization.Encoding.DER)
|
|
123
123
|
|
|
124
124
|
try:
|
|
125
|
-
raw =
|
|
125
|
+
raw = fetch(ocsp_urls[0], data=der_request, timeout=timeout)
|
|
126
126
|
except (OSError, ValueError) as err:
|
|
127
127
|
return "UNAVAILABLE", f"OCSP request failed: {err}"
|
|
128
128
|
|
|
@@ -196,7 +196,7 @@ def _check_crl(
|
|
|
196
196
|
|
|
197
197
|
for url in urls:
|
|
198
198
|
try:
|
|
199
|
-
raw =
|
|
199
|
+
raw = fetch(url, timeout=timeout)
|
|
200
200
|
except (OSError, ValueError):
|
|
201
201
|
continue
|
|
202
202
|
crl = _load_crl(raw)
|
|
@@ -1981,7 +1981,7 @@ def test_main_config_auto_discovered_when_no_flag(
|
|
|
1981
1981
|
|
|
1982
1982
|
config_path = tmp_path / "config.toml"
|
|
1983
1983
|
config_path.write_text("days = 14\n")
|
|
1984
|
-
monkeypatch.setattr(cli, "
|
|
1984
|
+
monkeypatch.setattr(cli, "DEFAULT_CONFIG_PATH", config_path)
|
|
1985
1985
|
certs = {"a.com": make_cert(san=["a.com"], days_valid=10)}
|
|
1986
1986
|
monkeypatch.setattr("certinspect.cli.get_server_cert", _fake_fetch(certs))
|
|
1987
1987
|
code = _run_main(monkeypatch, ["a.com"])
|
|
@@ -48,18 +48,18 @@ def test_discover_hostnames_parses_and_sorts(monkeypatch):
|
|
|
48
48
|
},
|
|
49
49
|
]
|
|
50
50
|
).encode()
|
|
51
|
-
monkeypatch.setattr("certinspect.discover.
|
|
51
|
+
monkeypatch.setattr("certinspect.discover.fetch", lambda url, *, timeout: payload)
|
|
52
52
|
assert discover_hostnames("example.com", 5.0) == ["a.example.com", "b.example.com"]
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def test_discover_hostnames_rejects_non_json(monkeypatch):
|
|
56
|
-
monkeypatch.setattr("certinspect.discover.
|
|
56
|
+
monkeypatch.setattr("certinspect.discover.fetch", lambda url, *, timeout: b"nope")
|
|
57
57
|
with pytest.raises(ValueError, match="could not parse"):
|
|
58
58
|
discover_hostnames("example.com", 5.0)
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
def test_discover_hostnames_rejects_non_array(monkeypatch):
|
|
62
|
-
monkeypatch.setattr("certinspect.discover.
|
|
62
|
+
monkeypatch.setattr("certinspect.discover.fetch", lambda url, *, timeout: b"{}")
|
|
63
63
|
with pytest.raises(ValueError, match="expected a JSON array"):
|
|
64
64
|
discover_hostnames("example.com", 5.0)
|
|
65
65
|
|
|
@@ -83,7 +83,7 @@ def test_discover_certificates_dedups_by_serial_and_keeps_metadata(monkeypatch):
|
|
|
83
83
|
}
|
|
84
84
|
# The same serial appears twice (precert + final cert) and must collapse.
|
|
85
85
|
payload = json.dumps([record, dict(record)]).encode()
|
|
86
|
-
monkeypatch.setattr("certinspect.discover.
|
|
86
|
+
monkeypatch.setattr("certinspect.discover.fetch", lambda url, *, timeout: payload)
|
|
87
87
|
assert discover_certificates("example.com", 5.0) == [
|
|
88
88
|
DiscoveredCert(
|
|
89
89
|
hostnames=("example.com", "www.example.com"),
|
|
@@ -113,7 +113,7 @@ def test_discover_certificates_sorts_by_expiry_and_keeps_wildcards(monkeypatch):
|
|
|
113
113
|
},
|
|
114
114
|
]
|
|
115
115
|
).encode()
|
|
116
|
-
monkeypatch.setattr("certinspect.discover.
|
|
116
|
+
monkeypatch.setattr("certinspect.discover.fetch", lambda url, *, timeout: payload)
|
|
117
117
|
certs = discover_certificates("example.com", 5.0)
|
|
118
118
|
assert [cert.hostnames for cert in certs] == [
|
|
119
119
|
("*.example.com",),
|
|
@@ -22,10 +22,10 @@ def test_check_revocation_accepts_explicit_issuer(make_cert):
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def test_http_rejects_unsupported_scheme():
|
|
25
|
-
from certinspect.httpfetch import
|
|
25
|
+
from certinspect.httpfetch import fetch
|
|
26
26
|
|
|
27
27
|
with pytest.raises(ValueError, match="unsupported URL scheme"):
|
|
28
|
-
|
|
28
|
+
fetch("ftp://example.com/cert", timeout=1.0)
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class _FakeSocket:
|
|
@@ -468,7 +468,7 @@ def test_check_crl_reports_good_when_serial_absent(monkeypatch):
|
|
|
468
468
|
|
|
469
469
|
issuer_cert, leaf_cert, crl = _build_crl_pki(revoked_serials=())
|
|
470
470
|
der_crl = crl.public_bytes(serialization.Encoding.DER)
|
|
471
|
-
monkeypatch.setattr(revocation, "
|
|
471
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, timeout: der_crl)
|
|
472
472
|
|
|
473
473
|
status, detail = revocation._check_crl(leaf_cert, issuer_cert, timeout=1.0)
|
|
474
474
|
assert status == "GOOD"
|
|
@@ -482,7 +482,7 @@ def test_check_crl_reports_revoked_when_serial_listed(monkeypatch):
|
|
|
482
482
|
|
|
483
483
|
issuer_cert, leaf_cert, crl = _build_crl_pki(revoked_serials=(4242,))
|
|
484
484
|
der_crl = crl.public_bytes(serialization.Encoding.DER)
|
|
485
|
-
monkeypatch.setattr(revocation, "
|
|
485
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, timeout: der_crl)
|
|
486
486
|
|
|
487
487
|
status, detail = revocation._check_crl(leaf_cert, issuer_cert, timeout=1.0)
|
|
488
488
|
assert status == "REVOKED"
|
|
@@ -502,7 +502,7 @@ def test_check_crl_soft_fails_stale_crl_when_serial_absent(monkeypatch):
|
|
|
502
502
|
crl_next_update_delta=-timedelta(days=1),
|
|
503
503
|
)
|
|
504
504
|
der_crl = crl.public_bytes(serialization.Encoding.DER)
|
|
505
|
-
monkeypatch.setattr(revocation, "
|
|
505
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, timeout: der_crl)
|
|
506
506
|
|
|
507
507
|
status, detail = revocation._check_crl(leaf_cert, issuer_cert, timeout=1.0)
|
|
508
508
|
assert status == "UNAVAILABLE"
|
|
@@ -522,7 +522,7 @@ def test_check_crl_reports_revoked_even_when_crl_is_stale(monkeypatch):
|
|
|
522
522
|
crl_next_update_delta=-timedelta(days=1),
|
|
523
523
|
)
|
|
524
524
|
der_crl = crl.public_bytes(serialization.Encoding.DER)
|
|
525
|
-
monkeypatch.setattr(revocation, "
|
|
525
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, timeout: der_crl)
|
|
526
526
|
|
|
527
527
|
status, detail = revocation._check_crl(leaf_cert, issuer_cert, timeout=1.0)
|
|
528
528
|
assert status == "REVOKED"
|
|
@@ -542,7 +542,7 @@ def test_check_crl_soft_fails_not_yet_valid_crl_when_serial_absent(monkeypatch):
|
|
|
542
542
|
crl_next_update_delta=timedelta(days=2),
|
|
543
543
|
)
|
|
544
544
|
der_crl = crl.public_bytes(serialization.Encoding.DER)
|
|
545
|
-
monkeypatch.setattr(revocation, "
|
|
545
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, timeout: der_crl)
|
|
546
546
|
|
|
547
547
|
status, detail = revocation._check_crl(leaf_cert, issuer_cert, timeout=1.0)
|
|
548
548
|
assert status == "UNAVAILABLE"
|
|
@@ -559,7 +559,7 @@ def test_check_crl_skips_crl_with_bad_signature(monkeypatch):
|
|
|
559
559
|
# CRL signed by an unrelated CA must not be trusted against this issuer.
|
|
560
560
|
other_issuer, _, other_crl = _build_crl_pki(revoked_serials=(4242,))
|
|
561
561
|
der_crl = other_crl.public_bytes(serialization.Encoding.DER)
|
|
562
|
-
monkeypatch.setattr(revocation, "
|
|
562
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, timeout: der_crl)
|
|
563
563
|
|
|
564
564
|
# Use the first PKI's issuer, whose key did not sign ``other_crl``.
|
|
565
565
|
wrong_issuer, _, _ = _build_crl_pki()
|
|
@@ -575,7 +575,7 @@ def test_check_revocation_falls_back_to_crl(monkeypatch):
|
|
|
575
575
|
|
|
576
576
|
issuer_cert, leaf_cert, crl = _build_crl_pki(revoked_serials=(4242,))
|
|
577
577
|
der_crl = crl.public_bytes(serialization.Encoding.DER)
|
|
578
|
-
monkeypatch.setattr(revocation, "
|
|
578
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, timeout: der_crl)
|
|
579
579
|
|
|
580
580
|
status, detail = revocation.check_revocation(leaf_cert, issuer=issuer_cert)
|
|
581
581
|
assert status == "REVOKED"
|
|
@@ -647,7 +647,7 @@ def test_check_ocsp_soft_fails_on_unparseable_response(monkeypatch):
|
|
|
647
647
|
issuer_cert, leaf_cert = _build_ocsp_pki()
|
|
648
648
|
# Garbage bytes that load_der_ocsp_response cannot parse.
|
|
649
649
|
monkeypatch.setattr(
|
|
650
|
-
revocation, "
|
|
650
|
+
revocation, "fetch", lambda url, data=None, timeout=None: b"\x30\x03not-asn1"
|
|
651
651
|
)
|
|
652
652
|
|
|
653
653
|
status, detail = revocation._check_ocsp(leaf_cert, issuer_cert, timeout=1.0)
|
|
@@ -691,14 +691,14 @@ def test_guard_fetch_host_allows_private_pki(monkeypatch):
|
|
|
691
691
|
|
|
692
692
|
|
|
693
693
|
def test_http_refuses_link_local_metadata_address(monkeypatch):
|
|
694
|
-
"""The guard is wired into
|
|
694
|
+
"""The guard is wired into fetch, so a metadata URL raises before urlopen."""
|
|
695
695
|
from certinspect import httpfetch
|
|
696
696
|
|
|
697
697
|
monkeypatch.setattr(
|
|
698
698
|
httpfetch.socket, "getaddrinfo", lambda *a, **k: _addrinfo("169.254.169.254")
|
|
699
699
|
)
|
|
700
700
|
with pytest.raises(ValueError, match="non-routable or internal"):
|
|
701
|
-
httpfetch.
|
|
701
|
+
httpfetch.fetch("http://metadata.example/ocsp", timeout=1.0)
|
|
702
702
|
|
|
703
703
|
|
|
704
704
|
def test_http_caps_oversized_response(monkeypatch):
|
|
@@ -720,7 +720,7 @@ def test_http_caps_oversized_response(monkeypatch):
|
|
|
720
720
|
|
|
721
721
|
monkeypatch.setattr(httpfetch.urllib.request, "urlopen", lambda *a, **k: _Resp())
|
|
722
722
|
with pytest.raises(ValueError, match="exceeds the"):
|
|
723
|
-
httpfetch.
|
|
723
|
+
httpfetch.fetch("http://big.example/crl", timeout=1.0)
|
|
724
724
|
|
|
725
725
|
|
|
726
726
|
# --- OCSP response freshness ------------------------------------------------
|
|
@@ -805,7 +805,7 @@ def test_check_ocsp_good_when_response_is_fresh(monkeypatch):
|
|
|
805
805
|
issuer_cert, leaf_cert, der = _signed_ocsp(
|
|
806
806
|
ocsp.OCSPCertStatus.GOOD, now - timedelta(hours=1), now + timedelta(days=1)
|
|
807
807
|
)
|
|
808
|
-
monkeypatch.setattr(revocation, "
|
|
808
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, data=None, timeout=None: der)
|
|
809
809
|
|
|
810
810
|
status, _ = revocation._check_ocsp(leaf_cert, issuer_cert, timeout=1.0)
|
|
811
811
|
assert status == "GOOD"
|
|
@@ -824,7 +824,7 @@ def test_check_ocsp_soft_fails_on_stale_response(monkeypatch):
|
|
|
824
824
|
issuer_cert, leaf_cert, der = _signed_ocsp(
|
|
825
825
|
ocsp.OCSPCertStatus.GOOD, now - timedelta(days=2), now - timedelta(days=1)
|
|
826
826
|
)
|
|
827
|
-
monkeypatch.setattr(revocation, "
|
|
827
|
+
monkeypatch.setattr(revocation, "fetch", lambda url, data=None, timeout=None: der)
|
|
828
828
|
|
|
829
829
|
status, detail = revocation._check_ocsp(leaf_cert, issuer_cert, timeout=1.0)
|
|
830
830
|
assert status == "UNAVAILABLE"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|