Skip to main content

Module storage

Module storage 

Source
Expand description

Certificate and ACME account-key storage in the data directory.

An ACME account key is a credential in the same sense a signing key is: whoever holds it can request certificates in this server’s name against its account. It gets the same treatment crates/didbot-pds/src/wal/mod.rs gives the write-ahead log: 0600 files inside a 0700 directory, and the directory’s mode is set unconditionally rather than only on creation — a mkdir’d-by-hand data directory or a mounted volume gets the same tightening a freshly created one always did. See that module’s create_dir for the fuller argument; this is the same fix, independently applied, because this crate cannot reach into didbot-pds’s pub(crate) copy.

Structs§

CaStore
The local certificate authority’s own certificate and key, in a directory of their own.
CertMeta
The metadata kept beside the certificate: which directory issued it and when it was written. The certificate’s own notAfter is not duplicated here — cert.rs::leaf_expiry reads that from the DER, which cannot drift from what the certificate actually says.
CertStore
Where this crate’s own state lives inside a PDS data directory: a tls/ subdirectory, so it sits beside the write-ahead log and blob store rather than mixed into either.
Staged 🔒
A file’s next contents, written and synced beside its final path but not yet renamed over it.
StoredAccount
An ACME account read back off disk, and which directory registered it.

Enums§

StorageError
Why the on-disk certificate state could not be read or written.

Constants§

ACCOUNT_FILE 🔒
CA_FILE 🔒
CA_KEY_FILE 🔒
CERT_FILE 🔒
DIR_MODE 🔒
FILE_MODE 🔒
KEY_FILE 🔒
META_FILE 🔒

Functions§

create_dir 🔒
Creates dir 0700 if absent, and tightens it to 0700 if it was already there — the fix didbot-pds’s write-ahead log made for the same reason, applied here because this crate cannot call that one.
io_error 🔒
read_string_at 🔒
Reads a file this crate wrote, naming it if it cannot be read.
scratch_path 🔒
Where path’s replacement is built: <name>.tmp in the same directory, so the rename that finishes it never crosses a filesystem.
sync_dir 🔒
Syncs a directory entry, so a rename cannot be undone by a power cut.
write_json_at 🔒
Serialises value and writes it 0600 at path, replacing whatever was there in one step.
zone_directory_component 🔒
The single path component zone’s certificate directory is named after: the hostname, lowercased, with nothing that could escape the directory it is joined onto.