Documentation
¶
Overview ¶
Package revocation verifies, orders and fetches revocation lists -- SSH KRLs with a detached SSHSIG signature, and X.509 CRLs -- for a distribution that trusts nothing in between: every list is checked against the CA it revokes for, refused once it is no longer current, and never let replace a newer one.
VerifyKRL and VerifyCRL check a list; List.Current and List.Follows say whether it may be used now and whether it may replace the one held; Fetcher fetches one source with all three; SignKRL signs a KRL for an issuer; FailClosedKRL is what a distributor writes for sshd when it has no current list.
PROTOCOL.md says what is verified and why; the authn-revokd command distributes lists with this package.
Index ¶
Constants ¶
const Namespace = "krl@go-authn.github.io"
Namespace is the SSHSIG namespace a KRL's signature is made in (PROTOCOL.sshsig: it keeps a signature from being taken for another purpose). ssh-keygen -Y verify -n krl@go-authn.github.io checks it.
Variables ¶
var ( // ErrExpired is a list past its expiry, or older than the caller's // max_age: not current. ErrExpired = errors.New("revocation: the list is no longer current") // ErrRollback is a list older than the one held. ErrRollback = errors.New("revocation: the list is older than the one held") )
Errors a caller tells apart.
Functions ¶
func FailClosedKRL ¶
FailClosedKRL is the list a distributor writes for sshd when it has no current list from ca: ca's own key revoked, which sshd checks for every certificate ca signed (krl.c ssh_krl_check_key) -- so every one of them is refused, and nothing else. It is not signed: it is written locally, for the reader on this machine, never distributed.
func FilePath ¶
FilePath is the local path a file:// URL names: file:///etc/x is /etc/x, and on Windows file:///C:/x is C:\x (RFC 8089, appendix E.2).
Types ¶
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetcher fetches one source, keeping the last list that verified.
func NewFetcher ¶
NewFetcher returns a Fetcher for src that holds held, the copy kept from before (the file last written, read back): a fetched list must follow it.
type List ¶
type List struct {
Kind Kind
// Raw is the list as it was signed: what sshd, OpenSSL and every other
// reader take.
Raw []byte
// Sig is a KRL's armored SSHSIG signature; nil for a CRL, which is
// signed inside.
Sig []byte
// Version is the KRL's krl_version or the CRL Number: the order lists
// of one issuer come in.
Version *big.Int
// Issued is the KRL's generation date or the CRL's thisUpdate.
Issued time.Time
// Expires is the KRL's expires@go-authn.github.io extension or the
// CRL's nextUpdate: when the list stops being current.
Expires time.Time
// KRL is the parsed KRL, for a KRL.
KRL *krl.KRL
// CRL is the parsed CRL, for a CRL.
CRL *x509.RevocationList
}
List is a revocation list that verified: its signature by the CA it was checked against, and its form. Whether it is still current is Current's question; whether it may replace another is Follows'.
func VerifyCRL ¶
func VerifyCRL(raw []byte, ca *x509.Certificate) (*List, error)
VerifyCRL checks a CRL, DER or PEM, against the CA certificate ca. It refuses: a signature by anything else, or an issuer that is not ca's subject; a CRL with no number or no nextUpdate, which could be neither ordered nor aged; a delta CRL, which only means something with its base (RFC 5280 5.2.4); and a critical extension it does not understand, nor any critical entry extension.
func VerifyKRL ¶
VerifyKRL checks a KRL and its armored SSHSIG signature against the SSH CA key ca. It refuses: a signature by any other key, in another namespace, or in the RSA SHA-1 form PROTOCOL.sshsig forbids (hiddeco/sshsig refuses it when it reads the signature; x/crypto alone would verify it); a KRL sshd would not load (go-authn/krl refuses what OpenSSH refuses), or one with the old signature section, which OpenSSH never verifies and which PROTOCOL.krl says 9.4 and later refuse -- measured, 9.6p1 and 10.3p1 load it, so whether a given sshd does is not something to rely on; and a KRL that does not say when it expires, which a reader could never tell from a stale one.
func (*List) Current ¶
Current reports whether l may be used at now: not past its expiry, and, when maxAge is not zero, issued no more than maxAge before now. A list issued in the future -- an issuer's clock ahead by more than skew -- is not current either: its age cannot be known.
func (*List) Follows ¶
Follows reports whether l may replace held, a list of the same issuer: a higher version, or the same version issued later (the same revocations, re-issued with a new expiry). Anything else is a rollback -- a replayed or restored older list, which would un-revoke what the newer one revoked. A nil held is followed by anything.
type Source ¶
type Source struct {
// URL is http://, https:// or file://. The list verifies by itself, so
// the transport decides how fast a change arrives, never whether a
// forged or stale list is taken. A KRL's signature is at URL+".sig".
URL string
Kind Kind
// SSHCA is the CA key a KRL must be signed by; X509CA the certificate a
// CRL must be signed by.
SSHCA ssh.PublicKey
X509CA *x509.Certificate
// MaxAge, when not zero, bounds a list's age from its issue, besides
// its own expiry.
MaxAge time.Duration
// Client fetches http and https URLs; nil is a client with a one
// minute timeout.
Client *http.Client
// Clock is the time a list's currency is judged at; nil is time.Now.
// One clock for the fetcher and its caller, or they disagree on what
// is current.
Clock func() time.Time
}
Source is where a list comes from and what it must verify against.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
authn-revokd
command
Command authn-revokd distributes revocation lists: it fetches SSH KRLs and X.509 CRLs, keeps only those that verify (signed by the CA configured for them, current, never older than the copy held), writes them where sshd and TLS servers read them -- failing closed for sshd when a list lapses -- and, with listen, serves the verified copies to other agents as a mirror.
|
Command authn-revokd distributes revocation lists: it fetches SSH KRLs and X.509 CRLs, keeps only those that verify (signed by the CA configured for them, current, never older than the copy held), writes them where sshd and TLS servers read them -- failing closed for sshd when a list lapses -- and, with listen, serves the verified copies to other agents as a mirror. |