Production deployment

The hardened production profile, deploy/compose.production.yml, step by step: from an empty Linux host to a running deployment that seals with your own key, with backups, monitoring and a plan for rotating every secret.

Pre-release. v0.1.0 is for evaluation and for rehearsing this deployment, not yet for production agreements. Following these steps does not make signatures legally valid or a deployment compliant with any regulation: that depends on your certificates, your processes and your counsel (see the checklist).

Every command and file on this page comes from the repository at the release tag: the profile, deploy/production/ and the checks are versioned with the images. Run them from a checkout of the same tag you deploy. The full runbooks behind each step are in docs/65, Running it.

What the profile gives you

  • Hardened containers. Every service runs as a named non-root user with a read-only root file system, every capability dropped, no-new-privileges, memory, CPU and process limits, no core dumps, bounded logs and a health check. tools/check-deploy.py checks each of these rules over the rendered file on every CI run.
  • Secrets as files. Docker secrets under /run/secrets/, each mounted only into the services that read it; never environment values.
  • TLS between services. PostgreSQL serves TLS 1.3 only and clients verify it (sslmode=verify-full); the object store serves TLS from an internal CA; keyd is mutual TLS.
  • Isolated networks. The database, object store and keyd sit on internal networks with no route out; only the worker reaches the internet (SMTP, timestamp authorities, webhooks).
  • Configuration integrity. keyd and the worker refuse to start when their security settings differ from a recorded manifest.
  • Word conversion in a sandbox. convertd turns Word uploads into PDF in a container with no network, a read-only root and per-document memory, CPU and time limits; the server replicas reach it over a Unix socket (OPENSEAL_CONVERTD_SOCKET, set by the profile). See the configuration reference.
  • Zero-downtime restarts. Two server replicas behind HAProxy, which takes a draining replica out of rotation before it stops.

1. Prepare the host

  • A Linux host on x86-64 with Docker Engine and Compose v2. The images are built for linux/amd64; arm64 hosts run them under emulation or build from source.
  • Memory for the profile's limits, which add up to about 13 GB (PostgreSQL 2 GB, object store 2 GB, two server replicas 2 GB each, worker 4 GB, keyd 512 MB, proxy 256 MB), plus the operating system. Disk for PostgreSQL and the documents, with room to grow.
  • Root on the host, to write the secret files with the right owners.
  • Outbound network for the worker: your SMTP relay, your timestamp authorities, webhook receivers. keyd needs a route to your HSM if it is a network HSM.
  • openssl (to generate secrets), git, and for verifying images cosign 3 and the GitHub CLI.
git clone https://github.com/CasualOffice/openseal /srv/openseal/src
cd /srv/openseal/src
git checkout v0.1.0

2. DNS and TLS

Choose the address people and integrations will use, for example https://sign.example.com, and point its DNS at your edge. TLS to browsers terminates at your own edge proxy or load balancer (TLS 1.2 or later, 1.3 preferred, with HSTS), which forwards to the proxy service on the host's loopback address, port 8080 (OPENSEAL_HTTP_PORT moves it). The server refuses to start with an http:// public URL.

The edge must pass the client's address in X-Forwarded-For (or Forwarded): it goes into the evidence. An example for nginx, to adapt to your edge:

server {
    listen 443 ssl;
    http2 on;
    server_name sign.example.com;
    ssl_certificate     /etc/ssl/sign.example.com/fullchain.pem;
    ssl_certificate_key /etc/ssl/sign.example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
    client_max_body_size 280m;          # one-call envelope create: up to 270 MiB

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_read_timeout 300s;
    }
}

Do not log request paths at the edge: signing links carry bearer tokens in their paths. The profile's own proxy logs no request.

3. Generate the secrets

Run init-secrets.sh once, as root, with an empty directory. It writes the deployment's internal TLS (a private CA, and certificates for PostgreSQL, the object store, keyd and the worker), random passwords, the database URLs, the object store identities, the token signing key, the second-factor key, the password pepper, keyd's allow list and keyd's seal token key, each owned by the one container user that reads it and readable by no one else.

sudo deploy/production/init-secrets.sh /srv/openseal/secrets
init-secrets: wrote /srv/openseal/secrets
init-secrets: move /srv/openseal/secrets/offline/internal-ca.key off this host now
init-secrets: still to add: seal-chain.pem keyd-pkcs11-pin (owner 10001, 0400), trust-anchors.pem, smtp-password (owner 65532, 0400); then record the manifests

Move offline/internal-ca.key to offline storage now; you need it again only to issue a rotated service identity. The internal CA only authenticates the services to each other: never use it for signing documents.

Then add the four files only you have:

FileWhatOwner and mode
seal-chain.pemYour seal certificate and its intermediates (step 4)10001, 0400
keyd-pkcs11-pinThe HSM user PIN for the seal key's token10001, 0400
trust-anchors.pemThe root of your seal certificate and the root of every timestamp authority you use (step 5)readable by 65532
smtp-passwordYour SMTP relay's password (step 6)65532, 0400
cd /srv/openseal/secrets
sudo install -o 10001 -g 10001 -m 0400 ~/seal/seal-chain.pem seal-chain.pem
sudo sh -c 'umask 077; cat > keyd-pkcs11-pin'          # type the PIN, then Ctrl-D
sudo chown 10001:10001 keyd-pkcs11-pin
sudo install -o 65532 -g 65532 -m 0444 ~/seal/trust-anchors.pem trust-anchors.pem
sudo sh -c 'umask 077; cat > smtp-password'            # type the password, then Ctrl-D
sudo chown 65532:65532 smtp-password

How the services read secrets. Every secret setting has a file form: NAME_FILE names a file holding the value, and the profile uses only that form, pointing at /run/secrets/<name> (for example OPENSEAL_DATABASE_URL_FILE=/run/secrets/database-url). Setting both NAME and NAME_FILE is an error (CS-KEY-0005), so a stray environment value can never override the file. docker inspect shows only paths. The configuration reference marks every secret.

4. The seal key in your HSM

The seal is the signature OpenSeal applies to every completed document. Its key never leaves your HSM: keyd signs with it through PKCS#11 and only for the worker, over mutual TLS, recording every signature in its own hash-chained log.

  1. Generate the key in the HSM with your vendor's tools (an EC P-256 or RSA key), and give it a label.

  2. Obtain a document-signing certificate for it from a CA your relying parties trust: for example a member of Adobe's Approved Trust List, so PDF readers show the seal as valid, or a qualified seal certificate where you need eIDAS qualified seals. Put the certificate and its intermediates, leaf first, in seal-chain.pem.

  3. Tell the profile where the library and key are. The directory holding your vendor's PKCS#11 library is mounted read-only into keyd at the same path:

    export OPENSEAL_PKCS11_DIR=/opt/hsm
    export OPENSEAL_PKCS11_MODULE=/opt/hsm/lib/libvendor-pkcs11.so
    export OPENSEAL_PKCS11_TOKEN=openseal
    export OPENSEAL_PKCS11_KEY_LABEL=openseal-seal-2026
    export OPENSEAL_SEAL_NAME="Example Corp"            # the signer name readers show
    export OPENSEAL_SEAL_REASON="Sealed on completion"   # the default
  4. A network HSM needs keyd on a network that routes to the HSM alone. Add it as an external network for keyd only, in an override file beside the profile:

    # compose.hsm.yml: docker compose -f deploy/compose.production.yml -f compose.hsm.yml …
    services:
      keyd:
        networks: [signing, hsm]
    networks:
      hsm: {external: true, name: hsm-net}

Never use a key file in production: keyd refuses one unless OPENSEAL_DEV_INSECURE_KEY=1, and tools/check-deploy.py refuses that switch. Sandbox workspaces need a second key whose certificate says it is not for agreements (OPENSEAL_KEYD_SANDBOX_*); without it their envelopes wait unsealed and the operator is alerted.

5. Timestamp authorities

Every seal carries an RFC 3161 timestamp. List at least two authorities with a service level, tried in order (qualified ones if you need eIDAS qualified time):

export OPENSEAL_TSA_URLS=https://tsa-1.example.net/,https://tsa-2.example.net/

trust-anchors.pem must hold the root of each TSA as well as the root of your seal certificate: CAs and TSAs hand out certificates only up to their issuing CA, and the long-term seal profiles take the root from these anchors when they collect revocation data. Once the platform console is in use, key custodians manage the TSA list there, two people per change; the worker then reads it from the database and uses OPENSEAL_TSA_URLS only while none is configured.

Rehearse with your production TSA before going live: OPENSEAL_INTEROP_NETWORK=1 python3 tools/interop/interop.py check --tsa-url URL --tsa-root ROOT.pem. DigiCert's TSA passed on 2026-11-14. A TSA whose tokens use ESSCertID v1 (SHA-1), such as FreeTSA, is refused with CS-SEAL-0005.

6. Email

The worker sends invitations, reminders and completions through your SMTP relay over STARTTLS (fixed in the profile):

export [email protected]
export OPENSEAL_MAIL_FROM_NAME="Example Corp Signatures"
export OPENSEAL_MAIL_DOMAIN=sign.example.com
export [email protected]          # named in every email
export OPENSEAL_SMTP_HOST=smtp.example.net
export OPENSEAL_SMTP_PORT=587
export OPENSEAL_SMTP_USER=openseal               # the password is the smtp-password file

Publish SPF, DKIM and DMARC (p=quarantine or stricter) for the sending domain, and handle bounces. Text-message and voice codes need an HTTPS gateway you run or rent (OPENSEAL_SMS_GATEWAY_URL, OPENSEAL_SMS_GATEWAY_SECRET); unset, they are never sent.

7. PostgreSQL and object storage

The profile runs PostgreSQL 17 and a SeaweedFS object store on internal networks, both over TLS from the internal CA, with their data in the postgres and s3 volumes. Put those volumes on encrypted disks. The application connects as a role bound by row-level security that cannot update or delete audit events; migrations run as the schema owner, separately.

  • Database: keep point-in-time recovery (WAL archiving) as well as the backups of step 11. For a managed PostgreSQL (15 or later), point the database-url and migrate-database-url files at it with sslmode=verify-full.
  • Documents: blobs are content-addressed and written once. On a managed S3-compatible store, turn on versioning and encryption, and Object Lock in compliance mode for regulated tenants; set OPENSEAL_S3_ENDPOINT, OPENSEAL_S3_BUCKET, OPENSEAL_S3_REGION and, for AWS, OPENSEAL_S3_VIRTUAL_HOST=1 on the server and the worker.

8. Use the signed images

Each release publishes ghcr.io/casualoffice/openseal-server, -worker and -keyd; releases after v0.1.0 also publish -convertd, which the profile on main needs (v0.1.0's own profile has no convertd). Every image digest is signed with keyless cosign by the repository's release workflow at the release tag (recorded in the public Rekor log) and has a GitHub build provenance attestation; the release's assets are listed in SHA256SUMS, which is signed the same way. Verify all of it before you run anything:

V=v0.1.0
REPO=CasualOffice/openseal
gh release download "$V" -R "$REPO" -D "openseal-$V"; cd "openseal-$V"
ID="https://github.com/$REPO/.github/workflows/release.yml@refs/tags/$V"
ISSUER=https://token.actions.githubusercontent.com

# 1. The checksum list was signed by this repository's release workflow at this tag; every asset matches it.
cosign verify-blob SHA256SUMS --bundle SHA256SUMS.sigstore.json \
  --certificate-identity "$ID" --certificate-oidc-issuer "$ISSUER"
sha256sum -c SHA256SUMS                       # macOS: shasum -a 256 -c SHA256SUMS

# 2. Each image digest is signed by the same identity and has build provenance from this repository.
for ref in $(jq -r '.images[] | "\(.repository)@\(.digest)"' images.json); do
  cosign verify "$ref" --certificate-identity "$ID" --certificate-oidc-issuer "$ISSUER" > /dev/null && echo "signed: $ref"
  gh attestation verify "oci://$ref" -R "$REPO" --signer-workflow "$REPO/.github/workflows/release.yml"
done

The identity is exact: https://github.com/CasualOffice/openseal/.github/workflows/release.yml@refs/tags/v0.1.0, issued by https://token.actions.githubusercontent.com. A signature from any other workflow, branch or repository fails. To accept any release tag, use --certificate-identity-regexp '^https://github\.com/CasualOffice/openseal/\.github/workflows/release\.yml@refs/tags/v' instead. If the packages are not public yet, docker login ghcr.io with a GitHub account that can read them first.

The release's compose.release.yml pins keyd, migrate, server and worker to repository:tag@sha256:…, so Docker pulls by digest and a moved tag changes nothing; openseal-release.env sets OPENSEAL_IMAGE_PREFIX and OPENSEAL_VERSION. Check the merged profile against the hardening rules:

cd /srv/openseal/src
F="-f deploy/compose.production.yml -f openseal-v0.1.0/compose.release.yml --env-file openseal-v0.1.0/openseal-release.env"
docker compose $F config --format json --no-interpolate > merged.json
python3 -I tools/check-deploy.py --json merged.json

9. Set the remaining variables and record the manifests

Besides the variables of steps 4 to 6, the profile requires these (Compose names any that is missing):

export OPENSEAL_SECRETS_DIR=/srv/openseal/secrets
export OPENSEAL_PUBLIC_URL=https://sign.example.com
export OPENSEAL_TRUSTED_PROXIES=172.16.0.0/12      # narrowed below

OPENSEAL_TRUSTED_PROXIES must cover the edge network, from which proxy forwards. Docker picks its subnet when the stack is first created; start with Docker's default bridge range as above, then narrow it to the subnet docker network inspect openseal-production_edge reports and restart the replicas one at a time. Every variable is in the configuration reference.

keyd and the worker refuse to start (CS-KEY-0014) until their security settings match a recorded manifest; init-secrets.sh leaves both manifests empty on purpose. Record them from the configuration you just set, into the secrets directory:

docker compose $F run --rm --no-deps keyd config-manifest | sudo tee "$OPENSEAL_SECRETS_DIR/keyd-config-manifest" > /dev/null
docker compose $F run --rm --no-deps worker config-manifest | sudo tee "$OPENSEAL_SECRETS_DIR/worker-config-manifest" > /dev/null

A manifest holds digests of the settings (certificates, allow lists, the PKCS#11 library's bytes, the TSA list, the public URL, …), never a PIN, key or password. Record it again after every approved change; a change that was not recorded stops the daemon at its next start, naming the setting.

10. Start, create the first administrator, and check

docker compose $F up -d --wait

migrate runs first and exits; then the server replicas, keyd, the worker and the proxy start and report healthy. Create the first administrator (once; refused as soon as an organization exists):

docker compose $F exec -e OPENSEAL_ADMIN_PASSWORD='a long passphrase of your own' server \
    casual-sign-server bootstrap "Example Workspace" [email protected] "Example Admin"

Then check each layer:

docker compose $F ps                                        # every service healthy; migrate exited 0
curl -fsS https://sign.example.com/.well-known/jwks.json    # through your edge
docker compose $F exec proxy wget -q -S -O /dev/null http://server:9090/readyz     # HTTP/1.1 204
docker compose $F exec proxy wget -q -S -O /dev/null http://server-2:9090/readyz   # HTTP/1.1 204
docker compose $F logs keyd worker | grep -E '"event":"(security_configuration|start_failed)"'

Each daemon logs one security_configuration line with "manifest":"matches", and no start_failed. Finally, send an envelope to yourself, sign it, and verify the sealed PDF on the Verify page with your seal certificate's root as the trusted certificate; it should also show as valid in a PDF reader that trusts your CA. Upload the EICAR test file if you run malware scanning: it must be refused (CS-SCAN-0001).

11. Backups and the restore drill

A backup is one consistent snapshot of the database, every document blob and keyd's operation log, encrypted to a recipient certificate (CMS, AES-256-GCM) and signed with a separate Ed25519 key. It never holds a private key: the seal key stays in the HSM (back it up the HSM's way), and the token, second-factor and pepper keys live in your secret store.

# Once: two key pairs, separate from every platform key.
python3 -I tools/backup/openseal_backup.py keygen backup-keys
#   backup-recipient.pem  the backup host: encrypts (public)
#   backup-signing.key    the backup host only: signs manifests (mode 0600)
#   backup-signing.pub    everyone who checks or restores backups
#   backup-recipient.key  offline, with the people who restore: the only key that decrypts

Take backups on a schedule (hourly with --keep 48, for example) and copy each to off-site, write-once storage. The tool's --compose-project mode runs inside the evaluation stack's containers and is what the drill exercises. On the production profile, whose database and object store sit on internal networks with no published port, run it with --direct from a host or container that can reach them (attached to the data network), with the PostgreSQL client tools, casual-sign-server and casual-sign-keyd; the database comes from OPENSEAL_BACKUP_DATABASE_URL_FILE (the schema owner), the store from the server's own OPENSEAL_S3_* variables, keyd's log from --keyd-oplog. A ready-made backup service for the profile is not built yet (HRD-17).

python3 -I tools/backup/openseal_backup.py create --direct --out /backups \
    --recipient backup-keys/backup-recipient.pem --signing-key backup-keys/backup-signing.key \
    --keyd-oplog /path/to/keyd/oplog --keep 48
python3 -I tools/backup/openseal_backup.py verify /backups/openseal-backup-20261120T020000Z \
    --verify-key backup-keys/backup-signing.pub

A restore goes only into a fresh install (an empty database and a keyd that has not started), checks the signature and every file, loads everything in one transaction, then runs verify-evidence over every audit chain and blob. Rehearse it: the repository's drill, tools/backup/drill.sh, backs up a stack, destroys it, restores it into a fresh one and checks that the sealed PDF is byte-identical and the audit chains begin with the same hashes; CI runs it on every push to main. Run a restore drill on your own hardware too, including the HSM's own backup, and time it. The targets are an RPO of the backup interval (5 minutes with point-in-time recovery) and an RTO of 4 hours, which is a target, not yet measured at production size.

12. Upgrades

Migrations are forward-only and designed to stay compatible for one release, so old and new replicas can run side by side. Read the release notes, and do not skip a minor version. Verify the new release as in step 8, then run its migrations and recreate the replicas one at a time:

F="-f deploy/compose.production.yml -f openseal-v0.2.0/compose.release.yml --env-file openseal-v0.2.0/openseal-release.env"
git checkout v0.2.0
docker compose $F run --rm migrate
docker compose $F up -d --no-deps --wait server       # drains, restarts, healthy again
docker compose $F up -d --no-deps --wait server-2
docker compose $F up -d --no-deps --wait keyd worker proxy

Record the manifests again first if the release changes a security setting; keyd and the worker refuse to start on one that does not match. Take a backup before every upgrade.

13. Monitoring and health

WhatWhereAnswers
GET /livezEach server replica's ops listener, port 9090 (OPENSEAL_OPS_LISTEN), never published204 while the process runs
GET /readyzSame204; 503 while draining or while the database does not answer. HAProxy checks it every second and takes a replica out after two failures
Container healthdocker compose psEach service's own check: the server's healthcheck command, the worker's heartbeat file (at most 30 seconds old while its database answers), keyd's TLS port
PublicGET /.well-known/jwks.json200 through your edge: a cheap external probe

Logs. The server, worker and keyd write one JSON object per line to standard error, never with a name, an email address, a client address, a token or document text. Ship them off the host with the log-forwarding override (syslog over mutual TLS):

OPENSEAL_SYSLOG_ADDRESS=tcp+tls://logs.example.internal:6514 \
OPENSEAL_SYSLOG_CA=/etc/openseal/syslog/ca.pem \
OPENSEAL_SYSLOG_CERT=/etc/openseal/syslog/client.pem \
OPENSEAL_SYSLOG_KEY=/etc/openseal/syslog/client.key \
docker compose $F -f deploy/compose.log-forwarding.yml up -d

Set OPENSEAL_LOG_PSEUDONYM_KEY so the same client gets the same pseudonym across restarts. Alert on:

  • start_failed (any service; its code says why), seal_failed and job_dead (worker);
  • transport.backend_failed: keyd or a timestamp authority not answering;
  • abnormal_activity and alert.abnormal_activity: bursts of failed sign-ins, denials, mass downloads or voids;
  • auth.lockout, auth.mfa with reason: reused, transport.caller_refused;
  • development_token_key, development_file_key or seal_token_not_enforced, which must never appear in production;
  • the collector receiving nothing from a service for five minutes, email bounce rate and job backlog.

OpenTelemetry traces and metrics are not built yet (CON-11).

14. Rotations

Every secret can be rotated while signers keep working; each runbook is exercised by a named test. In outline:

SecretHow, in outlineDowntime
Database loginCreate a second login in openseal_app; rewrite database-url in place (cat new > database-url); the services reread it every 30 seconds; retire the old loginNone
Object store credentialsAdd a second identity to s3-identities.json and kill -s SIGHUP s3; rewrite the key files; rolling restart of the replicas, restart the worker; remove the old identityNone
API token signing keyMount the new key as OPENSEAL_JWT_PREVIOUS_KEY_FILE, rolling restart; swap current and previous, rolling restart; after an hour remove the previous oneNone with two replicas
Second-factor keyThe same two-step swap with OPENSEAL_MFA_PREVIOUS_KEY_FILE, then casual-sign-server mfa-resealNone with two replicas
Password pepperMount the current one as OPENSEAL_PASSWORD_PEPPER_PREVIOUS_FILE and the new one as current; hashes are remade at each user's next sign-inNone
keyd and worker identitiesIssue a new worker certificate from the internal CA, add its fingerprint to keyd-allow-list, record the manifests and restart keyd, then switch the workerSealing pauses for a keyd restart; jobs retry
Seal keyServe the next key beside the current one (OPENSEAL_SEAL_NEXT_ALIAS, OPENSEAL_PKCS11_NEXT_KEY_LABEL); key custodians approve the switch in the console; then make it the only key and record both manifestsNone for signers
keyd seal token keyWrite new 32 bytes to both keyd-seal-token-key and migrate-seal-token-key; run migrate; restart keydSeals between the steps retry 60 s later
Webhook secretsAdd the new secret's reference to the subscription (up to four sign each delivery); remove the old once receivers switchedNone

Restart replicas one at a time: docker compose $F restart server, wait until it is healthy and five seconds more (the drain period), then server-2. The exact commands and the tests behind each runbook are in docs/65 §Rotation.

15. Production checklist

Before you rely on a deployment, confirm each line. The ones about certificates, disclosures and retention are decisions only you and your counsel can make.

AreaDo
Signing keyA document-signing certificate from a CA your relying parties trust (an AATL member, or a qualified seal certificate for eIDAS), its key generated in your HSM; keyd configured with PKCS#11; never a file key
TimestampsAt least two RFC 3161 TSAs with a service level (qualified if you need eIDAS qualified time); rehearsed with tools/interop/interop.py
Trusttrust-anchors.pem holds the root of the seal certificate and of every TSA
AnchoringDaily anchoring of audit chain heads is on by default; to make anchors public, set OPENSEAL_ANCHOR_LOG and publish that file where you cannot quietly rewrite it
EmailSPF, DKIM and DMARC (p=quarantine or stricter) on the sending domain; bounce handling
Malware scanningThe clamav service and OPENSEAL_CLAMD_ADDR; fail-open off; checked with the EICAR file
DatabasePostgreSQL 15 or later, encrypted, point-in-time recovery, scheduled encrypted backups and a restore drill on your hardware
Object storeVersioning and encryption on; Object Lock in compliance mode for regulated tenants
EdgeTLS 1.2 or later (1.3 preferred), HSTS, a web application firewall if you have one; OPENSEAL_PUBLIC_URL is HTTPS; request paths not logged
ImagesSignatures and provenance verified (step 8); the profile pinned by digest; tools/check-deploy.py passes over the merged file
ObservabilityLogs shipped off the host; alerts on the events of step 13
Consumer disclosureCounsel has reviewed the electronic records disclosure for your jurisdictions before you send to consumers
RetentionRetention rules set before go-live and recorded in your records schedule

Something not working? See Troubleshooting.