Skip to main content

Module authorized

Module authorized 

Source
Expand description

A per-user file of pins, in the manner of ~/.ssh/authorized_keys.

The file holds one pin per line, sha256:<hex> (a certificate’s fingerprint) or spki-sha256:<hex> (its public key), then optional whitespace and a comment. Blank lines and lines starting # are ignored; a line that is not a pin is skipped and counted. A file may hold MAX_PIN_LINES lines and be MAX_FILE_BYTES long.

AuthorizedFile finds the file by a path template, {home}/.myapp/authorized_certificates say, with {home} (the account’s home attribute), {name} and {id} filled from the account a rule already named; it never looks at any other account’s file. Who reads the file is a PinFileReader: the default, DirectReader, opens it and makes the checks sshd makes of authorized_keys; a consumer whose process cannot read homes supplies a reader that reads through its own helper, and which makes those checks wherever it has access. The library checks nothing it cannot see: it renders the path, parses the text a reader returns, and turns a refusal into “no pins, and why”.

Structs§

AuthorizedFile
The pins in a file per user: a PinSource that reads only the file of the account it is asked about.
DirectReader
Opens the file itself and makes the checks sshd makes of authorized_keys.
ReadFailure
Why a reader would not give the file: it counts as no pins and the reason is reported. The reason never holds a pin.
TemplateError
A path template that cannot work. It never quotes the template.

Enums§

FileRead
What a reader found at a path.

Constants§

MAX_FILE_BYTES
The longest file read, in bytes.
MAX_PIN_LINES
The most pin lines a file may hold, counting lines that are not valid pins.
MOST_WAITING
The most reads one DirectReader lets wait on the file system at once by default, over every account; one account never has more than one waiting.
READ_TIMEOUT
The longest a DirectReader waits for the file system by default.

Traits§

PinFileReader
Reads the pin file of an account.