Expand description
Request filtering: named checks, boolean rules over them, and the machinery that turns a request into one answer.
Filters answer a different question from challenge:
who may ask, rather than whether they control the name. Both matter, and
when challenge.bypass is on, filtering is the only thing deciding who
may obtain a certificate, because a triggered challenge is then accepted
with no network check at all.
§The shape
A Check is one named question — “is this address in the management
network?”, “does the inventory say this address owns this name?” — declared
as [filter.check.<name>] with a type. A rule is a boolean expression
over check names plus what a match means, declared as
[filter.rule.<name>] and selected and ordered by filter.rules.
FilterPolicy holds both and answers one request.
[filter]
rules = ["mgmt-bypass", "inventory-owned"]
[filter.check.mgmt-net]
type = "allowed_ip"
allow = ["10.0.0.0/8"]
[filter.check.inventory]
type = "ipam"
[filter.rule.mgmt-bypass]
when = "mgmt-net"
then = "allow"
[filter.rule.inventory-owned]
when = "inventory or mgmt-net"
then = "allow"Everything is a named check: custom is type = "custom" like any other,
with no separate selection list of its own, and two instances of one type
are ordinary rather than impossible.
§Two hook points
Some checks decide from the connection alone (is this IP allowed? does it
have a valid PTR record?); others need the names being requested, which only
the handlers know. Rather than two traits, Check has two methods, both
defaulting to “pass”:
check_connectionruns inadd_filter_middlewarefor every request.check_identifiersruns atnewOrder(the order’s identifiers) and again atfinalize(the CSR’s subject alternative names and common name).
Which rules run at which hook, and why the answer is an intersection rather
than a union, is policy’s subject.
§Startup validation
CIDRs, regexes and conditions are parsed once in from_config, which
returns an anyhow::Error the binary treats as fatal. A typo in a netmask
is a configuration bug that should stop the server, not silently deny (or
admit) traffic at runtime.
Re-exports§
pub use client_ip::ClientIp;pub use client_ip::ProxyPolicy;pub use eab::EabIdentity;pub use policy::Check;pub use policy::CheckSummary;pub use policy::Effect;pub use policy::FilterPolicy;pub use policy::Mode;pub use policy::Outcome;pub use policy::Rule;pub use policy::RuleSummary;pub use policy::Stage;pub use policy::StageSet;pub use policy::Verdict;
Modules§
- build
- Turning
[filter]into aFilterPolicy. - client_
ip - Deciding which address a request actually came from.
- custom
- The
customcheck: executes an external script/binary to evaluate requests. - eab
- The
eabcheck: which credential the account was registered under. - explain
- Rendering a policy, and what it would do to one hypothetical request.
- expr
- The condition language a
[filter.rule.<name>]is written in. - identifiers
- The
identifiersfilter: which names a client may have certified. - ip_
allow - The
allowed_ipcheck: which networks may talk to the server. - ipam
- The
ipamfilter: the client’s address must own the names it asks for. - path
- The
pathcheck: which request paths a rule applies to. - policy
- The policy engine: named checks, boolean rules over them, and the evaluator.
- reverse_
dns - The
reverse_dnsfilter: the client’s address must have a usable PTR record.
Structs§
- Connection
Context - What a
Checkknows about a request before it is dispatched. - Identifier
Context - What a
Checkknows about the names a client wants certified.
Enums§
- Identifier
Stage - Where in the flow a set of identifiers is being checked.
Functions§
- from_
config - Builds the configured policy. Called once at startup, so it may fail fast (the caller exits on error).