Skip to content
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

Move pg_tde files to one dir inside PGDATA #349

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

dAdAbird
Copy link
Member

@dAdAbird dAdAbird commented Nov 15, 2024

This PR gets rid off table spaces references everywhere we can because having it really complicated things and made moving encrypted relation between table spaces really difficult. The main reason of the complexity is that a principal key and a keyring info are created and used in the scope entire database but different relations in the db can be located in different tablespaces. So we shouldn't use tablespaces there is a it (tablespace) belongs to the relation level.

That also means we shouldn't store keyring and internal key files in the database dir but move them to PGDATA/pg_tde. The files layout looks like that:

$ tree $PGDATA/pg_tde
...
├── pg_tde_16384_dat
├── pg_tde_16384_keyring
├── pg_tde_16384_map
├── pg_tde_607_dat
├── pg_tde_607_keyring
├── pg_tde_607_map
└── pg_tde_default_keyring_CHANGE_AND_REMOVE_IT

Fixes: PG-1209, PG-1196, PG-1208

@dAdAbird dAdAbird force-pushed the move-key-files branch 2 times, most recently from 69200ec to 74e6d08 Compare November 18, 2024 18:03
We use tablespaceId as a part of IV for the internal keys encryption
which doesn't add any security because dbId (used as well) is unique
anyway.
But having tablespaceId really complicates things as a principal
created for the entire database but then different relations in this db
can be located in different tablespaces...

So it is better not to use tablespace with the principal key (database
level) as it belongs to the relation level.
@dAdAbird dAdAbird marked this pull request as ready for review November 20, 2024 15:10
@dAdAbird dAdAbird requested a review from dutow as a code owner November 20, 2024 15:10
@dAdAbird dAdAbird requested review from codeforall and dutow and removed request for dutow November 20, 2024 15:10
@dAdAbird dAdAbird merged commit 30cb32b into percona:main Nov 22, 2024
13 checks passed
@dAdAbird dAdAbird deleted the move-key-files branch November 22, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants