Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Files and locations

Iron Vault keeps its files in four directories: one for the config, one for the vault (the state directory), one for the log and one at runtime for the sockets. Where they are depends on the deployment profile, which is fixed when the binary is built (Service states). The file names inside each directory are the same for every profile.

Before the service unlocks anything, it checks each path it reads: every directory above the file must be owned by root or the service account and not writable by anyone else, and the file must have the owner and mode below. The log directory is the exception: a directory above it may be group-writable when root owns it, because Debian and Ubuntu ship /var/log as drwxrwxr-x root syslog. The service refuses to start on an unsafe path and names the path that failed. The service never repairs a directory: an existing one with the wrong mode is refused. On a protected install, the package’s tmpfiles.d puts back the owner and mode of its three directories (/etc/iron-vault, /var/lib/iron-vault and /run/iron-vault) at boot and on upgrade, so that refusal shows only until then.

The four directories of a protected install, with the main files in each:

/etc/iron-vault/            config directory      config.toml, config.toml.sig
/var/lib/iron-vault/        state directory       identity.age, operational.age, recipients.age, approval.age,
                                                  approver-<id>.age, manifest.age, record-<id>-<digest prefix>.age,
                                                  recovery.toml
/var/log/iron-vault/        log directory         iron-vault.log
/run/iron-vault/            runtime directory     admin.sock, request sockets such as proxy.sock

Protected install

The .deb package runs the service as the iron-vault system account.

PathOwnerModeMade byWhat it is
/usr/bin/iron-vaultroot0755the packageThe binary.
/etc/iron-vault/iron-vault0700the package (tmpfiles.d)The config directory.
/etc/iron-vault/config.tomliron-vault0600the serviceThe published approved config.
/etc/iron-vault/config.toml.sigiron-vault0600the serviceIts approval signature.
/var/lib/iron-vault/iron-vault0700the package (tmpfiles.d)The state directory: the vault.
/var/log/iron-vault/iron-vault0750systemd (LogsDirectory=)The log directory, until an approved config names another.
/var/log/iron-vault/iron-vault.logiron-vault0640the serviceThe log.
/run/iron-vault/iron-vault0711the package (tmpfiles.d)The runtime directory.
/run/iron-vault/admin.sockiron-vault0600the serviceThe admin socket; you reach it with sudo.
a listener’s unix_socket, such as /run/iron-vault/proxy.sockiron-vault0666the serviceA request socket. Callers are told apart by peer account or token, not by the socket’s mode.
/usr/lib/systemd/system/iron-vault.service, iron-vault-listener@.socketroot0644the packageThe service unit, and the template for TCP listener sockets.
/usr/lib/sysusers.d/iron-vault.conf, /usr/lib/tmpfiles.d/iron-vault.confroot0644the packageCreate the account and the directories above.
/etc/logrotate.d/iron-vaultroot0644the packageLog rotation (log operations).
/usr/lib/systemd/system/iron-vault-host-unlock.serviceroot0644the packageThe handoff unit: at each boot it unseals the host unlock blob and installs the handoff. It has no [Install] section; iron-vault.service pulls it in at every start.
/usr/libexec/iron-vault/iron-vault-tpm-signerroot0755the packageThe TPM signing helper, the only program that opens the TPM for approvals (recipe). /usr/bin/iron-vault never links the TPM library.
/usr/lib/systemd/system/iron-vault-tpm-signer.socket, iron-vault-tpm-signer@.serviceroot0644the packageThe helper’s socket, and the instance started for each connection, as the iron-vault-tpm account with the tss group.
/run/iron-vault-tpm/signer.sockiron-vault0600systemdThe helper’s socket. Only the service account and root can connect, one connection at a time. The service offers the tpm approver kind while it exists.
/usr/sbin/iron-vault-provision-host-unlockroot0755the packageThe provisioning helper, iron-vault-provision-host-unlock(8). It seals a new host unlock identity to the TPM (TPM unlock).
/etc/iron-vault-host/root0700the helperThe host unlock directory. The service cannot see it. Kept when the package is removed; purged only when the vault is.
/etc/iron-vault-host/host-unlock.credroot0600the helperThe host unlock blob: the host unlock identity sealed by systemd-creds to this TPM and PCR 7. It opens only on this machine at this Secure Boot policy, and a backup copy opens there too.
/etc/iron-vault-host/provisioning.txtroot0600the helperThe acceptance record of the last provisioning: the mode (server or portable), each --portable warning, how it was accepted (terminal or flag) and SUDO_USER, with the time. Replaced whole each time; the same lines are in the journal under iron-vault-host-unlock.

The unit lets the service write only /etc/iron-vault, /var/lib/iron-vault, /run/iron-vault and its log directory. A protected install also reads the host unlock handoff when it is there; its two paths are in the handoff table below. Uninstalling keeps the vault and the config. Purging deletes /etc/iron-vault and asks before it deletes the vault (installation guide).

Development mode

A build with --features dev-mode runs as you and keeps its files in your XDG directories. Every file and directory is owned by you.

PathModeWhat it is
$XDG_CONFIG_HOME/iron-vault-dev/ (default ~/.config/iron-vault-dev/)0700The config directory.
.../iron-vault-dev/config.toml and config.toml.sig0600The published approved config and its signature.
$XDG_STATE_HOME/iron-vault-dev/ (default ~/.local/state/iron-vault-dev/)0700The state directory.
$XDG_STATE_HOME/iron-vault-dev-log/0700 when created; up to 0750 acceptedThe log directory. It sits beside the state directory, not inside it, because any other file in the state directory is a foreign file.
.../iron-vault-dev-log/iron-vault.log0640The log. With serve --log-to-stdout the log goes to stdout instead, until an approved config names a destination.
$XDG_RUNTIME_DIR/iron-vault-dev/0711The runtime directory. XDG_RUNTIME_DIR must be set; it has no default.
.../iron-vault-dev/admin.sock0600The admin socket.

The service creates each missing directory with the mode shown. The binary and every directory above it must be owned by you or root and not writable by group or others (Development mode). A Unix socket path must be under 108 bytes, so keep these directories short.

Container

A build with --features container uses the protected install’s paths inside the container: /etc/iron-vault, /var/lib/iron-vault and /run/iron-vault, owned by iron-vault with the same modes. They are mounted in two ways:

  • The config and state directories are named volumes. The image creates both directories, so Docker copies their owners and modes into new volumes.
  • /run/iron-vault is a host directory, bind-mounted read-write. The host’s tmpfiles.d creates it at boot, owned by iron-vault with mode 0711, and the mount hides the image’s copy. The service binds admin.sock there, so host root reaches it.

Listener TLS certificates and keys are mounted read-only at /etc/iron-vault-tls. The binary is /usr/bin/iron-vault, owned by root, 0755. The image runs serve --log-to-stdout, so the log goes to the container runtime (log operations). The host layout and mounts tables in docker-compose.md list every host path and mount.

Host unlock handoff

The Protected and Container profiles read one more file when it is there, the host unlock handoff:

PathOwnerModeMade byWhat it is
/run/iron-vault-unlock/root0711 on its ramfs; neither group nor others may write itthe host’s handoff unitIn the Container profile, the host directory, bind-mounted read-only into the container at the same path. The directory is mounted, not the file, so the container sees a file missing or replaced on the host as missing or replaced. In a protected install it is the host’s own ramfs, which the package’s handoff unit iron-vault-host-unlock.service mounts over a root 0711 directory that tmpfiles.d creates.
/run/iron-vault-unlock/host-unlockiron-vault0400 (no group or other bits; at most 0600 is accepted)the host’s handoff unitThe host unlock identity’s secret text, one AGE-SECRET-KEY-1… line of at most 128 bytes. It lets the service unlock at startup without a passphrase.

The file must be a regular file, never a symlink, and no directory above it may be writable by group or others, not even a sticky one such as /tmp. A file that breaks the rule is refused, not read.

At startup a Protected or Container service reads this file. If the identity in it opens the vault, the service goes from Starting to Checking with no passphrase. If the file is missing, or is refused (an unsafe path, an unreadable file, a key that is not one of the vault’s recipients, or memory not locked against swap), the service stays Locked and a passphrase unlock still works. Each start writes one vault.host-unlock record (audit log).

When the handoff file is missing, the service also looks for the unseal-failure file, /run/iron-vault-unlock/unseal-failed: an empty file that the host’s handoff unit leaves when it fails, such as when a firmware update changes PCR 7. It counts only as a regular file owned by root, not a symlink. If it is there, the record says unseal_failed instead of absent. Either way the service stays Locked, so the file is a diagnostic only. The service does not look for it when the handoff file is there. The host side, which unseals the identity from the TPM onto a ramfs, is in docker-compose.md.

The config directory

FileWhat it is
config.tomlThe active config, as last approved.
config.toml.sigThe active config’s approval: a signature over the vault ID, the approval version and the config’s digest.
config.toml.pendingA config being approved, before it is published.
config.toml.sig.stagedAn approval being committed, before it is published.
config.toml.lockThe lock that keeps one writer at a time.
.<name>.tmpA temporary file a durable write uses before its rename.

All are 0600 and owned by the service account. The pending, staged and temporary files exist only while an approval runs, or after one was interrupted; the next config check finishes or discards them and logs config.recovery-published or config.recovery-discarded.

The dev-config.toml you edit is yours, anywhere you like. config approve sends its text to the service, which writes its own copy.

The state directory

FileWhat it is
identity.ageThe identity envelope: the vault identity, sealed to each recipient.
recipients.ageThe recipient inventory: who can open the vault (the operational identity, the recovery key and any recipient added since), each with its role, label and enrolment time. init writes it.
recipients.age.stagedA recipient change being committed. The next recipient command finishes or discards it.
operational.ageThe passphrase envelope: the operational identity, sealed with the vault passphrase.
approver-<id>.ageAn approver key envelope, one per software approver: the key that signs config approvals for it, sealed with its approval passphrase. init writes one for its approver.
approver-<id>.tpmA TPM key blob, one per TPM approver, mode 0600: the wrapped key only the TPM that made it can load. It is not secret.
approval.ageThe approval state: the committed and highest reserved approval versions.
manifest.ageThe vault manifest: which credential records exist, sealed with a code only the vault identity can make.
record-<id>-<digest prefix>.ageOne credential record: its kind, secret and permitted origins. <digest prefix> is the first 8 bytes of the file’s digest in the manifest, in hex, so a rewritten record gets a new name.
recovery.tomlWhen recovery check last proved the recovery key. Holds no secret.
init.unfinishedAn empty marker of an init that has not finished. init run again discards it.
import.unfinishedAn empty marker of an import that has not finished. While it is there unlock refuses; import or init run again discards it.
locked-by-ownerAn empty file that lock writes and a passphrase unlock removes. While it is there, a starting service skips host unlock and stays Locked, so a lock survives a restart. init and reset remove it.
lockThe lock that keeps one writer at a time.
.<name>.tmpA temporary file a durable write uses before its rename.

All are 0600 and owned by the service account. Any other file in the state directory is a foreign file, except lost+found, which is ignored. What a foreign file does depends on whether the manifest is there:

  • With manifest.age, the foreign file is never read, and the unlock goes on without it. unlock logs vault.foreign-file for each one.
  • Without it, the service cannot tell a vault from files someone else left there, so it touches nothing. unlock refuses with unlock-failed (15), naming up to five of the files, and logs vault.unlock-refused with refusal unrecognized_files. init refuses with already-initialized.

How the vault is locked explains the envelopes.

A migration bundle

export and import read and write these beside the bundle path you give, wherever you choose; none is in the state or config directory. See move a vault to a new machine.

FileWhat it is
<bundle>The migration bundle: a .tar.gz of the encrypted record files, manifest, approval state, approver key envelopes and config, with the vault identity sealed with the export passphrase. 0600. It holds no plaintext secret.
.<bundle>.partialThe bundle while export receives it, created 0600 before anything is sent. It takes the bundle’s name once it is whole, and is removed on any other ending. export refuses to start while one is there.
<bundle>.config.tomlThe source’s committed config, which import writes beside the bundle, 0600, for the first config approve. Holds no secret.

The log

iron-vault.log, 0640, in a directory the service account owns with a mode of at most 0750. An approved config can move it to another directory, which must pass the same rule; service.log-destination-changed records the move in both places. The audit log reference lists what it holds, and the log operations guide covers reading it, rotation and collectors.

Never edit these files by hand

The config pair is signed and the .age vault files are sealed, so a change the service did not make to any of them is caught, not obeyed. Editing one by hand, even to fix a typo, makes the service refuse it. recovery.toml, init.unfinished, the lock files, the temporary files and the log are neither signed nor sealed: only the owner and mode rules above protect them.

  • config.toml and config.toml.sig. On a SIGHUP, or at unlock, the service reads the pair and checks the signature against the vault ID and the committed approval version. A config changed without approval does not verify: the service goes to Unavailable (policy invalid), answers every request with 503, and logs config.reload-failed or config.check-failed. An older config with its own valid signature is refused too, because its version is below the committed one. To recover, approve a good config: iron-vault config approve dev-config.toml. See Tamper detection and recovery.
  • manifest.age and record-<id>-<digest prefix>.age. Anyone with the vault’s public key can write a file that looks like a credential record, so a record is trusted only when the manifest lists it. A record file the manifest does not list is never loaded (vault.unindexed-file). A listed record that is missing, swapped for another or unreadable is reported as damaged (vault.record-damaged); only the routes that use it answer 503. iron-vault replace writes a good record.
  • identity.age, operational.age and approval.age. Damage to the shared state makes unlock refuse, or sends the service to Unavailable (recovery needed), with vault.shared-state-damaged in the log.
  • approver-<id>.age. Only that approver’s prompt reads it: a damaged or swapped key file makes its answer fail for config approve, replace, rm and recipient remove, and signs nothing.
  • recovery.toml is plain text, so reminders work while the vault is locked. It holds only two times, when reminders started counting and when the last recovery check ran, so an edit can change no more than when status reminds you to check the recovery key.
  • The lock files and temporary files. Removing them while the service runs can let two writers race. Leave them; the service cleans up after itself.

To change the config, approve a new one. To change a credential, use add, replace or rm. To start again from nothing, see Start over.