Repository navigation
Data Security
This page answers four questions about the data: what is encrypted, where secrets live, what is hashed, and who can read or write what. The wider security design is in Security Model; cross-cutting concepts are in Architecture Crosscutting Concepts. Nothing here is a certification; the limits that still hold are on Limitations and Known Issues.
| Data | Protection |
|---|---|
| Connections between PostgreSQL instances | Every managed instance runs with ssl = on (TLS 1.3, the server certificate, ssl_ca_file the cluster CA, ssl_crl_file the revocation list). pg_hba.conf starts with hostssl ... cert rules for each server, and the sharding extension's outgoing connections use sslmode=verify-full. |
| Server-to-server control-plane traffic | The internal HTTP API runs with mutual TLS under the cluster CA (ECDSA P-256), on its own port, authenticated by client certificate only, with a revocation list. |
| Panel and REST API | The panel listens on loopback by default; for other addresses use TLS (see Configuration). |
| Ledger publication | Off by default. With --ledger-publication-tls-cert and --ledger-publication-tls-key it serves TLS; without them it is plain HTTP and the console warns. Its content is public by design and is protected by signatures, not secrecy. |
| Ledger signing key files | PBKDF2-HMAC-SHA256 and AES-256-GCM, when --ledger-key-passphrase-file is set. Without a passphrase file the key files are in clear text, like the CA key, and kingresd logs a warning. |
| Anchor credentials | Files <ledger-keys-dir>/anchor/<target id>.json with the same sealing as the signing keys. |
| Staged transfer files (table and database exports, uploads) | Sealed segment by segment with AES-256-GCM under a per-file key that is wrapped by a master key kept outside the staging directory (-transfer-key-file, default <data-dir>/transfer.key). A staged file can be read and downloaded only by the role that made it. |
| Data at rest in PostgreSQL files | The sources describe no encryption at rest of table or WAL files. A cold copy of /var/lib/kingres holds the CA key and the service credentials and must be treated as a secret. |
| Secret | Location | Never in |
|---|---|---|
| Certificate authority key |
<data-dir>/pki/ca.key, mode 0600, on the leader; sealed copies exist only when escrow is on (next row) |
PostgreSQL, API answers |
| Escrow copies of the CA key | Off until switched on. When on, the leader seals the CA key and the revocation list to every server that hosts a ready standby of the map group, so a new leader can go on issuing certificates. A server that holds a copy can become the certificate authority, so its disk is as sensitive as the leader's | PostgreSQL, API answers |
| Master key of the transfers |
<data-dir>/transfer.key (option -transfer-key-file), never inside the staging directory |
the staging directory, API answers |
| Server private keys | the server that generated them (server.key, 0600); only the public key and the certificate are stored in kingres_cp.server
|
the system database |
| Service role password |
<data-dir>/service-credentials, mode 0600; service connections use the instance's unix socket |
TCP traffic, logs |
| One-time setup token |
<data-dir>/setup-token, mode 0600, only while the node is uninitialised; only the file name is logged |
logs |
| User and panel passwords | not known to the cluster: roles are synchronised as SCRAM-SHA-256 verifiers computed in kingresd; a panel account is a PostgreSQL role |
logs, audit log |
| Cluster secret of the sharding extension | table kingres.cluster_secret on each node (forced row level security, no privilege for any role, not dumped by pg_dump); a superuser, and whoever can read the node's files, WAL or a base backup, can read it. kingres.rotate_secret() replaces it on every node in one two-phase transaction |
the catalog snapshot every user can read, logs (the statement that installs it is not logged with its argument) |
| Ledger server signing keys | encrypted files under --ledger-keys-dir (default <data-dir>/ledger/keys), mode 0600 in a 0700 directory, on the leader and on the servers that run shard group 0, or an external signer program |
PostgreSQL, task rows, logs, audit, API answers |
| Passphrase of the key files | a file, mode 0600, named by --ledger-key-passphrase-file
|
the environment, the command line |
| Client private keys (ledger attestations) | the client's own custody; the server never sees them | everything on the server |
| Public keys, checkpoints, tiles, events |
kingres_cp and the publication; public |
n/a |
Back up the key directory and the passphrase separately, off the cluster (Backup Restore and PITR).
| What | How |
|---|---|
| Ledger rows, transactions, blocks, chain identity | SHA-256 over tagged inputs in RFC 6962 trees (hash format version 1); see Data Model Ledger |
| Ledger transparency logs | SHA-256 tiles of height 8, signed checkpoints (Ed25519, C2SP signed notes) |
| Key ids |
ledger_client_key.key_id is the first 16 bytes of the SHA-256 of the public key; ledger_signing_key.fingerprint is the SHA-256 of the public key in hex |
| Anchors | TSA and OpenTimestamps receive the SHA-256 of the checkpoint text; ledger_anchor.payload_sha256 stores it |
| Node-to-node sessions | the token kingres_shard.forward_token is HMAC-SHA-256(secret, "kingres-forward-v2" NUL role NUL database NUL target node id), checked in constant time |
| Distributed transaction names | a tag of the first 16 hex digits of an HMAC of the name with the cluster secret, so the extension resolves only prepared transactions that carry a valid tag |
| Passwords | SCRAM-SHA-256 verifiers |
| Time-partition policies |
timepart_policy_seal.fingerprint seals what a policy says, so a row restored from a dump is not trusted |
| Columnar chunks | a CRC-32C of every stored chunk and of the stripe footer (error detection, not security) |
- The ledger tables can be written only by the extension's code; the guard refuses every other statement, whatever the role inherits or owns, except a superuser acting as itself with
kingres_ledger.allow_manual_write, which leaves a record. Ledger tables other than blocks are not readable by PUBLIC (ledger_entryandledger_client_keyare among those revoked);ledger_blocksis readable by PUBLIC so block headers can be exported. Read functions for the publisher (ledger_head,ledger_blocks_entries) are granted to the service role. - A database can be dropped together with its ledger by every role that has the privileges of its owner or can
SET ROLEto it;ledger_statuslists such roles. - The panel roles are
kingres_admin>kingres_ops>kingres_readonly>kingres_stats; every operation inopenapi.yamlnames the minimum role (x-required-role). Anything that changes keys, targets, settings, client keys or policy needskingres_admin. - A hot standby can verify the ledger, check digests and build and check proofs; it cannot enable tables or build blocks.
- Every administrative action through the REST API is written to the audit log; the audit file and the
kingresdlog never contain statement text, passwords or tokens. Credentials of anchor targets are never in an audit entry. See Monitoring and Alerts. - Within one cluster every server is fully trusted by every other (the control-plane README says so in plain words).
The publication holds hashes only (design 4.9). A third party learns that a chain exists (its chain_id), the number of blocks, the time of each block, the number of transactions per block and the previous-block hash chain, so it learns when the database is busy and roughly how busy, and from the number of chains of one aggregate the number of shard groups of a database. It does not learn table names, user names, row contents, row hashes, the database name (hidden in the aggregate id) or shard group ids. An operator who does not want the activity pattern published keeps the listener off and exports bundles on demand.
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/control-plane/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/design/ledger-phase7.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/design/control-plane-3.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/contrib/kingres_shard/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/contrib/kingres_ledger/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/contrib/kingres_timepart/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/packaging/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/adr/0015-panel-accounts-are-postgresql-roles.md
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations