revocation

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	DefaultMaxBytes = 16 << 20
	DefaultTimeout  = 10 * time.Second
)

Defaults.

Variables

View Source
var ErrBlocked = errors.New("CRL address not allowed")

ErrBlocked is wrapped by every refusal of an address or URL.

Functions

func CheckURL

func CheckURL(raw string) (*url.URL, error)

CheckURL refuses anything but a plain http URL with a host and no credentials.

Types

type Fetched

type Fetched struct {
	List      *x509.RevocationList
	SHA256    string
	Size      int
	FetchedAt time.Time
}

Fetched is one CRL as retrieved.

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.

func New

func New(p Policy) *Fetcher

New returns a Fetcher with the default limits.

func (*Fetcher) Get

func (f *Fetcher) Get(ctx context.Context, raw string) (*Fetched, error)

Get returns the CRL at raw, from the cache when it is still fresh. Callers fetching the same URL at once share one request.

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.

func (Policy) CheckIP

func (p Policy) CheckIP(ip net.IP) error

CheckIP returns nil when a CRL fetch may connect to ip.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL