forked from postgres/postgres
-
Notifications
You must be signed in to change notification settings - Fork 10
Create enforcement.md - Encryption Enforcement topic #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Andriciuc
wants to merge
21
commits into
release-17.5.2
Choose a base branch
from
docs-create-enforcement
base: release-17.5.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
edbf109
initial encryption enforcement doc
Andriciuc a2a4ed9
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc 4ceee41
Update enforcement.md
Andriciuc 127cffa
Merge branch 'docs-create-enforcement' of https://github.com/percona/…
Andriciuc 78376c3
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc 5e8360f
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc 469f1de
Update enforcement.md
Andriciuc a47f922
Merge branch 'docs-create-enforcement' of https://github.com/percona/…
Andriciuc c63c721
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc dcb6259
Update enforcement.md
Andriciuc cbdf83e
Update enforcement.md
Andriciuc 6d27b14
Update enforcement.md
Andriciuc d3b6174
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc 73bb82d
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc 04f6276
Update enforcement.md
Andriciuc d2ab825
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc f16cdb0
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc 1a3b276
Merge branch 'TDE_REL_17_STABLE' into docs-create-enforcement
Andriciuc 3cbbf9a
Merge branch 'release-17.5.2' into docs-create-enforcement
Andriciuc 1cb64f1
Merge branch 'release-17.5.2' into docs-create-enforcement
Andriciuc bd5f2ce
Updated enforcement with examples and variables with link
Andriciuc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Encryption Enforcement | ||
|
||
For `pg_tde`, encryption enforcement ensures that only encrypted storage is allowed for specific operations, tables, or the entire database. It prevents the accidental creation of unencrypted tables or indexes in environments where encryption is required for compliance, security, or policy enforcement. | ||
|
||
## What does enforcement do? | ||
|
||
When enabled, encryption enforcement: | ||
|
||
* Prevents creation of unencrypted tables or indexes | ||
* Enforces consistent encryption usage across tenants, databases, or users | ||
* Can be scoped globally, per database, or per role | ||
|
||
## Enforce encryption usage | ||
|
||
Use the following techniques to enforce the secure use of `pg_tde`. | ||
|
||
### 1. Enforce encryption across the server | ||
|
||
To enforce encryption cluster-wide, set the [`pg_tde.enforce_encryption`](../variables.md/#pg_tdeenforce_encryption) variable in `postgresql.conf`: | ||
|
||
```ini | ||
pg_tde.enforce_encryption = on | ||
``` | ||
|
||
This ensures that no user, including superusers, can create unencrypted tables unless they explicitly override the variable in a session (see below). | ||
|
||
### 2. Enforce encryption for a specific database | ||
|
||
To apply encryption enforcement only within a specific database, run: | ||
|
||
```sql | ||
ALTER DATABASE example_db SET pg_tde.enforce_encryption = on; | ||
``` | ||
|
||
This ensures encryption is enforced **only** when connected to that database. | ||
|
||
### 3. Enforce encryption for a specific user | ||
|
||
You can also enforce encryption on a per-user basis, run: | ||
|
||
```sql | ||
ALTER USER example_user SET pg_tde.enforce_encryption = on; | ||
``` | ||
|
||
This ensures that the user `example_user` cannot create unencrypted tables, regardless of which database they connect to. | ||
|
||
### Override enforcement for trusted sessions | ||
|
||
Superusers (such as DBAs) can override the variable at the session level: | ||
|
||
```sql | ||
SET pg_tde.enforce_encryption = off; | ||
``` | ||
|
||
This allows temporary creation of unencrypted tables in special cases, such as: | ||
|
||
* Loading trusted, public reference datasets | ||
* Benchmarking and test environments | ||
* Migration staging before re-encryption | ||
|
||
!!! note | ||
While superusers can disable enforcement in their session, they must do so explicitly. Enforcement defaults remain active to protect from accidental misconfiguration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.