Certificates and ACME keys are stored encrypted in the database, namespaced per owner so an organization's servers cannot read platform or other organizations' keys. Locks live in Redis and expire. Refs #22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
22 lines
856 B
SQL
22 lines
856 B
SQL
-- +goose Up
|
|
-- Key-value storage for status page servers, which have no database of
|
|
-- their own: TLS certificates and ACME account keys. Values are sealed by
|
|
-- the application. Owner separates platform servers from each
|
|
-- organization's servers so none can read another's private keys.
|
|
CREATE TABLE agent_storage (
|
|
owner text NOT NULL,
|
|
key text NOT NULL CHECK (length(key) BETWEEN 1 AND 1000),
|
|
value bytea NOT NULL,
|
|
modified timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (owner, key)
|
|
);
|
|
|
|
-- Only reached through agent handlers in the system scope.
|
|
ALTER TABLE agent_storage ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE agent_storage FORCE ROW LEVEL SECURITY;
|
|
CREATE POLICY agent_storage_system ON agent_storage FOR ALL
|
|
USING (app_scope_system()) WITH CHECK (app_scope_system());
|
|
|
|
-- +goose Down
|
|
DROP TABLE agent_storage;
|