Deploying with Podman Quadlet
deploy/quadlet/ runs MailFathom and PostgreSQL
as rootless systemd units under Podman. It exists for one reason: a Quadlet .container file is a systemd unit
source, so a container started from one takes credentials the way the native installation does — LoadCredentialEncrypted=,
material that is ciphertext at rest, and a systemd-credential: reference that resolves inside the container with no
code change.
This is an alternative to Docker Compose, not a replacement for it.
deploy/compose/compose.yaml is unchanged, still runs under podman compose, and stays the recommended first
installation. Nothing here is required to keep that deployment working, and the two are not run side by side on one
machine: they publish the same two ports and would contend for them.
When to choose it, and when not
Choose the Quadlet when the credentials matter more than the convenience: a host where secret material must not sit on disk in plaintext, where the deployment already lives in systemd beside other units, or where the core-dump and resource bounds want to be unit properties rather than container flags.
Stay on Compose when you want one command to bring a stack up, when the host has Docker rather than Podman, when you are installing MailFathom for the first time, or when the host's systemd is older than 258 and encryption at rest was the reason you were reading this page at all. The Compose deployment does everything this one does except the credential path and the unit-level bounds, and it does it with less to arrange.
| Compose | Quadlet | |
|---|---|---|
| Secret material at rest | A plaintext file the host permissions protect | Ciphertext bound to this machine, decrypted at unit start into memory the kernel keeps out of swap where it can |
| Who may read a secret | Any process that can traverse the mount | The unit's own user, from a directory systemd creates and removes with the unit |
| Core-dump and resource bounds | deploy.resources, and a --ulimit you pass |
LimitCORE=, MemoryMax=, CPUQuota= on the unit, plus Ulimit= inside it |
| Ordering and readiness | depends_on: service_healthy, within one up |
Requires=/After= against a unit that is not started until its health check passes |
| Restart, logs, status | restart:, docker compose logs |
Restart=, journalctl --user -u, systemctl --user status |
| File modes on what is mounted | Load-bearing, and a wrong umask stops the deployment starting |
Not a concern: the container's account is you |
| Engines | Docker and Podman | Podman only |
| Rootless or root | Either | Rootless only — UserNS=keep-id is not supported for a root container |
| Building from a checkout | docker compose up --build |
No. It runs a published release image |
| Nightly builds | compose.nightly.yaml |
No overlay; edit Image= deliberately |
| Bringing it up | One command | Five unit files, systemctl --user per service; each optional service is one or two more |
What it needs
- Podman 5.0 or later. Quadlet itself arrived in 4.4, but two keys these units depend on did not:
Notify=healthy, which is what makes the database's readiness a real ordering rather than an approximation of one, andUlimit=, which is the core-dump bound inside the container. Both landed in 5.0.podman --version. - systemd 258 or later, for the credential path. A per-user service manager could not decrypt a user-scoped
credential before 258; an older one fails the unit at its credentials step with
Failed to determine local credential key: Permission deniedbefore Podman is ever executed. What an older systemd leaves you is the fallback.systemctl --version. - A rootless user with subordinate id ranges, which every distribution allocates on user creation —
/etc/subuidand/etc/subgidmust both carry a line for the account.UserNS=keep-idconsumes the whole of that range. - Lingering enabled for that user, so the per-user service manager runs without a login session:
loginctl enable-linger "$USER". Without it the deployment stops when you log out. - cgroup v2, so
MemoryMax=andCPUQuota=on a user unit reach the container. Every current distribution defaults to it. - Ports at 1024 or above. Rootless Podman publishes nothing below that until
net.ipv4.ip_unprivileged_port_startallows it; the units publish 8080 and 8081, and what meets the limit is a reverse proxy terminating TLS on 443 in front of MailFathom rather than MailFathom itself.
What SELinux costs, and what to do about it
A container reads a bind-mounted host file only when that file carries the container_file_t SELinux label, and
systemd labels $CREDENTIALS_DIRECTORY with its own type instead. On a host where SELinux is enforcing — the Red Hat
family — a container that mounts the directory therefore mounts it successfully and is denied the moment it reads.
systemd has no setting for the label and
declined to add one, on the position that a policy which denies a
service its own credentials is the thing to fix.
The units ask Podman to relabel instead: Volume=%d:/etc/mailfathom/credentials:ro,Z gives the credential files a
private container label for the life of the container. That request needs somewhere to write, which is the second
reason these units are user units rather than system ones — the system service manager mounts the credentials
directory read-only, so the relabel fails there with lsetxattr … read-only file system and so does a chcon in an
ExecStartPre=. On a host where SELinux is not enforcing the Z does nothing at all and none of this applies.
If the relabel is refused on your host, two things reach the credential and one of them is not worth taking:
SecurityLabelDisable=trueon the container. It works, and it turns off SELinux label separation for the entire container rather than for the one file that needed it — trading confinement of every path the container touches for confidentiality of one credential. MailFathom does not ship it and does not recommend it. If you set it anyway, set it onmailfathom.containeralone, never on the database, and write down why.- Stay on
file:references for that host, which is what the Compose deployment does: material in a directory you permission, mounted read-only. You give up encryption at rest and keep everything else the Quadlet offers — the unit-level bounds, the ordering, the journal. That is the recommended answer, and credentials is the shape to copy.
Before the first start
Everything the deployment reads lives under your home directory. Nothing is read from the repository at run time.
mkdir -p ~/.config/containers/systemd
mkdir -p ~/.config/mailfathom/config ~/.config/mailfathom/postgres-init
mkdir -p ~/.config/credstore.encrypted
chmod 700 ~/.config/credstore.encrypted
~/.config/credstore.encrypted/ is systemd's own location for encrypted credentials, which is why it is used here
rather than a directory of MailFathom's. The 0700 is ordinary hygiene rather than the protection: what protects the
material is that each file is ciphertext.
The unit sources
cp deploy/quadlet/mailfathom.container deploy/quadlet/mailfathom-postgres.container \
deploy/quadlet/*.network deploy/quadlet/mailfathom-postgres.volume ~/.config/containers/systemd/
cp deploy/quadlet/config/10-mailfathom.json.example ~/.config/mailfathom/config/10-mailfathom.json
cp deploy/compose/postgres/10-create-mailfathom-database.sh ~/.config/mailfathom/postgres-init/
deploy/quadlet/config/10-mailfathom.yaml.example holds the same configuration in YAML; copy it to
~/.config/mailfathom/config/10-mailfathom.yaml instead of the JSON one if you prefer that format, and never both —
two names differing only by extension stop the host. JSON and YAML states what
a YAML file may not use.
The .container files and the one .volume are named rather than globbed because there are four more container units
and a second volume, and those are the parts of this directory that are optional: mailfathom-presidio.container,
mailfathom-spamassassin.container, mailfathom-valkey.container, and mailfathom-silo.container with
mailfathom-silo.volume beside it. Copying one is half of switching its feature on, and a deployment that wants none
never copies any. See Personal-data scanning, Spam scanning,
Running an object store beside MailFathom, and
The signal backplane below.
The last line is not a mistake. The database initialization script is the Compose deployment's, reused rather than
forked, which is why the database container mounts its credentials at /run/secrets: that is the path the script
already reads. One file describes how the role, the database, and the vector extension are created, and both shapes
meet it. Keep its executable bit — cp preserves it under an ordinary umask — because the image's entrypoint
executes a script in that directory that carries the bit and sources one that does not.
Both units assert those two files rather than the directories holding them, and it is worth knowing why before a
start fails naming one. Podman creates a missing bind source as an empty directory instead of refusing, and the mkdir
above creates both directories a step earlier, so a skipped or mistyped cp leaves something that exists and is empty.
An empty postgres-init initializes a database with no mailfathom role and then reports healthy, and an empty
config starts MailFathom with synchronization off and no account. Neither says why, which is what the assertions are
for: AssertFileIsExecutable= on the initialization script, and AssertPathExistsGlob= on *.json, *.yaml, and *.yml in
the configuration directory, any one of which satisfies it — the latter also catching the directory that holds only a
tracked .example, which MailFathom does not read.
Then edit ~/.config/containers/systemd/mailfathom.container and replace <version> in Image= with the release you
are installing. The placeholder is invalid on purpose, so an unedited unit fails with an unparseable image reference
rather than pulling whatever a moving tag points at today.
The credentials
Each one is encrypted once, under the name the configuration references. That name appears in three places and is one
decision: the --name= below, the credential id on the LoadCredentialEncrypted= line in the unit, and the
systemd-credential: reference in the configuration. systemd authenticates the name, so a mismatch fails the unit with
Name in credential doesn't match expectations rather than handing over the wrong material.
openssl rand -base64 33 | tr -d '\n' \
| systemd-creds --user encrypt --name=postgres-superuser-password - \
~/.config/credstore.encrypted/postgres-superuser-password
openssl rand -base64 33 | tr -d '\n' \
| systemd-creds --user encrypt --name=mailfathom-database-password - \
~/.config/credstore.encrypted/mailfathom-database-password
systemd-ask-password -n \
| systemd-creds --user encrypt --name=imap-primary-password - \
~/.config/credstore.encrypted/imap-primary-password
The mailbox password arrives through systemd-ask-password -n so that it is neither a shell-history entry nor a file
you have to remember to delete. -n is what keeps a trailing newline out of the material.
No credential is encrypted here for the administrative endpoint either. The first start records
the default administrator, admin, with the password
MAILFATHOM_ADMIN_PASSWORD carries, and mailfathom.container sets it to admin — safe only while that port stays on
loopback. Edit that line before the first start to give it another; the value is read on the first start alone, and any
value but admin has to meet the password policy — twelve characters at least — or the start stops and says so. Every
start warns while admin still signs in with the shipped value.
No credential is provisioned here for the MCP endpoint. What a client presents there resolves a record beside the user
whose mail it reaches, so the key is minted by the running deployment with
mfctl credential create rather than encrypted into this store — nothing on this
host holds it, and the configuration names only which methods the endpoint accepts.
The mailbox password above is encrypted here all the same, because the record that will reference it is not a
credential store: a declaration carries a systemd-credential: reference exactly as a configuration file would, and
recording the mailbox below is what writes it.
Each unit reaches only the credentials it lists, which is what the two LoadCredentialEncrypted= lines in
mailfathom-postgres.container and the three in mailfathom.container are: a grant rather than a manifest. The
database superuser password is on the first list and not the second, so it is never on a path MailFathom can read —
the same property the Compose deployment gets by keeping those two credentials out of the mounted secrets directory.
--user is required and is not a convenience: a system-scoped credential cannot be decrypted by a per-user service
manager at all. It also narrows the key — the user's uid, user name, and the machine id are folded into it — so a
credential encrypted for one account does not open for another on the same host. --with-key=null is refused outright
in this mode (selected key not available in --uid= scoped mode, refusing), so a user-scoped credential is always
bound to the machine.
The command reaches the key through a system service on /run/systemd/io.systemd.Credentials, which is what lets an
unprivileged user encrypt against material it cannot read: the host key lives in /var/lib/systemd/credential.secret,
is root-only, and is generated by that service the first time anything asks for one.
Secret provisioning states what --with-key=auto
selects and what each choice binds the file to.
A mailbox that authenticates with OAuth needs one credential more: the data-encryption key its refresh token is sealed under. That one is generated to a length rather than to a strength, and startup refuses any other:
openssl rand -base64 32 \
| systemd-creds --user encrypt --name=mailfathom-data-key - \
~/.config/credstore.encrypted/mailfathom-data-key
That is -base64 32, never the -base64 33 above it — the material has to decode to exactly 32 bytes, which is what
AES-256 takes. Uncomment the matching LoadCredentialEncrypted= line in mailfathom.container and the
DataEncryption block in the configuration together with it. Back up the base64 the command printed, with the
database, and never the .cred file instead: the sealed file opens on this machine and on no other, so a database
restored beside a copy carried off a host that no longer exists restores nothing that was sealed.
The data-encryption key covers rotation and what the ring is for, and
what an encrypted credential is bound to states the
binding in full — including that a firmware update does not invalidate the credential, and which flag makes the TPM2
chip a requirement rather than a preference.
Adding an account later is two lines rather than one: the credential, and a LoadCredentialEncrypted= line in
mailfathom.container naming it. That the grant is explicit is the point — the unit reaches exactly the credentials it
lists and nothing else in the store.
The configuration
~/.config/mailfathom/config/10-mailfathom.json is ordinary configuration, layered under the unit's environment block.
Read configuration sources for the precedence and
the configuration reference for every key. The database is configured by the unit rather
than by this file, so it is deliberately absent from the example — and so is the mailbox, which belongs to a user's
record rather than to any configuration source.
The example enables the administrative endpoint, on port 8090 accepting a password and an API key, because both of
the acts this deployment still needs go through it: declaring the mailbox it reads, and minting the key an MCP client
presents. mailfathom.container publishes that port on loopback.
The administrative endpoint is the rest of what it serves.
Starting
loginctl enable-linger "$USER"
systemctl --user daemon-reload # regenerates the units from the Quadlet sources
systemctl --user start mailfathom-postgres.service # creates the role, the database, and the vector extension
# apply the schema — see below
systemctl --user start mailfathom.service
systemctl --user daemon-reload is what turns the .container, .network, and .volume files into services, and it
is needed after every edit to one of them. Quadlet units are generated, so systemctl --user enable does not apply
to them; the [Install] WantedBy=default.target in each file is what starts them at boot once lingering is on.
The middle step is separate on purpose, and nothing in this deployment performs it. MailFathom verifies the schema and refuses to serve against one it does not recognize, so starting the service after a version change tells you a migration is outstanding rather than silently applying one:
MailFathom.Application.Persistence.DatabaseSchemaOutOfDateException: The database has not applied 1 migration(s) this
build defines: 20260731132336_Initial.
The step is mailfathom-schema-<version>.sql, attached to the release you are installing. The database publishes no
port and both credentials are already inside its container, so the shortest route is to run psql there and hand it the
script on standard input, which also keeps the credential off a command line:
podman exec --interactive mailfathom-postgres sh -c \
'PGPASSWORD="$(cat /run/secrets/mailfathom-database-password)" exec psql \
--username "$MAILFATHOM_DATABASE_ROLE" --dbname "$MAILFATHOM_DATABASE" --set ON_ERROR_STOP=on' \
< 'mailfathom-schema-<version>.sql'
As mailfathom, never as postgres. Read the SQL before applying it and take a backup first;
applying the database schema states the privileges it needs, the locks it takes, why the role
that runs it becomes the user of everything it creates, and what each startup failure means.
Recording the mailbox
The started deployment serves no user, and reads no mailbox. Who it serves and which mailboxes it reads are rows it keeps rather than settings it reads, so each is recorded over the administrative endpoint enabled above, signed in as the default administrator — then change its password:
mfctl login --endpoint http://127.0.0.1:8090 --mode password
mfctl credential list
mfctl credential rotate --method password --id <its credential> --username admin
mfctl user add --display-name Alex
mfctl account add --from-file mailbox.json
mailbox.json is the JSON object one mail account is declared as — the object the example configuration's comments
show, systemd-credential: reference and all, so the mailbox password encrypted into the store above is what it names.
The mailbox is served from the moment the write commits, without restarting the unit. mfctl account add names
no user, because the deployment then holds exactly one; once mfctl user add records a second person, --user says
whom the account is created for.
Getting started § write down the mailbox is what goes in the
file. Recording the person assigns them no role, so they reach no tool until they hold Mail user —
getting started § record the mailbox gives the mfctl assignment add
command that assigns it.
Checking it
systemctl --user status mailfathom-postgres.service mailfathom.service
curl -fsS http://127.0.0.1:8081/started # has it finished coming up
curl -fsS http://127.0.0.1:8081/health # readiness, including the database
curl -fsS http://127.0.0.1:8081/alive # liveness, the process alone
journalctl --user -u mailfathom.service -f
The probes answer on 8081, not on the port the MCP endpoint is served on, and they carry no credential — so which address their port is published on is what controls who may ask them. The health endpoints states what each one consults and how to move or turn off the listener.
The MailFathom container declares no health check: its image carries no shell and no HTTP client for one to run in, so
the endpoints above are asked from outside. The database container does declare one, and its unit is not considered
started until it passes — which is what makes Requires=mailfathom-postgres.service on the MailFathom unit an ordering
against a database that answers rather than against a container that exists.
The MCP endpoint answers at /mcp and is off until the configuration enables it. Read
the MCP endpoint before you do; an enabled endpoint must state how it is authenticated, and there is
no default.
What an older systemd leaves you
Below systemd 258 the encrypted path is unavailable and the unit fails before Podman runs. Everything else in this
deployment still works, and LoadCredential= is what replaces the encrypted line. The material goes in
~/.config/credstore/ — systemd's plain-credential location, the one beside the encrypted store used above — and each
line names it by absolute path for the same reason the encrypted ones do, so a missing file fails the unit:
mkdir -p ~/.config/credstore
chmod 700 ~/.config/credstore
systemd-ask-password -n > ~/.config/credstore/imap-primary-password
chmod 400 ~/.config/credstore/imap-primary-password
[Service]
LoadCredential=imap-primary-password:%h/.config/credstore/imap-primary-password
What you keep is most of what the shape was for: the material is copied into a per-unit directory readable by your
account alone, kept out of swap where the platform permits, and removed with the unit — and every
systemd-credential: reference resolves unchanged. What you give up is encryption at rest, so the source file is a
plaintext file the host's permissions protect, exactly as under Compose. The 0700 and the 0400 above are that
protection rather than hygiene here, which is the difference from the encrypted store; keep the file out of any backup
that the database's own backup does not already cover.
Upgrading
Back up the database, apply the new release's schema artifact, then move the image. That order is the one with no window in which nothing serves: the new image refuses to start against a schema behind it, and the running one keeps serving against a schema ahead of it.
podman exec --interactive mailfathom-postgres sh -c \
'PGPASSWORD="$(cat /run/secrets/mailfathom-database-password)" exec psql \
--username "$MAILFATHOM_DATABASE_ROLE" --dbname "$MAILFATHOM_DATABASE" --set ON_ERROR_STOP=on' \
< 'mailfathom-schema-<version>.sql' # the version being upgraded to
$EDITOR ~/.config/containers/systemd/mailfathom.container # Image=, to the new version
systemctl --user daemon-reload
systemctl --user restart mailfathom.service
Rolling back is the same sequence with the previous image. A schema change is not rolled back by it; rolling back states when restoring the database is necessary and when rolling only the image back is enough.
Nothing here moves an image on its own. AutoUpdate= is deliberately absent from both units, because an upgrade has a
schema step in front of it and is a decision rather than a background task.
Upgrading a deployment whose volume was written by PostgreSQL 17 is the same dump-and-restore this deployment's
database image needs anywhere, and
the Compose page describes it in full — including
the two flags that keep the restore clean, which are what separates a failed migration from one that merely reports an
error after the rows are already in. Read the sequence there and substitute the commands: systemctl --user stop mailfathom.service mailfathom-postgres.service for docker compose down, podman run, podman exec, and
podman volume rm for their Docker equivalents, and systemctl --user start mailfathom-postgres.service for
docker compose up -d postgres. The container is mailfathom-postgres and the volume is mailfathom-postgres-data.
Backup, and what survives removal
The synchronized mail lives in mailfathom-postgres-data, a named volume nothing in this deployment removes.
podman exec mailfathom-postgres \
pg_dump --username mailfathom --format custom mailfathom > mailfathom-$(date +%F).dump
podman exec --interactive mailfathom-postgres \
pg_restore --username mailfathom --dbname mailfathom --clean --if-exists < mailfathom-2026-08-12.dump
Neither passes a password, because both reach the server over its Unix socket from inside the container, where the
image's own initdb left local connections trusted.
Stopping the units leaves the volume. Removing it is podman volume rm mailfathom-postgres-data, an explicit act,
because rebuilding it costs a full IMAP resynchronization — and everything that is not in the mailbox, the answering
audit trail and the embeddings, is regenerated rather than refetched.
With the ContentStorage lines uncommented, that dump is only half of it. The content rows point at objects in the
bucket by a locator nothing recomputes, so a dump alone restores a database naming objects it does not carry. Back the
bucket up beside it — everything beneath KeyPrefix, or the whole bucket where MailFathom has it to itself, with your
provider's own tooling, because nothing here takes a bucket backup — and restore the database first, then the
bucket. In that order the window between them is a database pointing at objects not back yet, which reads as content
temporarily unavailable; the other order leaves objects nothing points at, and the reclamation sweep is entitled to
delete those once they are older than MinimumObjectAge, so restoring the bucket first can destroy part of what you
are restoring. A row whose object is missing is not a corrupt deployment: that message's content reports as unavailable
and names itself, every other message keeps working, and
when the local copy is unusable states what a client
sees.
A store mailfathom-silo.container runs is no different in that order, and the bucket backup is a copy out of it rather
than a provider's console. It is the S3 API that answers, so the same client does both directions, and copying
mailfathom-silo-data's files underneath a running server is not a backup: the pool has its own metadata in
.minio.sys, and a copy taken while the server is writing is a copy of neither state. The scoped access key is enough
for both directions, which is why the root credential does not appear here.
mkdir -p mailfathom-content-backup
# The scoped key, decrypted back out of the credential store the provisioning step wrote it to rather than read from
# shell variables, which belonged to that session and are gone by the time a backup runs.
access_key_id="$(systemd-creds --user decrypt \
~/.config/credstore.encrypted/mailfathom-object-storage-access-key-id -)"
secret_access_key="$(systemd-creds --user decrypt \
~/.config/credstore.encrypted/mailfathom-object-storage-secret-access-key -)"
# Out. A throwaway container on the same internal network, with the destination bind-mounted.
podman run --rm --interactive \
--network mailfathom-backend \
--volume "$PWD/mailfathom-content-backup:/backup:Z" \
--entrypoint sh \
docker.io/pgsty/silo:RELEASE.2026-09-16T00-00-00Z -s "$access_key_id" "$secret_access_key" <<'BACKUP'
set -eu
mcli --insecure alias set store https://mailfathom-silo:9000 "$1" "$2"
mcli --insecure mirror --remove store/mailfathom-content /backup
BACKUP
Restoring is the same run with the two paths swapped and without --remove, which there would delete from the store
rather than from the copy. --insecure because the certificate is one you issued and this client carries only the
public roots the image ships — the name is right, the authority is one nothing here was told about, and it is MailFathom
rather than a backup script that has to validate it.
Stopping the units leaves that volume as it leaves the database's. Removing it is
podman volume rm mailfathom-silo-data, and it costs more than the database's: a lost payload is not a
resynchronization, because the database still holds a row for every object and each of those then reads as content
unavailable.
Stopping them can also report rootless netns: kill network process: permission denied, which is the host's AppArmor
policy refusing a signal rather than a unit that failed to stop. These containers are torn down through the same
rootless network namespace as the Compose deployment's and end on the same step, so
the error a rootless-Podman teardown reports
holds here unchanged.
Uninstalling
# The optional units only where they were installed; stopping MailFathom does not stop any of them, because the
# ordering runs the other way.
systemctl --user stop mailfathom.service \
mailfathom-presidio.service mailfathom-spamassassin.service mailfathom-silo.service \
mailfathom-valkey.service mailfathom-postgres.service
rm ~/.config/containers/systemd/mailfathom*.{container,network,volume}
systemctl --user daemon-reload
podman volume rm mailfathom-postgres-data # destroys the mail
podman volume rm mailfathom-silo-data # destroys the payloads, where the object store was installed
rm -r ~/.config/mailfathom ~/.config/credstore.encrypted
loginctl disable-linger "$USER" # only if nothing else of yours runs as a user service
Removing one of those two volumes and not the other leaves the remaining one holding half of what a message is.
The client
The client travels inside the image, so serving it is two lines in the unit rather than a second container. They
are commented out in ~/.config/containers/systemd/mailfathom.container:
Environment=ClientEndpoint__Application__Enabled=true
Environment=ClientEndpoint__Application__AllowClearText=true
The second is a statement about this deployment rather than a second switch. MailFathom refuses to serve a page over a
clear-text socket unless something in front of it terminates TLS — the page, and every token a browser then sends back,
cross whatever hop is between it and the person — and this container speaks plain HTTP by design, published on loopback
for a reverse proxy. Uncommenting it says that proxy exists; do not, while PublishPort names an address other than
loopback with nothing listening in front of it.
ClientEndpoint:Enabled has to be on in the configuration directory beside them, because the page is served on that
surface's listeners and calls its routes. The page turned on while the endpoint is off is refused at startup,
naming both; the reverse is an ordinary deployment and starts.
Then systemctl --user daemon-reload and systemctl --user restart mailfathom, as with any other edit here.
Serving the client from the deployment states what the
page is and what a browser still has to present.
Personal-data scanning
Quadlet has no equivalent of Compose's profiles, so how this feature is switched off is that its unit is not installed —
and off is the default. A deployment that wants secrets only copies the files above and never
mailfathom-presidio.container, and then no image is pulled, no container exists, and none of its two gigabytes is held.
The personal-data scanner records what the feature
hides and what each category costs retrieval.
Switching it on is three edits, and each half alone is a deployment that does not work:
cp deploy/quadlet/mailfathom-presidio.container ~/.config/containers/systemd/
Then in ~/.config/containers/systemd/mailfathom.container, uncomment the two ordering lines in [Unit] and the four
Environment= lines for SensitiveContent, and systemctl --user daemon-reload. The analyzer unit declares
Notify=healthy exactly as the database unit does, so that ordering waits for an analyzer that answers rather than a
container that exists. Nothing breaks without it — MailFathom starts either way and reports itself unready until the
analyzer answers — but the analyzer loads a language model before it serves anything, and ordering the two is what keeps
that interval out of the application's log and off its readiness probe. TimeoutStartSec=300 is what allows for that
load. Nothing else in the start sequence changes: the uncommented Requires= is what pulls the analyzer in when
mailfathom.service starts, and systemctl --user status mailfathom-presidio.service is where its own health check is
read while the model loads.
To use an analyzer you already operate, copy no unit and point the endpoint line at its address. Keep that address inside your own network: the point of scanning is that content is inspected before it leaves the trust boundary, and the feature page states what pointing it outside gives up.
The analyzer unit is the shortest file in the directory, and what it does not have is the point of it: no credentials, no
volumes, no configuration, and no PublishPort=. It receives request bodies and answers offsets, so it is attached to
mailfathom-backend.network alone and reachable from MailFathom and nothing else. It needs no UserNS=keep-id either,
because nothing in it reads a file you own.
The language lines are the ones that need the image behind them. The commented
SensitiveContent__PersonalDataAnalyzer__Languages__0 line names en and a __1 line beside it names pl, because
MailFathom takes a list and a list reaches .NET configuration as indexed keys numbered from zero without a gap — a gap
ends the bound list at it and drops everything after. The pinned image is built with an English model and an English
recognizer registry, so uncommenting the second line without an image behind it leaves MailFathom permanently unready
rather than scanning in that language: the analyzer answers that it recognises nothing for it, and the readiness log
names the language. Running the analyzer in a second language means an image of your own, named on the Image= line of
the copied analyzer unit — the analyzer's languages records what that takes and
which identifiers each language reaches. Each configured language is also one more analyzer request inside a scan's
single budget, which is why at most eight are accepted.
Spam scanning
The same shape, and the same default: mailfathom-spamassassin.container is a file you either copy or do not, and not
copying it is how the feature is off. Spam classification records what a
classification holds and what the scanner adds.
cp deploy/quadlet/mailfathom-spamassassin.container ~/.config/containers/systemd/
Then in ~/.config/containers/systemd/mailfathom.container, uncomment the two ordering lines in [Unit] and the four
Environment= lines for SpamClassification, and systemctl --user daemon-reload. The unit declares Notify=healthy
like the others, so the ordering waits for a daemon that answers: it compiles its rule corpus before it listens, and
MailFathom refuses to start while nothing answers, which is what TimeoutStartSec=300 allows for.
To use a daemon you already operate, copy no unit and point SpamClassification__Scanner__Host at its address. Keep it
inside your own network: the daemon is sent whole messages unredacted, and the feature page states what pointing it
outside gives up.
The unit has no credentials, no volumes, no configuration, and no PublishPort=, and it needs no UserNS=keep-id
because nothing in it reads a file you own. It is attached to mailfathom-backend.network alone, which is the one place
this deployment differs from the Compose one: with no route out, the daemon cannot fetch the rule updates it tries for on
start and daily afterwards, so its corpus stays whatever the image was built with — which scores today's mail worse than
a fresh one. Add mailfathom-frontend.network to the unit to give it those updates. Either way DNS_CHECKS=0 keeps the
blocklist rules that would send sending addresses and URI host names to third parties switched off.
It is also the one unit here granted a capability back. It binds its port as root and runs every scan as an unprivileged
account, which is what parses the mail, so SETUID and SETGID are added after all capabilities are dropped; without
them the daemon refuses to start.
Storing message content in a bucket
The raw MIME of every message lives in PostgreSQL beside the metadata unless the ContentStorage lines in
mailfathom.container are uncommented. Uncommented, new payloads go into an S3-compatible bucket instead; the metadata,
the indexes, the embeddings, and every job still run through PostgreSQL, so this is a decision about payload bytes and
about nothing else. The endpoint is one you operate or rent, or the one
mailfathom-silo.container starts beside the rest. Either way its bucket
exists before MailFathom writes to it: nothing here creates one.
Switching it on is two edits, and each half alone is a deployment that does not start:
Environment=ContentStorage__Backend=ObjectStorage
Environment=ContentStorage__ObjectStorage__Endpoint=https://objects.example.test
Environment=ContentStorage__ObjectStorage__Bucket=mailfathom-content
Environment=ContentStorage__ObjectStorage__AccessKeyId__Name=mailfathom-object-storage-access-key-id
Environment=ContentStorage__ObjectStorage__AccessKeyId__SecretReference=systemd-credential:mailfathom-object-storage-access-key-id
Environment=ContentStorage__ObjectStorage__SecretAccessKey__Name=mailfathom-object-storage-secret-access-key
Environment=ContentStorage__ObjectStorage__SecretAccessKey__SecretReference=systemd-credential:mailfathom-object-storage-secret-access-key
The other half is the two credentials, which are systemd credentials like the database password rather than files in a
directory, so each needs its own LoadCredentialEncrypted= line in [Service] — both are already there, commented,
beside the ones this unit already grants. Produce them the way the credentials above produces every
other one:
printf %s '<access key id>' \
| systemd-creds --user encrypt --name=mailfathom-object-storage-access-key-id - \
~/.config/credstore.encrypted/mailfathom-object-storage-access-key-id
systemd-ask-password -n \
| systemd-creds --user encrypt --name=mailfathom-object-storage-secret-access-key - \
~/.config/credstore.encrypted/mailfathom-object-storage-secret-access-key
The secret half arrives through systemd-ask-password -n for the reason the mailbox password does — neither a shell
history entry nor a file to remember to delete — and -n is what keeps a trailing newline out of the material. The
identifier is piped with printf %s for the same reason: MailFathom strips one trailing newline when it decodes
material as text, so echo would work too, but a signature derived from a credential with a stray byte in it reaches
you as every request being rejected rather than as a credential it could not read. The access key identifier is a
secret like the secret beside it — it names an identity at the endpoint, and it is one half of what an attacker needs.
Both are read before every request, so re-encrypting one after a rotation at the endpoint takes effect on the next call.
MailFathom refuses to start under this backend without an address, a bucket, and both credentials rather than acquiring
the host's own identity from the environment, and it refuses an endpoint that is not https — a request carries a
signature and, on a write, the message itself. An endpoint you run yourself, whose certificate this host's trust store
does not answer for, takes a third credential and the two TrustAnchor lines; leave both out for a hosted provider,
because an empty reference is a credential MailFathom cannot read rather than an anchor it does not need. No setting
anywhere turns validation off instead — see platform TLS policy.
KeyPrefix is what makes a bucket MailFathom shares with something else safe, and nothing here can check that two
deployments sharing one arranged disjoint prefixes; the reclamation sweep lists beneath that prefix and nowhere else.
The timeouts, the sweep, and the bounds on moving what is already stored are ordinary configuration and belong in the
configuration directory beside the unit —
ContentStorage holds every key, and
where a payload is kept states what a content row records.
Switching is a move, not a setting. These lines decide only where the next write goes: every content row names the store holding its own payload, so uncommenting them moves nothing already stored and commenting them back re-encodes nothing. Carrying what is already in the database into the bucket is an operator's act with its own controls — moving stored content into the bucket is that operation. Until it has run, and after a partial run, this deployment reads from both stores and keeps needing both: pointing it at a bucket it no longer has leaves the unit running and unready rather than the mail unreadable.
Running an object store beside MailFathom
An operator who wants payload bytes out of PostgreSQL and does not already run object storage has nothing to point the
endpoint above at. mailfathom-silo.container is that answer: one Silo container on a
named volume, on the internal network and reachable from nothing outside the host. Silo is PGSTY's maintained fork of
the open-source MinIO server, keeping one release line alive after upstream ended community distribution — the same
image, at the same pin, that the Compose deployment, the Helm chart, and the
integration suite use, so what runs here is the server the S3
adapter was verified against.
One container, one volume, and that is the whole of it. No erasure coding, no second node, no replication, no failover. What it protects against is a container being replaced; a disk that fails takes the payloads with it, which is what makes the backup order the thing standing between this and losing them.
It is optional the way the analyzer and the scanner units are: Quadlet has no equivalent of Compose's profiles, so
switching it on is copying the two files and uncommenting the ContentStorage lines above.
cp deploy/quadlet/mailfathom-silo.container deploy/quadlet/mailfathom-silo.volume \
~/.config/containers/systemd/
The endpoint to name in mailfathom.container is the container's own name on the internal network:
Environment=ContentStorage__ObjectStorage__Endpoint=https://mailfathom-silo:9000
It answers over TLS, and there is no way to run it otherwise. MailFathom refuses a plain http endpoint and
validates what it is presented, with no setting anywhere that turns that off, so the store terminates TLS itself with a
certificate covering mailfathom-silo. No public authority issues one for that, so it is signed by an authority of your
own — and here the TrustAnchor credential is required rather than optional, because nothing in this host's trust store
answers for it.
Four credentials belong to the store rather than to MailFathom, and they are encrypted the way
the credentials above encrypts every other one. The root credential administers the whole server —
it creates buckets, issues access keys, and reads every object — which is why it is granted to mailfathom-silo.service
alone and appears in no LoadCredentialEncrypted= line of mailfathom.container. The certificate is encrypted along
with its key, not because it is secret but because the two are one thing to provision, rotate, and lose together.
printf %s "$(openssl rand -hex 12)" \
| systemd-creds --user encrypt --name=silo-root-access-key-id - \
~/.config/credstore.encrypted/silo-root-access-key-id
printf %s "$(openssl rand -base64 32)" \
| systemd-creds --user encrypt --name=silo-root-secret-access-key - \
~/.config/credstore.encrypted/silo-root-secret-access-key
systemd-creds --user encrypt --name=silo-public.crt /path/to/silo.crt \
~/.config/credstore.encrypted/silo-public.crt
systemd-creds --user encrypt --name=silo-private.key /path/to/silo.key \
~/.config/credstore.encrypted/silo-private.key
The root secret must be at least eight characters, which is the server's own rule. Each is named with an absolute path in the unit rather than by name alone, for the reason every credential here is: a bare name that misses is not fatal, and a store started with neither root credential set would fall back to something nobody chose.
Neither the bucket nor the access key MailFathom presents is created by the store, so both are provisioned once after the unit is healthy, with the management client the image already carries. Until they exist MailFathom reports itself unready rather than storing mail: its startup probe writes and deletes one object of its own, so read permission alone is not enough to become ready.
systemctl --user start mailfathom-silo.service
access_key_id="$(openssl rand -hex 12)"
secret_access_key="$(openssl rand -base64 32)"
podman exec --interactive mailfathom-silo sh -s "$access_key_id" "$secret_access_key" <<'PROVISION'
set -eu
# --insecure throughout: the call is to the container's own loopback address, which the certificate names nowhere. What
# it names is `mailfathom-silo`, and that is the name MailFathom validates.
mcli --insecure alias set store https://127.0.0.1:9000 \
"$(cat /etc/silo/credentials/silo-root-access-key-id)" \
"$(cat /etc/silo/credentials/silo-root-secret-access-key)"
mcli --insecure mb --ignore-existing store/mailfathom-content
# The four operations the adapter performs and nothing else: it lists beneath its prefix to reclaim released objects,
# and it gets, puts, and deletes one object at a time. It never creates a bucket and never touches another one.
cat > /tmp/mailfathom-content.json <<'POLICY'
{
"Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::mailfathom-content" ] },
{ "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject", "s3:DeleteObject" ], "Resource": [ "arn:aws:s3:::mailfathom-content/*" ] }
]
}
POLICY
mcli --insecure admin policy create store mailfathom-content /tmp/mailfathom-content.json
mcli --insecure admin user add store "$1" "$2"
mcli --insecure admin policy attach store mailfathom-content --user "$1"
PROVISION
printf %s "$access_key_id" \
| systemd-creds --user encrypt --name=mailfathom-object-storage-access-key-id - \
~/.config/credstore.encrypted/mailfathom-object-storage-access-key-id
printf %s "$secret_access_key" \
| systemd-creds --user encrypt --name=mailfathom-object-storage-secret-access-key - \
~/.config/credstore.encrypted/mailfathom-object-storage-secret-access-key
The console is not exposed. It is a management interface over every object the store holds — bucket contents, access
keys, the server's own configuration — so it is a second surface onto the mail rather than a convenience, and the unit
sets MINIO_BROWSER=off and publishes no port at all. Turning it on is setting that to on and uncommenting the
PublishPort= line beside it, which is on loopback — because what authenticates at it is the root credential, which is
the whole store rather than the one bucket. Nothing terminates TLS in front of it; the store's certificate names
mailfathom-silo, so a browser reaching it through the loopback mapping will report a name mismatch.
Upgrading it is one edit and one restart, and deliberately not part of a MailFathom upgrade: the two have no version relationship, and doing both at once makes a failure ambiguous. Back the bucket up first — the on-disk format is the server's, and a version that will not start against it leaves the payloads reachable only by going back to the previous tag, which is the same edit in reverse.
$EDITOR ~/.config/containers/systemd/mailfathom-silo.container # Image=docker.io/pgsty/silo:RELEASE.<newer>
systemctl --user daemon-reload
systemctl --user restart mailfathom-silo.service
The store is unreachable while the container is replaced, and MailFathom reports itself unready and stores nothing new
for that window rather than failing a read of what is already in PostgreSQL. Read the upstream release notes between the
two tags before moving one: Silo's release line is a MinIO one, named by timestamp rather than by version. The unit
carries no AutoUpdate=, so nothing moves it for you.
Nothing of Silo is in MailFathom's image or in this repository. The unit names an image your host pulls from PGSTY's
own registry. Silo is AGPL-3.0-or-later, which
THIRD_PARTY_LICENSES.md records
together with the reading it is used under. Its own lifecycle — upgrades, its configuration, its users beyond the one
above — is yours; MailFathom manages none of it.
The signal backplane
The same shape, and the same default: mailfathom-valkey.container is a file you either copy or do not, and not copying
it is how the backplane is off.
On one host it does nothing, and that is the expected state rather than a misconfiguration to fix. A backplane carries a client signal from the instance that raised it to the instances holding the connections that have to hear about it, and this directory runs one MailFathom — so every signal already reaches every connection the deployment holds, and the server relays each one back to the single subscriber that published it. It is here so that this shape offers the same component the chart does, and so that a deployment which expects to move to the chart can provision it before it needs one.
Running more than one MailFathom under Quadlet is not supported, and the reason is this shape rather than the
application. mailfathom.container publishes fixed host ports, so a second unit has nothing to bind; nothing here
balances requests between two of them, holds a client's connection across a restart, or gates one on a readiness probe.
What the application needs above one instance it already has — its coordination is rows in PostgreSQL, and this
backplane — so the chart is where more than one replica is
supported and stated.
SignalBackplane is what the section means, and
the signal channel is what a client does when a signal does not arrive.
Switching it on is a unit and two credentials rather than a switch, because what says a backplane exists is the configuration section itself. Choose one password first: the server's ACL file accepts it and MailFathom's connection string presents it, and they are one decision.
printf 'user default on >%s ~* &* +@all\n' "$password" \
| systemd-creds --user encrypt --name=valkey-acl - \
~/.config/credstore.encrypted/valkey-acl
printf 'mailfathom-valkey:6379,password=%s' "$password" \
| systemd-creds --user encrypt --name=signal-backplane-connection-string - \
~/.config/credstore.encrypted/signal-backplane-connection-string
cp deploy/quadlet/mailfathom-valkey.container ~/.config/containers/systemd/
Then in ~/.config/containers/systemd/mailfathom.container, uncomment the two Environment= lines for
SignalBackplane and the LoadCredentialEncrypted= line naming the connection string, and
systemctl --user daemon-reload.
There is no ordering line to uncomment at the top of that file, which is the one place this unit differs from the other three optional ones. It declares no health check to wait for — a check would have to authenticate, which would put the password in a second place — and nothing has to wait either: MailFathom finishes starting whether or not the endpoint answers, and an instance whose backplane is down serves every screen correctly from the connections it holds itself.
The contract is the protocol rather than the product. MailFathom asks the endpoint for PUBLISH, SUBSCRIBE, and
PSUBSCRIBE and nothing else, so any RESP endpoint serves — Redis, Garnet, Valkey, or a managed equivalent. Valkey is
what this unit starts and what the project pins; it is the default rather than a requirement. To use an endpoint you
already operate, copy no unit, encrypt only the connection string with that
endpoint's own address and password, and leave the ACL file to whoever runs it. Keep that endpoint inside your own
network: what crosses it is which mailbox changed and for whom, which is personal data on its own. The unit here
publishes no port and is attached to mailfathom-backend.network alone, exactly as the database is.
The password arrives as a file, which on this server means an ACL file, and that is the one place this deployment
differs from the chart, where the kubelet expands it into --requirepass out
of a Secret. Podman has no equivalent expansion — it passes a container's arguments through unchanged — so that route
would put the password in the unit file, in podman inspect, and in this host's process list rather than in the
credential store beside every other secret. --aclfile is the one way Valkey reads a credential from a path.
The default user is what a RESP client authenticating with a password alone becomes, and this server holds nothing but
subscriptions, so the line above grants it every key, every channel, and every command.
The unit carries UserNS=keep-id:uid=999,gid=999 for the reason mailfathom.container carries its own number: the
image runs the server as its own unprivileged valkey account, which under the default rootless mapping would be a
subordinate uid belonging to nobody, and the ACL credential is readable by the unit's user alone. It is 999 rather than
MailFathom's 1654 because it is this image's account rather than the .NET base's.
The unit has no volume and nothing to persist: a backplane holds a live subscription rather than a record, so a restart
loses nothing, and a server that kept anything across one would replay a statement whose subject has already moved. Its
scheduled snapshot is switched off on the Exec= line rather than left at the upstream default, which is on.
Rotating the password is a restart, not a reload, and it is two credentials re-encrypted rather than one. The connection string is read once, when a connection is first wanted, and the endpoint parsed out of it — password included — is kept for the life of the process. Rotating the signal backplane's connection string states the order that takes.
Nothing of Valkey is in MailFathom's image or in this repository. The unit names an image your host pulls from
Docker Hub, pinned by the same digest the Compose deployment and the chart carry — Valkey publishes its
release tags beside moving 9, 9.1, and latest ones, so a digest is the only reference that names one artifact.
Valkey is BSD-3-Clause, which
THIRD_PARTY_LICENSES.md records
together with the base image it is built on.
Bounds
Every knob is in the unit file, edited in place; there is no .env equivalent, which is one of the things this shape
trades away. The values the units apply:
| Where | What |
|---|---|
[Service] MemoryMax=, CPUQuota= |
1 GiB and two cores per unit, applied by systemd to the whole cgroup rather than to one container inside it. The analyzer's is 2 GiB, because it holds a language model for the life of the container and below roughly one gigabyte is killed while loading; the spam daemon's is 512 MiB, which holds its compiled rule corpus and a child per scan; the object store keeps the 1 GiB default, because it holds no index in memory and streams what it serves — what it wants is disk, and that is the volume; the backplane server keeps it with one core, because what it covers is that server's hash index and the .NET runtime around it and nothing this deployment stores |
[Service] LimitCORE=0, [Container] Ulimit=core=0 |
No core dump from the process holding decrypted material, or from what it starts |
[Container] StopTimeout=, [Service] TimeoutStopSec= |
60 and 90 seconds, so the host finishes its shutdown drain rather than being killed mid-run |
[Container] Tmpfs=/tmp |
64 MiB, the one writable path the runtime needs on an otherwise read-only root filesystem |
[Container] PublishPort= |
127.0.0.1:8080 for /mcp, 127.0.0.1:8081 for the probes |
Raise StopTimeout= and TimeoutStopSec= together if a deployment configures a longer
MailSynchronization:ShutdownDrainTimeout.
Related
- Secret provisioning — the reference grammar, every deployment shape's mapping, and what a leaked configuration file does and does not expose
- Deploying with Docker Compose — the same stack without the credential path, and the pages
this one deliberately does not repeat: the network boundary, the PostgreSQL 17 upgrade, and what
upanddowndo - Applying the database schema — the release artifact, the privileges it needs, and the three startup failures it answers
- The container image — what is inside it, how it runs, and why it carries no schema tool
- The platform TLS policy — for a mail server whose handshake the container's own OpenSSL refuses; the file is mounted into the container and named in the unit's environment
- Configuration sources, the MCP endpoint, health endpoints