Deploy DynamoDB backends
The AuthCrunch v1.8.1 distribution includes
caddy-security-aws-dyndb v1.2.1 and go-authcrunch-aws-dyndb v1.2.0.
For a custom Caddy build, select the pinned DynamoDB companion.
Check authcrunch list-modules --versions for the .dynamodb modules you
need, and authcrunch security-dynamodb --help for the provisioning commands.
Provision the table and AWS identity
- Create a single-region DynamoDB table with string partition key
pkand string sort keysk. The serving process uses the table you declare. Use separate tables and IAM roles where workloads need isolation. - Give the service an AWS role through the SDK credential chain. Scope the role to the selected table and the operations each backend needs. Give provisioning and backup tasks their own permissions. The backend guide lists read, write and transaction requirements by feature. IAM and table setup.
- Optionally enable DynamoDB TTL on
expires_atfor physical cleanup. AuthCrunch enforces deadlines independently. Pending enrollment IDs still count toward their lifetime limit after the proof item expires. DynamoDB TTL.
The connector checks that the table is active or updating and has the expected key schema. It uses strongly consistent reads and conditional or transactional writes on the base table. The transport does not follow redirects from the endpoint. Secondary indexes are unnecessary, and replicated Global Tables are rejected. For example, provision a new production table through your infrastructure workflow using the AWS CLI:
aws dynamodb create-table \
--region us-east-1 \
--table-name authcrunch-prod \
--attribute-definitions AttributeName=pk,AttributeType=S AttributeName=sk,AttributeType=S \
--key-schema AttributeName=pk,KeyType=HASH AttributeName=sk,KeyType=RANGE \
--billing-mode PAY_PER_REQUEST \
--deletion-protection-enabled
aws dynamodb wait table-exists --region us-east-1 --table-name authcrunch-prod
For an IAM role that reads a pre-provisioned AuthCrunch secret, allow
dynamodb:DescribeTable and dynamodb:GetItem on the selected table. A
writer role may need Query, PutItem, DeleteItem and
ConditionCheckItem as well. DynamoDB authorizes transactions using the
underlying item actions. Initial secret provisioning can query the namespace
to check its capacity counter. Keep table administration, TTL, encryption and
backup permissions with the appropriate infrastructure identity.
DynamoDB transaction permissions.
| Shared backend setting | Use |
|---|---|
table | The existing table name |
namespace | Deployment scope within the table, default authcrunch |
region | Override the AWS SDK region for this backend |
timeout | Operation deadline, default 5s, allowed 1ms to 1m |
endpoint | Optional trusted HTTPS DynamoDB endpoint or numeric loopback HTTP URL for DynamoDB Local |
See the backend configuration reference
for all nine declaration shapes and defaults. Use matching table, namespace,
backend name and realm or record when
provisioning and serving. A namespace partitions records within a table.
Table access remains an IAM boundary. Treat identity metadata, secrets, OAuth
transactions and queued mail as sensitive table data. Use the AWS SDK credential
chain independently of the AuthCrunch secret records. Backend settings accept
Caddyfile lexical substitution such as {$TABLE_NAME}. Native JSON puts
shared connection fields under dynamodb. Use adapt --pretty to inspect it.
Start with password identities
Place this configuration at the global options and site levels. Replace the
table, region, namespace, HTTPS hostname and signing key with your deployment
values. Set AUTHCRUNCH_SIGNING_KEY for the service.
{
security {
identity store dynamodb accounts {
table authcrunch-prod
namespace production
region us-east-1
realm staff
}
authentication portal staff {
enable identity store accounts
crypto key sign-verify {env.AUTHCRUNCH_SIGNING_KEY}
}
}
}
auth.example.com {
@portal path /auth /auth/*
route @portal {
redir /auth /auth/ 308
authenticate with staff at /auth
}
}
Provision a first user with the same table, namespace, store name and realm. Feed the password through standard input from a private file and keep that file out of served directories and version control.
authcrunch security-dynamodb identity create \
--table authcrunch-prod --namespace production --region us-east-1 \
--name accounts --realm staff --username alice --email alice@example.test \
--roles authp/user < /path/to/private/alice-password.txt
Adapt the configuration, then validate it as the service identity after
provisioning the table. Sign in at /auth/login. Verify the realm, try a
wrong password, and check the capabilities endpoint.
DynamoDB password accounts support Profile reads, password changes and
identity-bound Documents access. MFA, Profile key collections, downstream OIDC
and explicit upstream account attachment have separate backend requirements.
For offline account changes use security-dynamodb identity subcommands.
After an uncertain mutation, inspect current state before retrying. Lock
recovery requires stopping and fencing every writer for the store and
reconciling prior writes before resuming service. Account commands and lock recovery.
Provisioning command reference
The command group takes --table, --name, and optional --namespace,
--region, --endpoint and --timeout. Select the same effective AWS
configuration in the process and the provisioning command.
| Operation | Additional flags and private input |
|---|---|
identity create | --realm, --username, --email, --roles as a comma-separated list, optional --full-name. Send the password on stdin. |
identity set-password, enable, disable, delete | Select the account with --realm, --username and --email. Only set-password takes a password on stdin. |
identity roles | Use the same account selectors and give the complete replacement role list via --roles. |
identity recover-lock | Use the same selectors and --fenced only after every previous writer is stopped and unable to complete its operation. Reconcile the previous result before resuming. |
api-key issue | --realm, --subject, --email, --roles, optional --lifetime (default 1h, maximum 720h). The key is printed once to stdout. |
api-key revoke | --realm. Send the issued key privately on stdin. |
secret put, secret delete | --record. Put takes one JSON object on stdin and replaces the complete record. |
smtp-worker | --address and --sender, with optional --sender-name, --protocol, --passwordless and --bcc. See delivery. |
Passwords use bcrypt and accept 12–72 UTF-8 bytes. For line-based input the CLI strips one final LF or CRLF and preserves the other bytes. It rejects interactive terminal input for this backend. The identity and secret commands report their outcome through the exit status and errors. They print no password, secret record or account data.
For secret put, send the record object itself on stdin, with no SQLite
config or values wrapper. Input is limited to 64 KiB and must have unique
object keys at every level and valid Unicode escapes. A record has up to
128 top-level fields and 64 KiB of encoded payload, with at most 1024 records
in a namespace. Manager names can point at the same record. Use
snapshot activation
to verify that a serving process picked up the change.
Keep issued keys in a private newly created output file or equivalent secret channel. If stdout fails after issuance, the command attempts revocation and reports whether that succeeded. If revocation is uncertain, inspect current state before issuing a replacement. CLI source.
Select the other backends you need
Declare the backend inside security and select it in its consumer.
| Declaration | How to use it |
|---|---|
credential authenticator dynamodb NAME | Select with the policy's with api key auth portal NAME realm REALM. Issue or revoke with security-dynamodb api-key. Subsequent requests see revocation. Use private output for issuance and remove credential headers from logs. API-key authentication. |
secrets dynamodb NAME | Provision a typed record with security-dynamodb secret put, then use secrets:NAME:FIELD. The process reads a snapshot during startup or successful reconfiguration. |
messaging dynamodb provider NAME | Queue notifications and run security-dynamodb smtp-worker as a separate service with matching queue settings. |
user registration dynamodb NAME | Select with enable user registration NAME and bind to the DynamoDB accounts and outbox. Use the portal's canonical HTTPS origin and mount. |
identity provider dynamodb NAME | Select with enable identity provider NAME. A trusted issuer uses the matching Go ticket provider. Caddy's DynamoDB provider uses a private in-memory attachment per instance. Ticket login. |
oauth login store dynamodb NAME | Select with login store NAME namespace DEPLOYMENT on the upstream OAuth provider. Match the normalized provider configuration and both namespace values across replicas. Pending OAuth storage. |
token refresh store dynamodb NAME | Select with store NAME inside the portal refresh block and match the limits. Retain exclusive persistent root state. Replacing the DynamoDB password-store handle invalidates its old authentication evidence. Managed refresh. |
documents store NAME with driver dynamodb | Pair table metadata with a private S3 bucket for encrypted chunks. File Vault storage. |
The companion guide
contains complete configuration fragments and CLI examples for each declaration.
For a new signup workflow, confirm SMTP delivery end to end. The worker
defaults to implicit TLS (smtps), uses a lease, and delivers at least once.
An interrupted acknowledgment after SMTP acceptance can produce a duplicate.
The 45-minute confirmation deadline and five-attempt limit remain effective
without TTL. Upgrade every runtime sharing the workflow before opening signup
when migrating from the earlier DynamoDB companion. Outbox operations.
The DynamoDB account backend retains a lifetime limit of 10000 accounts per configured store and realm, including tombstones. Deleting and recreating a username produces a different account identity. The provider keeps up to 1024 live ticket requests for each provider and realm. The outbox holds 1000 outstanding messages per namespace across named queues. Use the configuration reference for tunable pending OAuth, refresh and S3 limits.
Plan routing and recovery
Shared pending OAuth callbacks and ticket redemption still require their original browser binding. Keep portal-session affinity for post-login requests and other root-owned state. A shared table does not merge root namespaces or make independent refresh issuers interchangeable.
Back up the table, the private runtime state needed by the selected features and, for File Vault, the S3 bucket together. Restore matching capacity counters, records and expiry indexes. Missing counters in a populated scope can make startup, revocation and redemption unavailable. A managed refresh restore also needs the settings, generation and retirement state, families and indexes from the same restore point. Keep the restore offline until you reconcile superseded identities, credentials and secret revisions. Start fresh authentication state where needed. Restoring to another table changes the configured locator. Treat saved OAuth transactions and managed refresh generation bindings as compatibility checks, especially when the table name or namespace changes. Restore workflow.
A transfer from SQLite is a backend migration. Reprovision verified accounts and secrets, reissue keys, drain the old outbox, and require fresh login for transient state. Move File Vault files through client-side recovery and export before importing into a new vault, then recreate the intended shares. Test callback routing, delivery after worker interruption, and fail-closed behavior in a staging deployment. See the Go backend operational guide for service errors and ambiguous write outcomes.
Agentic Prompts
Plan an account and API deployment
Read the upstream AGENTS.md files first: https://github.com/greenpau/caddy-security/blob/v1.8.1/AGENTS.md and https://github.com/greenpau/go-authcrunch/blob/v1.7.1/AGENTS.md. Read applicable scoped AGENTS.md files, then the relevant skills and linked implementation and test files under https://github.com/greenpau/caddy-security/tree/v1.8.1/.codex/skills and https://github.com/greenpau/go-authcrunch/tree/v1.7.1/.codex/skills. Follow the same process for https://github.com/greenpau/caddy-security-aws-dyndb/tree/v1.2.1 and https://github.com/greenpau/go-authcrunch-aws-dyndb/tree/v1.2.0. Use https://docs.authcrunch.com/docs/operations/dynamodb as secondary context. Distinguish main from the installed versions and resolve disagreements in code and tests. If sources are inaccessible, ask me to paste them. Use synthetic data and label unverified behavior.
Given browser password login and a separate automation API, identify the declarations, selectors, role gates, IAM boundaries and checks for revocation. Explain why the two credential stores serve different callers.
Trace a callback across hosts
Read the upstream AGENTS.md files first: https://github.com/greenpau/caddy-security/blob/v1.8.1/AGENTS.md and https://github.com/greenpau/go-authcrunch/blob/v1.7.1/AGENTS.md. Read applicable scoped AGENTS.md files, then the relevant skills and linked implementation and test files under https://github.com/greenpau/caddy-security/tree/v1.8.1/.codex/skills and https://github.com/greenpau/go-authcrunch/tree/v1.7.1/.codex/skills. Follow the same process for https://github.com/greenpau/caddy-security-aws-dyndb/tree/v1.2.1 and https://github.com/greenpau/go-authcrunch-aws-dyndb/tree/v1.2.0. Use https://docs.authcrunch.com/docs/operations/dynamodb as secondary context. Distinguish main from the installed versions and resolve disagreements in code and tests. If sources are inaccessible, ask me to paste them. Use synthetic data and label unverified behavior.
Trace a pending upstream OAuth login from one replica to a second. Identify both namespace values, the browser and provider bindings, and the affinity still needed after login.
Investigate a signup delay
Read the upstream AGENTS.md files first: https://github.com/greenpau/caddy-security/blob/v1.8.1/AGENTS.md and https://github.com/greenpau/go-authcrunch/blob/v1.7.1/AGENTS.md. Read applicable scoped AGENTS.md files, then the relevant skills and linked implementation and test files under https://github.com/greenpau/caddy-security/tree/v1.8.1/.codex/skills and https://github.com/greenpau/go-authcrunch/tree/v1.7.1/.codex/skills. Follow the same process for https://github.com/greenpau/caddy-security-aws-dyndb/tree/v1.2.1 and https://github.com/greenpau/go-authcrunch-aws-dyndb/tree/v1.2.0. Use https://docs.authcrunch.com/docs/operations/dynamodb as secondary context. Distinguish main from the installed versions and resolve disagreements in code and tests. If sources are inaccessible, ask me to paste them. Use synthetic data and label unverified behavior.
Diagnose a pending signup with no email. Distinguish setup, durable queue acceptance, SMTP DATA acceptance, lease expiry, acknowledgment and application-enforced signup expiration.
Compare restart and restore
Read the upstream AGENTS.md files first: https://github.com/greenpau/caddy-security/blob/v1.8.1/AGENTS.md and https://github.com/greenpau/go-authcrunch/blob/v1.7.1/AGENTS.md. Read applicable scoped AGENTS.md files, then the relevant skills and linked implementation and test files under https://github.com/greenpau/caddy-security/tree/v1.8.1/.codex/skills and https://github.com/greenpau/go-authcrunch/tree/v1.7.1/.codex/skills. Follow the same process for https://github.com/greenpau/caddy-security-aws-dyndb/tree/v1.2.1 and https://github.com/greenpau/go-authcrunch-aws-dyndb/tree/v1.2.0. Use https://docs.authcrunch.com/docs/operations/dynamodb as secondary context. Distinguish main from the installed versions and resolve disagreements in code and tests. If sources are inaccessible, ask me to paste them. Use synthetic data and label unverified behavior.
Compare a restart that keeps the same root state with a restore from an older table and with a second independent root. Account for password identity proof epochs and any credential reconciliation.
Plan File Vault storage recovery
Read the upstream AGENTS.md files first: https://github.com/greenpau/caddy-security/blob/v1.8.1/AGENTS.md and https://github.com/greenpau/go-authcrunch/blob/v1.7.1/AGENTS.md. Read applicable scoped AGENTS.md files, then the relevant skills and linked implementation and test files under https://github.com/greenpau/caddy-security/tree/v1.8.1/.codex/skills and https://github.com/greenpau/go-authcrunch/tree/v1.7.1/.codex/skills. Follow the same process for https://github.com/greenpau/caddy-security-aws-dyndb/tree/v1.2.1 and https://github.com/greenpau/go-authcrunch-aws-dyndb/tree/v1.2.0. Use https://docs.authcrunch.com/docs/operations/dynamodb as secondary context. Distinguish main from the installed versions and resolve disagreements in code and tests. If sources are inaccessible, ask me to paste them. Use synthetic data and label unverified behavior.
Explain which File Vault state lives in DynamoDB versus S3. Build a restore checklist that covers table and bucket consistency, retirement markers, stable portal binding and user recovery keys.
Source Code References
- Code search for named backend and Documents factories finds the host and runtime construction contracts.
- Caddy adapter guide at v1.2.1 shows the registered declarations and administrative commands.
- DynamoDB backend at v1.2.0 owns AWS client and table settings.
- Identity store at v1.2.0 implements identity-bound operations and the storage recovery contract.
- Documents store at v1.2.0 implements metadata, chunks and retirement.
- Registration tests and implementation at v1.2.0 cover pending proof and enrollment transitions.