Documentation
¶
Overview ¶
Package revocation fetches the CRLs that certificates name, for the opt-in revocation stage of a TLS scan (CRYPTO-REVIEW-004 P1b). It is the only code in a scan that contacts a host other than the target, so it is careful:
- The addresses come from certificates the target sent, so they are hostile. Only plain http URLs (RFC 5280 §4.2.1.13; the CA/Browser Forum requires http for CRLs) without credentials are fetched, and Policy is enforced on the real remote address of every connection, redirects included: loopback, link-local (cloud metadata), private, shared and unspecified addresses are refused unless the operator allows them.
- Bodies are capped (MaxBytes), requests are timed out, no proxy from the environment is used, and nothing from the response is shown verbatim.
- Results are cached by URL until the CRL's nextUpdate (at most a day), and failures for a few minutes, so repeated scans do not hammer a CA.
It only fetches and parses; pki.JudgeCRL decides what a CRL says.
Index ¶
Constants ¶
const ( DefaultMaxBytes = 16 << 20 DefaultTimeout = 10 * time.Second )
Defaults.
Variables ¶
var ErrBlocked = errors.New("CRL address not allowed")
ErrBlocked is wrapped by every refusal of an address or URL.
Functions ¶
Types ¶
type Fetcher ¶
type Fetcher struct {
Policy Policy
MaxBytes int64
Timeout time.Duration
Now func() time.Time
// contains filtered or unexported fields
}
Fetcher retrieves CRLs. It is safe for concurrent use; share one per process so its cache works across scans.
type Policy ¶
type Policy struct {
// AllowPrivate allows RFC 1918, unique-local (fc00::/7) and shared
// (100.64.0.0/10) addresses: an internal CA's CRL server. Off by default,
// because any certificate a scanned server presents can name one.
AllowPrivate bool
// AllowLoopback allows this machine (tests, and a CA run on the same host).
AllowLoopback bool
}
Policy says which remote addresses a CRL fetch may connect to.