forked from postgres/postgres
-
Notifications
You must be signed in to change notification settings - Fork 8
Fix some documentation pages after key management functions renaming #229
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
artemgavrilov
wants to merge
1
commit into
TDE_REL_17_STABLE
Choose a base branch
from
update-docs
base: TDE_REL_17_STABLE
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
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 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 |
---|---|---|
|
@@ -199,30 +199,30 @@ If `pg_tde.inherit_global_providers` is `OFF`, global providers are only used fo | |
To add a global provider: | ||
|
||
```sql | ||
pg_tde_add_global_key_provider_<TYPE>(‘provider_name', ... details ...) | ||
pg_tde_add_global_key_provider_<TYPE>('provider_name', ... details ...) | ||
``` | ||
|
||
To add a database specific provider: | ||
|
||
```sql | ||
pg_tde_add_key_provider_<TYPE>(‘provider_name', ... details ...) | ||
pg_tde_add_database_key_provider_<TYPE>('provider_name', ... details ...) | ||
``` | ||
|
||
Note that in these functions do not verify the parameters. | ||
For that, see `pg_tde_verify_principal_key`. | ||
For that, see `pg_tde_verify_key`. | ||
|
||
### Changing providers | ||
|
||
To change a value of a global provider: | ||
|
||
```sql | ||
pg_tde_modify_global_key_provider_<TYPE>(‘provider_name', ... details ...) | ||
pg_tde_change_global_key_provider_<TYPE>('provider_name', ... details ...) | ||
``` | ||
|
||
To change a value of a database specific provider: | ||
|
||
```sql | ||
pg_tde_modify_key_provider_<TYPE>(‘provider_name', ... details ...) | ||
pg_tde_change_database_key_provider_<TYPE>('provider_name', ... details ...) | ||
``` | ||
|
||
These functions also allow changing the type of a provider. | ||
|
@@ -231,16 +231,16 @@ The functions however do not migrate any data. | |
They are expected to be used during infrastructure migration, for example when the address of a server changes. | ||
|
||
Note that in these functions do not verify the parameters. | ||
For that, see `pg_tde_verify_principal_key`. | ||
For that, see `pg_tde_verify_key`. | ||
|
||
### Changing providers from the command line | ||
|
||
To change a provider from a command line, `pg_tde` provides the `pg_tde_modify_key_provider` command line tool. | ||
To change a provider from a command line, `pg_tde` provides the `pg_tde_change_key_provider` command line tool. | ||
|
||
This tool work similarly to the above functions, with the following syntax: | ||
|
||
```bash | ||
pg_tde_modify_key_provider <dbOid> <providerType> ... details ... | ||
pg_tde_change_key_provider <dbOid> <providerType> ... details ... | ||
``` | ||
|
||
Note that since this tool is expected to be offline, it bypasses all permission checks! | ||
|
@@ -252,8 +252,8 @@ This is also the reason why it requires a `dbOid` instead of a name, as it has n | |
Providers can be deleted by the | ||
|
||
```sql | ||
pg_tde_delete_key_provider(provider_name) | ||
pg_tde_delete_global_key_provider(provider_name) | ||
pg_tde_delete_database_key_provider(provider_name) | ||
pg_tde_delete_global_key_provider(provider_name) | ||
``` | ||
|
||
functions. | ||
|
@@ -269,16 +269,16 @@ Making this check makes more sense than potentially making some databases inacce | |
|
||
`Pg_tde` provides 2 functions to show providers: | ||
|
||
* `pg_tde_list_all_key_providers()` | ||
* `pg_tde_list_all_database_key_providers()` | ||
* `pg_tde_list_all_global_key_providers()` | ||
|
||
These functions only return a list of provider names, without any details about the type/configuration. | ||
|
||
There's also two function to query the details of providers: | ||
|
||
```sql | ||
pg_tde_show_key_provider_configuration(‘provider-name') | ||
pg_tde_show_global_key_provider_configuration(‘provider-name') | ||
pg_tde_show_key_provider_configuration('provider-name') | ||
pg_tde_show_global_key_provider_configuration('provider-name') | ||
``` | ||
|
||
These functions display the provider type and configuration details, but won't show the sensitive parameters, such as passwords or authentication keys. | ||
|
@@ -287,11 +287,11 @@ These functions display the provider type and configuration details, but won't s | |
|
||
`Pg_tde` implements access control based on execution rights on the administration functions. | ||
|
||
For provider administration, it provides two pair of functions: | ||
For keys and providers administration, it provides two pair of functions: | ||
|
||
```sql | ||
pg_tde_(grant/revoke)_local_provider_management_to_role | ||
pg_tde_(grant/revoke)_global_provider_management_to_role | ||
pg_tde_(grant/revoke)_database_key_management_to_role | ||
pg_tde_(grant/revoke)_global_key_management_to_role | ||
``` | ||
|
||
There's one special behavior: | ||
|
@@ -303,25 +303,25 @@ When `pg_tde.inherit_global_providers` is OFF, they can't execute the function a | |
Principal keys can be created or rotated using the following functions: | ||
|
||
```sql | ||
pg_tde_set_principal_key(‘key-name', ‘provider-name', ensure_new_key) | ||
pg_tde_set_global_principal_key(‘key-name', ‘provider-name', ensure_new_key) | ||
pg_tde_set_server_principal_key(‘key-name', ‘provider-name', ensure_new_key) | ||
pg_tde_set_key_using_(global/database)_key_provider('key-name', 'provider-name', ensure_new_key) | ||
pg_tde_set_server_key_using_(global/database)_key_provider('key-name', 'provider-name', ensure_new_key) | ||
pg_tde_set_default_key_using_(global/database)_key_provider('key-name', 'provider-name', ensure_new_key) | ||
``` | ||
|
||
`ensure_new_key` is a boolean parameter defaulting to false. | ||
If it is true, the function might return an error instead of setting the key, if it already exists on the provider. | ||
|
||
### Default principal key | ||
|
||
With `pg_tde.inherit_global_key_providers`, it is also possible to set up a default global principal key, which will be used by any database which has the `pg_tde` extension enabled, but doesn't have a database specific principal key configured using `pg_tde_set_(global_)principal_key`. | ||
With `pg_tde.inherit_global_key_providers`, it is also possible to set up a default global principal key, which will be used by any database which has the `pg_tde` extension enabled, but doesn't have a database specific principal key configured using `pg_tde_set_key_using_(global/database)_key_provider`. | ||
|
||
With this feature, it is possible for the entire database server to easily use the same principal key for all databases, completely disabling multi-tenency. | ||
|
||
A default key can be managed with the following functions: | ||
|
||
```sql | ||
pg_tde_set_default_principal_key(‘key-name', ‘provider-name', ensure_new_key) | ||
pg_tde_drop_default_principal_key() -- not yet implemented | ||
pg_tde_set_default_key('key-name', 'provider-name', ensure_new_key) | ||
pg_tde_drop_default_key() -- not yet implemented | ||
``` | ||
|
||
`DROP` is only possible if there's no table currently using the default principal key. | ||
|
@@ -330,19 +330,21 @@ Changing the default principal key will rotate the encryption of internal keys f | |
|
||
### Removing key (not yet implemented) | ||
|
||
`pg_tde_drop_principal_key` removes the principal key for the current database. | ||
`pg_tde_drop_key` removes the principal key for the current database. | ||
If the current database has any encrypted tables, and there isn't a default principal key configured, it reports an error instead. | ||
If there are encrypted tables, but there's also a global default principal key, internal keys will be encrypted with the default key. | ||
|
||
It isn't possible to remove the WAL (server) principal key. | ||
|
||
### Current key details | ||
|
||
`pg_tde_principal_key_info()` returns the name of the current principal key, and the provider it uses. | ||
`pg_tde_key_info()` returns the name of the current principal key, and the provider it uses. | ||
|
||
`pg_tde_global_principal_key_info(‘PG_TDE_GLOBAL')` does the same for the server key. | ||
`pg_tde_server_key_info()` does the same for the server key. | ||
|
||
`pg_tde_verify_principal_key()` checks that the key provider is accessible, that the current principal key can be downloaded from it, and that it is the same as the current key stored in memory - if any of these fail, it reports an appropriate error. | ||
`pg_tde_default_key_info()` does the same for the default key. | ||
|
||
`pg_tde_verify_key()` checks that the key provider is accessible, that the current principal key can be downloaded from it, and that it is the same as the current key stored in memory - if any of these fail, it reports an appropriate error. | ||
|
||
### Listing all active keys (not yet implemented) | ||
|
||
|
@@ -351,13 +353,14 @@ SUPERusers are able to use the following function: | |
`pg_tde_list_active_keys()` | ||
|
||
Which reports all the actively used keys by all databases on the current server. | ||
Similarly to `pg_tde_show_current_principal_key`, it only shows names and associated providers, it doesn't reveal any sensitive information about the providers. | ||
Similarly to `pg_tde_key_info()`, it only shows names and associated providers, it doesn't reveal any sensitive information about the providers. | ||
|
||
### Key permissions | ||
|
||
Users with management permissions to a specific database `(pg_tde_(grant/revoke)_provider_management_to_role)` can change the keys for the database, and use the current key functions. This includes creating keys using global providers, if `pg_tde.inherit_global_providers` is enabled. | ||
Users with management permissions to a specific database `(pg_tde_(grant/revoke)_(global/databse)_key_management_to_role)` can change the keys for the database, and use the current key functions. This includes creating keys using global providers, if `pg_tde.inherit_global_providers` is enabled. | ||
|
||
Also, the `pg_tde_(grant/revoke)_key_management_to_role` function deals with only the specific permission for the above function: | ||
// TODO: We don't have such permissions subset | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added this todo to revisit this topic |
||
Also, the `pg_tde_(grant/revoke)_(global/database)_key_management_to_role` function deals with only the specific permission for the above function: | ||
it allows a user to change the key for the database, but not to modify the provider configuration. | ||
|
||
### Creating encrypted tables | ||
|
This file contains 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have permission differentiation for key and providers administration. Is it something that we are planning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but maybe we should look closer at why and how we actually want multi-tenancy to work because the ability to create key providers is actually quite dnagerous.