Agent on Linux
ferritor-agent reads an application’s secrets and keeps them current as
plain files, one per secret, for applications that read their
configuration from files (most do) and shouldn’t have to talk to ferritor
themselves. It runs next to the application: as a sidecar in Kubernetes,
or as a service on its host.
/run/secrets/app/ db-password the value, byte for byte tls.crt tls.keyIn Kubernetes, the CSI provider does the same once per node, for every pod there, through the Secrets Store CSI Driver, instead of an agent per pod; each pod still reads with its own identity.
It’s an ordinary ferritor client: it reads with its own client certificate,
under that identity’s policies, rate limits and audit log, and needs only
read on the paths it renders (and list with detect = "list", below).
The certificate comes from files, or from the server’s token exchange for
a platform token (workload identity), which the agent
renews itself.
Running it
Section titled “Running it”ferritor-agent once --config /etc/ferritor-agent/app.toml # render, then exitferritor-agent run --config /etc/ferritor-agent/app.toml # render, then keep currentferritor-agent exec --config /etc/ferritor-agent/app.toml -- /usr/bin/app --flag # an environment| Mode | Does | Exits |
|---|---|---|
once |
renders every output once | 0 when every required secret is written; 1 at once if the server refuses a required one for good (permission denied, not found), or after --wait-secs (default 60) of transient failures (unreachable, sealed, rate-limited) |
run |
renders, then polls every interval (and watches, below) and rewrites what changed. On Windows also a service’s command line, and --log-file sends the logs to a file (Windows) |
0 on SIGTERM or SIGINT (Windows: Ctrl+C, Ctrl+Break, the console closing, a shutdown, the service’s stop), at once, also in the middle of a round against a server that doesn’t answer; the files stay as they are. SIGHUP reloads the config |
exec |
renders as once (--wait-secs), then starts the command after -- with [exec]’s variables in its environment, and keeps them (and any outputs’ files) current as run does, restarting the command when one changes. Linux and other Unix systems only |
with the command’s exit code (128 + the signal that ended it); SIGTERM and SIGINT are passed on to it, then it exits with it. 1 if the command can’t start, or as once if the first values can’t be had; 75 after on_change = "exit" |
run and once refuse a config with [exec], and exec one without.
--config can also come from FERRITOR_AGENT_CONFIG. A configuration
mistake refuses to start, saying what and where (run reloads an edited
config, below). Logs go to stderr
(FERRITOR_AGENT_LOG, an EnvFilter, default info), never a value: paths,
versions and refusals only. Like the server, the agent marks itself
undumpable before reading anything, so the application next to it can’t
read its memory or its key through /proc, even as the same user. On
Windows it locks its process with an access list instead
(Windows).
Configuration
Section titled “Configuration”server = "https://ferritor.internal:7070"ca = "/etc/ferritor/ca.pem" # to verify the server withcert = "/var/run/ferritor-identity/tls.crt" # the agent's ferritor://<name> certificatekey = "/var/run/ferritor-identity/tls.key"interval_secs = 60detect = "get"
[[output]]dir = "/run/secrets/app"on_change = { signal = "HUP", pid_file = "/run/app/app.pid" }
[[output.secret]]path = "billing/app/db-password" # the file is `db-password`
[[output.secret]]path = "billing/app/tls/cert"file = "tls.crt"
[[output.secret]]path = "billing/app/tls/key"file = "tls.key"mode = 0o400Top level:
| Key | Default | |
|---|---|---|
server |
(required) | https://…, or http://… for a dev-mode server on loopback |
ca |
(required with https) | PEM: the CA that signed the server’s certificate. Watched |
cert, key |
(with https: these, or token_file and exchange) |
PEM files: the agent’s client certificate and key. Watched: replaced on disk (a renewal), they’re used from the next round on |
token_file |
Workload identity: a platform token (a projected service account token), read anew at each exchange | |
exchange |
with token_file: the server’s token exchange (its [identity] listen_addr), https://, verified with ca |
|
interval_secs |
60 | between rounds, 5 to 86,400, spread by ±10 % so agents started together don’t poll in step |
detect |
get |
how changes are found (below): get or list |
watch |
true | keep a watch stream open beside the rounds, to hear of a change at once (below) |
[[output]], one directory swapped as a set:
| Key | Default | |
|---|---|---|
dir |
(required) | absolute; created (0750) if missing; must be in memory (tmpfs, ramfs) |
allow_disk |
false | allow a directory that isn’t in memory: the values then reach a disk. Required on Windows, which has none |
group |
the directory’s | the files’ and directories’ group (numeric). The agent must be a member: it has no CAP_CHOWN (checked at startup, with a test file). The output directory takes it too if the agent owns it. In Kubernetes, leave it unset and use the pod’s fsGroup. On Windows, an account or group name instead (Windows) |
mode |
0o440 |
its files’ mode, unless a secret gives its own. Never any permission for others (refused): share through the group. On Windows only its group bits count: whether group may read |
on_revoked |
keep |
its secrets’ default (below) |
list_prefix |
the secrets’ parents | with detect = "list": the one prefix to list (below) |
on_change |
nothing | how the application learns of a change (below) |
[[output.secret]], one file:
| Key | Default | |
|---|---|---|
path |
(required) | the secret |
file |
the path’s last segment | the file’s name: no /, not starting with .. (the agent’s own names). On Windows also none of \ : * ? " < > |, no device name (CON, NUL, COM1…), no trailing dot or space, and no two differing only in case |
mode |
the output’s | |
version |
the latest | pin to this version: read once, never refreshed |
required |
true | the first set isn’t written without it, and once fails without it |
on_revoked |
the output’s | keep or remove (below) |
detect |
the top level’s | per secret, e.g. get for one path under list |
One path may be several files of an output (under other names, with other
modes or on_revoked): files with the same path, version and detect
share one read, read once a round, refused and backed off once, each file
following its own on_revoked. A different version or detect is a read
of its own.
[[output.template]], several secrets rendered into one file
(templates):
| Key | Default | |
|---|---|---|
file |
(required) | the file’s name, by the rules of a secret’s file; never another secret’s or template’s in the output |
content |
the template, inline (a TOML multi-line string, ''', takes it as written) |
|
source |
or an absolute path to a regular file (a symbolic link to one included) to read it from, at startup and at every reload (an edit to it reloads, as one to the config does). Anything else, a FIFO say, is refused without waiting on it | |
mode |
the output’s | |
required |
true | the first set isn’t written without it, and once fails without it |
on_revoked |
the output’s | keep or remove, when one of its inputs is refused for good |
detect |
the top level’s | for its inputs |
One of content and source, at most 1 MiB.
[metrics], how metrics leave the agent (below), read at
startup:
| Key | Default | |
|---|---|---|
exporter |
OTLP if OTEL_EXPORTER_OTLP_ENDPOINT is set, else none |
otlp, prometheus or none |
listen_addr |
127.0.0.1:9465 |
prometheus only: where GET /metrics is served |
tls |
prometheus only, and only false: required to serve off loopback, where it’s plaintext |
With token_file, the agent exchanges the token for a certificate before
its first round, keeps the certificate and its key in memory only, and
exchanges again two thirds into the certificate’s life, and after any
failed round (the certificate may be what was refused: its issuing key
revoked, a cutoff). A failed exchange keeps the current certificate while
it’s valid, retried every 30 s; with none valid, the round fails as
transient, and the next try waits at least as long as the server said (an
exchange rate-limited because many replicas of one identity started
together: see workload identity).
Templates
Section titled “Templates”A template renders several secrets into one file (a config file, a .env,
a connection URL): literal text, and a placeholder for each value:
[[output.template]]file = "app.env"mode = 0o400content = '''DB_USER=appDB_PASSWORD={{ secret billing/app/db-password | dotenv }}DB_URL=postgres://app:{{ secret billing/app/db-password | url }}@db.internal/app'''The syntax is that, and only that: {{ secret <path> | <filter> }},
spaces and tabs free inside the braces, on one line. No loops, conditions,
includes or functions. A literal {{ is written {{ "{{" }}; }} alone is
plain text. A mistake (an unknown filter, a bad path, a {{ not closed on
its line) refuses the config, naming the template and the line.
Every placeholder names its encoding, with no default: a generated
password with &, #, " or \ breaks a file that pastes it as it is,
so the template says once how its file reads a value:
| Filter | Writes | Refuses |
|---|---|---|
raw |
the bytes as they are, newlines included (a PEM certificate or key inside a config file). The template’s author vouches for the context | NUL |
line |
as raw, one line |
NUL, a newline, a carriage return |
dotenv |
a double-quoted value as dotenvy reads it: ", \ and $ escaped with \, a newline as \n. Other dotenv readers differ in quotes, escapes and $: check yours reads it back |
not UTF-8, NUL, a carriage return |
shell |
a POSIX single-quoted word (' as '\''), read the same by every POSIX shell: for a file a shell sources, exports or execs |
not UTF-8, NUL |
url |
percent-encoded but for A-Z a-z 0-9 - . _ ~: a URL’s user, password or query value |
nothing |
json |
a JSON string, quotes included | not UTF-8 |
base64 |
standard base64, padded | nothing |
A value its filter refuses leaves that template’s file out of the set
(logged, without the value), the rest written; a required one holds the
first set back, and once fails on it. A rendering longer than 16 MiB is
left out the same way, found before anything is reserved (a placeholder
repeated through a long template copies its value each time). A new value
renders it again.
Read once either way: a template’s paths are read with the output’s
other secrets, once a round however many files and templates use them, and
are watched, listed (with detect = "list", their parents join the
listing) and backed off like any secret. A path a template uses is read one
way in its output: the latest version, by one detect; a secret file of it
pinning a version, or reading it with another detect, is refused at
load.
Never half rendered: a template’s file is written once every input has
a value, in the same generation as the other files (a reader resolving
..data once sees one consistent set), and written again only when an
input’s value or version changes, or the template itself. An input refused
for good: with on_revoked = "keep" (the default) the file keeps that
input’s last value, as a secret’s file would, while the other inputs still
update it (a rotated password the identity can still read arrives); with
remove the file goes until every input is readable again.
A template without placeholders is a static file: written with the set,
never a read.
Environment variables
Section titled “Environment variables”For an application that reads its secrets from its environment only,
exec starts it with them and restarts it when they change:
[exec]on_change = "restart" # or "exit", "none"grace_secs = 10
[[exec.env]]name = "DB_PASSWORD"value = "{{ secret billing/app/db-password | line }}"
[[exec.env]]name = "DATABASE_URL"value = "postgres://app:{{ secret billing/app/db-password | url }}@db.internal/app"[exec]:
| Key | Default | |
|---|---|---|
on_change |
restart |
when a variable’s value changes (a running process can’t take a new environment): restart stops the command (SIGTERM, then SIGKILL after grace_secs) and starts it again with the new values; exit stops it and exits with 75, for a supervisor (Kubernetes, systemd) to start both again; none logs it, and the command keeps what it started with |
grace_secs |
10 | 1 to 600: how long a stopping command has between SIGTERM and SIGKILL |
on_revoked |
keep |
its variables’ default (below) |
list_prefix |
the inputs’ parents | with detect = "list" |
[[exec.env]], one variable:
| Key | Default | |
|---|---|---|
name |
(required) | ASCII letters, digits and _, not starting with a digit; once each |
value |
(required) | a one-line template: literal text and placeholders, each naming its filter (line for a value as it is) |
required |
true | the command doesn’t start without it, and exec fails as once does |
on_revoked |
[exec]’s |
keep the refused input’s last value, or remove the variable at the next restart (the command doesn’t get it at all then, not even from the agent’s own environment; the same for one not rendered) |
detect |
the top level’s | for its inputs |
The variables are added to the agent’s own environment, and the command
gets the agent’s standard streams. It runs in a process group of its own
(unless the agent’s stdin is a terminal: then it shares the agent’s, so
it can still read the terminal, and a restart couldn’t wait for what it
started, so on_change = "restart" is refused there: use exit or
none), and stopping it stops the group: the
signal (SIGTERM for a restart; for a stop of the agent, the SIGTERM or
SIGINT it got) to all of it, then grace_secs later SIGKILL to whatever’s
left, and no new one starts until the group is gone: a wrapper
(sh -c) and what it started end together, two generations never run at
once. A command that ends by itself takes its group with it (SIGTERM,
then SIGKILL). A stop before the first values are in starts nothing. Only
a value that differs restarts it: a new version with the same bytes
doesn’t, nor does a reload that only reorders [[exec.env]]. A stop of
the agent while a restart waits for the command to go is passed on to it
too, and nothing new starts. A variable longer than Linux passes to a
command (128 KiB, name included), or arguments and environment together
over what it takes at once (a quarter of the stack’s limit, ulimit -s,
at most 6 MiB and at least 128 KiB: 2 MiB by default), is refused before anything is stopped: at the first
start exec fails saying which, later the command keeps the values it has
(an error logged). Values that come while a restart waits for the command
to go and can’t be passed on don’t leave it stopped: it starts with the
ones it was stopped for. Everything else is as for files: read
once a round however many variables use a path, watched, backed off, and
reloaded with the config (a reload that changes a
variable’s value counts as a change). Outputs’ files can sit beside them
in the same config. The command is the agent’s child, so in a container the agent is
the entrypoint: ["ferritor-agent", "exec", "--config", "…", "--", "/app"].
As a container’s PID 1 the agent reaps what the command’s process group
leaves behind when it stops, but not orphans that left the group (a
daemon that called setsid): run it under an init if the command starts
such (docker run --init, tini, or the pod’s shareProcessNamespace).
Prefer files where the application can read them: an environment is harder to keep to the application (below), and changing it takes a restart.
Reloading the config
Section titled “Reloading the config”run applies an edited config without a restart: it reads the file every
5 seconds and reloads when its contents change (through a symlink, so a
ConfigMap’s update counts), and every template source it names, and on
Linux reloads at SIGHUP too. once reads them once.
- All or nothing. The new config is checked whole, as at startup, and
every output it adds or changes is opened as at startup. Anything wrong,
and the running config stays as it was, the file and the reason logged,
counted by
ferritor_agent_config_reloads_total{result="failed"}; the next edit tries again. - What a secret knew carries over: its value, and a refusal with its
backoff, while its path,
versionanddetectstay the same. A reload never makes the agent ask sooner for a path refused withPERMISSION_DENIED, which would cost a denial from the identity’s budget (see failures): that backoff carries over to the path with anotherversionordetect, in another output, or removed and added back while it lasts. Anot_foundorinvalidrefusal doesn’t: with anotherversionordetectthe path is asked for at once, so fixing a wrong version applies without waiting. - Added, removed or changed secrets, templates (or their
source), files, modes,on_revoked,required,detect,on_change,group,allow_disk,interval_secs,watch: a round follows at once, reads what’s new, and writes the set again if a file’s value, name or mode changes, or the output’sgroup(telling the application, as after any write); nothing is written when nothing would differ. A file no longer in the config has its link removed with that write, and so does a file given another path (orversion, ordetect) until that one has a value: a name never keeps the old secret’s value. - Outputs are matched by
dir: anotherdiris one output removed and one added. An output removed is no longer updated and left as it is, its files included: the agent never deletes a directory the config no longer names. - The server,
ca,cert,key,token_fileorexchangechanged: the agent connects again (exchanging its token again), and reads every secret again from there, a pinned version included. - A new
groupmust be one the agent can give its files (one of its groups), checked before the reload applies; the output directory takes it too if the agent owns it (otherwise a warning: the application must still be able to enter it). [metrics]takes a restart: a change is logged and the rest applied. So do[exec]’son_changeandgrace_secs(its variables reload like any template); adding or removing[exec]is refused.
Whoever can write the config file chooses what the agent writes where,
from which secrets, and what it runs on a change, without needing to
restart it. Whoever can write a template’s source chooses less, but
still enough: what its file holds, from any secret the agent may read, and
when the application is told of a change. Make both writable by the
agent’s administrators only, as the key is.
The directory
Section titled “The directory”/run/secrets/app/ ..2026_10_24_10_02_11.123456789.3/ one generation: every file, as written ..data -> ..2026_10_24_10_02_11.123456789.3 db-password -> ..data/db-password tls.crt -> ..data/tls.crt ..status.jsonThe layout of Kubernetes Secret volumes. Each write creates a new
generation (every file written and synced, with its mode and group set
before anything points at it), then swaps ..data onto it in one rename,
then adds the names of new files and removes those no longer configured.
The previous generation stays until the next write; older ones, and
anything a stopped agent left half-written, are removed.
Only the agent may write the directory. The agent trusts what it
finds there: where ..data points, which names are its own. It refuses to
follow ..data anywhere but one of its own generations in the directory,
and removes nothing else, but a writer there can still plant names that
make its renders fail, or swap files under the application. So the
application, and anything else in the pod or on the host, reads the
directory and never writes it: mounted read-only in Kubernetes, owned by
the agent’s user with only group read and enter under systemd (below).
Reading files that must match. Each file is always whole. A set is
consistent only for a reader that resolves ..data once and reads every
file under that directory:
base = os.path.join(dir, os.readlink(os.path.join(dir, "..data")))cert = open(os.path.join(base, "tls.crt")).read()key = open(os.path.join(base, "tls.key")).read()Opening tls.crt and then tls.key by their visible names resolves
..data twice, and a write between the two gives the old certificate and
the new key. That’s true of Kubernetes Secret volumes too.
The first set is written once every required secret has a value (optional ones may be missing); a later write happens only when something changed.
..status.json is written next to the set, never in it, with a mode
the files’ readers share:
{ "last_success": "2026-10-24T10:02:11Z", "last_error": null, "rendered": true, "secrets": [ { "path": "billing/app/db-password", "file": "db-password", "version": 4, "refused": null } ]}refused is permission_denied, not_found or invalid while the
server refuses that secret for good; version is the version in its file,
if any. With templates, a templates list follows: each one’s file,
whether it’s rendered in the set, and its inputs (path, the
version rendered, refused), never the rendered content.
Telling the application
Section titled “Telling the application”An application that reads its files once at start needs telling. Per output, after every write but the first (at the first, the application usually hasn’t started):
on_change |
|
|---|---|
| (unset) | nothing: the application re-reads the files itself (watching ..data, or reading on each use) |
{ signal = "HUP", pid_file = "/run/app/app.pid" } |
a signal (HUP, INT, TERM, USR1, USR2) to the pid in the file. Whoever can write the file chooses which process gets the signal (any the agent may signal, itself included): only the application may write it |
{ signal = "HUP", process = "nginx" } |
the signal to every process with that name |
{ command = ["systemctl", "reload", "app"] } |
a command, in the background, logged if it fails or runs past 60 s. The only kind on Windows, which has no signals (a signal is refused there) |
Across containers: a signal reaches the application only with a shared
process namespace (shareProcessNamespace: true), and only if the agent
may signal it (the same UID, or CAP_KILL). A command runs in the agent’s
own environment, which for a sidecar is its own container, where the
application’s tools usually aren’t; in the agent’s image there’s nothing
but the agent (development), so use a
signal there.
Finding changes
Section titled “Finding changes”detect |
Each round | Needs |
|---|---|---|
get (default) |
reads every secret | read |
list |
lists each prefix, then reads only the secrets whose version moved | read, and list on the prefixes |
Every call is an audited decision, and with get every round also
transfers and decrypts every value. So for large fleets list costs far
less (1,000 agents with 5 secrets each, every 60 s: 83 lines per second
with get, 17 with list, plus a line per changed secret). With a watch
stream up (below), rounds come ten times less often: 8 and 2. A listing
covers everything below its prefix and is paged (up to 1,000 paths a
page, each page a call); the agent warns when one takes more than a page.
The prefixes are the secrets’ parents (billing/app/tls/cert lists
billing/app/tls), or the output’s list_prefix. A parent can be much
broader than the secrets: billing/db-password’s is all of billing.
Keep an application’s secrets under a prefix of their own
(billing/app/…), or set list_prefix to the narrowest one that covers
them. A single-segment path has no parent but everything: refused with
list unless list_prefix is set or the secret uses detect = "get".
With list, a secret missing from its listing has no live version: it’s
treated as deleted. A read revoked while list stays is noticed only
when the secret’s version next moves.
Watching. In run, the agent also keeps a
watch stream open on its secrets’ paths (not the
pinned ones, nor those refused), and reads a secret as soon as the stream
says its version moved: a change reaches the files within a second or so
instead of an interval. A stream’s start, and a resync, run a round at
once (what changed before it isn’t told). The rounds go on beside it as
a safety net, ten intervals apart while the stream is up (at most ten
minutes apart, never further apart than without it: an interval_secs
of an hour stays an hour), and back to the interval as soon as it ends.
So an interval doesn’t need shortening for speed, and raising it costs no
freshness while the stream is up. A refused secret keeps its own backoff
either way. A stream that can’t be opened or ends is opened again after
1 s, doubling to the interval, logged each time (no watch stream);
meanwhile the rounds alone keep the files current. Opening it costs an audited decision per
path; an open stream costs nothing in the log until something changes.
once doesn’t watch; watch = false turns it off. Each agent’s stream
counts toward its identity’s max_watch_streams on the server it reached
(256 by default): replicas sharing an identity past that get no stream
(WATCH_FULL) and poll; raise it for them in the server’s
[[rate_limit.identity]].
Failures
Section titled “Failures”Transient (the server unreachable or timing out, sealed, its stored policies unverified, rate-limited, the client certificate refused): nobody decided anything about the secrets. The round stops, every file stays, and the next try comes after 1 s, doubling up to the interval, never before the server’s own retry time.
Authoritative (permission denied, not found, the namespace gone):
someone decided. That secret alone backs off: one interval from the first
refusal, then two, four, up to ten intervals, never back to a second, while
the other secrets carry on. Its file follows on_revoked:
keep(default): the last value stays in its file, and the status says it’s refused. The application keeps working, with a value its identity may no longer read.remove: the file goes at the next write; it comes back when the secret is readable again.
Replicas share their identity’s limits. Rate limits and the budget of denied requests are per identity, per server (see operations): the replicas of a deployment with one identity share them. The long backoff is what keeps fifty replicas with a path they may not read from using up the shared budget of denials, after which the server would refuse their allowed reads too (and none would finish its first render). A rollout with a missing grant therefore costs one denied read per replica per backoff step.
Metrics
Section titled “Metrics”[metrics] chooses how the agent’s metrics leave it, as the server’s do:
OTLP, Prometheus (plaintext, 127.0.0.1:9465 by default) or none. Its
instruments (rounds, calls, secrets by state, the last success, the
certificate’s expiry), what to alert on, a PodMonitor for sidecars and a
Grafana dashboard: monitoring.
Kubernetes
Section titled “Kubernetes”The image is a release’s, ghcr.io/ferritor/ferritor-agent:<version>,
or your own, built with the repository’s Dockerfile (docker build --target agent, see development);
below it’s registry.example/ferritor-agent.
spec: securityContext: fsGroup: 2000 # the files' group, for the application volumes: - name: secrets emptyDir: medium: Memory # tmpfs: the values never reach a disk sizeLimit: 1Mi - name: ferritor-identity projected: # workload identity: a token for ferritor, rotated by the kubelet sources: - serviceAccountToken: audience: ferritor expirationSeconds: 3600 path: token - name: ferritor-agent-config configMap: name: app-ferritor-agent initContainers: - name: ferritor-agent-once # the files exist before the application starts image: registry.example/ferritor-agent args: ["once", "--config", "/etc/ferritor-agent/app.toml"] volumeMounts: &agent-mounts - { name: secrets, mountPath: /run/secrets/app } - { name: ferritor-identity, mountPath: /var/run/ferritor-identity, readOnly: true } - { name: ferritor-agent-config, mountPath: /etc/ferritor-agent, readOnly: true } - name: ferritor-agent # a native sidecar (Kubernetes 1.29+): runs alongside image: registry.example/ferritor-agent restartPolicy: Always args: ["run", "--config", "/etc/ferritor-agent/app.toml"] volumeMounts: *agent-mounts containers: - name: app volumeMounts: - { name: secrets, mountPath: /run/secrets/app, readOnly: true }- The secrets volume is the agent’s to write. The application mounts
it
readOnly: true, and no other container mounts it writable: anemptyDiris created writable by everyone in the pod (0777), so the mount is what keeps them out (see “Only the agent may write the directory”, above). - The token is mounted into the agent only, never the application: a
compromised application has the values it was given, not the means to
fetch more. Its identity’s policies should grant exactly what the agent
renders. The agent’s config then has
token_file = "/var/run/ferritor-identity/token"andexchange, notcertandkey(workload identity; the identity is the service account’s, through the issuer’s mapping). - An edited ConfigMap reaches the agent within the kubelet’s sync
(a minute or so) and is reloaded, unless it’s
mounted with
subPath, which never updates. - Or a certificate from files (cert-manager, say): mount its Secret at
the same place, into the agent only, and set
certandkey. Renewed in place, it’s picked up at the next round. - One identity per deployment is usual: its replicas share it, and its limits per server (above). One per pod if each replica must be told apart in the audit log.
- Kubernetes nodes usually run without swap; a memory-backed
emptyDiris tmpfs, whose pages could otherwise be swapped out.
systemd
Section titled “systemd”[Unit]Description=ferritor-agent for appAfter=network-online.targetWants=network-online.target
[Service]ExecStartPre=/usr/local/bin/ferritor-agent once --config /etc/ferritor-agent/app.tomlExecStart=/usr/local/bin/ferritor-agent run --config /etc/ferritor-agent/app.tomlUser=ferritor-agentGroup=app # the application's group reads the filesRuntimeDirectory=secrets/app # /run/secrets/app, a tmpfs, removed on stopRuntimeDirectoryMode=0750Restart=on-failure
[Install]WantedBy=multi-user.targetOrder the application After=app-secrets.service with Requires=, so it
starts once the first set is written (ExecStartPre holds the unit back
until then). The directory is owned by the agent’s user, mode 0750: the
application’s group reads it and can’t write it. Never run the agent and
the application as the same user, which would let the application write
the directory (and signal or read the agent, undumpable or not, as its
own user can). The no-swap and hardening advice for the server
(production) applies here too: /run is tmpfs,
whose pages can be swapped out on a host with swap.
Windows
Section titled “Windows”The agent runs on Windows Server too, as a service, with the same configuration and the same directory, and Windows’ own mechanisms in place of the Unix ones: Agent on Windows Server.
Security
Section titled “Security”- The files are the secret now. Whoever can read them (the application’s user or group, root, the node’s or host’s administrators) has the values; the audit log records the agent’s reads, not the application’s use of the files.
- Revoking access doesn’t take back a value already delivered. With
on_revoked = "keep", the application keeps a value its identity may no longer read for as long as it runs. To cut a workload off: rotate the secret itself (the old value stops working where it’s checked), restart the workload, or useon_revoked = "remove". - In memory: the agent’s own copies of a value are wiped when dropped; the gRPC and TLS layers’ buffers aren’t (see security, gap 3).
- On Windows the files are on a disk (there’s no memory-backed
directory): they outlive a reboot and the agent, and a stolen disk has
them unless it’s encrypted (BitLocker). Its process and threads are
locked against its own account, but not against administrators with
SeDebugPrivilegeor SYSTEM, and nothing stops Windows Error Reporting writing a dump if it’s configured to (LocalDumps, off by default). - Environment variables are less private than files (
exec). On Linux the command’s environment is readable through/proc/<pid>/environby its own user and root (the agent can’t make its child undumpable: that ends atexec), its children inherit it unless it clears them, and crash reporters, debug pages and logs of the environment show it. Starting the command also copies the values into buffers of the agent’s that it can’t wipe (Rust’s standard process spawning), freed but not overwritten. Use them only for an application that can’t read files. - The agent’s certificate grants what its identity’s policies grant; keep them exact. From files, it’s in the agent’s container (in Kubernetes, a Secret mounted there, and so in etcd). Exchanged, only the token is: the key is generated in the agent and never leaves its memory, and the certificate lives an hour.
Not yet
Section titled “Not yet”execon Windows: Windows has no SIGTERM to stop a command gracefully, and starting one with a new environment needs the process lock’s own path (ferritor-winsec): Linux and Unix only for now.- Metrics: the status file and the logs are what there is.