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

PMM-13132 Encryption rotation. #3199

Merged
merged 253 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 243 commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
1872323
PMM-13129 Tidy.
JiriCtvrtka May 23, 2024
60966fd
PMM-13129 Migration basics.
JiriCtvrtka May 27, 2024
46b24db
PMM-13129 Format.
JiriCtvrtka May 27, 2024
f6dcd35
PMM-13129 Encrypt, EncryptDB, Decrypt, DecryptDB, refactor.
JiriCtvrtka May 28, 2024
01a1004
PMM-13129 Encryption test workflow.
JiriCtvrtka May 28, 2024
ed5fdbb
PMM-13129 Remove install.
JiriCtvrtka May 28, 2024
b02b7fd
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 3, 2024
767b555
PMM-13129 Encrypt/Decrypt agents.
JiriCtvrtka Jun 5, 2024
81a074b
PMM-13129 Changes.
JiriCtvrtka Jun 10, 2024
40cb73c
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 10, 2024
6de482d
PMM-13145 Fix for tests.
JiriCtvrtka Jun 10, 2024
a27df51
Merge branch 'PMM-13129-encryption' of github.com:percona/pmm into PM…
JiriCtvrtka Jun 10, 2024
142c5e5
PMM-13129 Fix Mongo test.
JiriCtvrtka Jun 10, 2024
a1ba20e
PMM-13129 Fix.
JiriCtvrtka Jun 10, 2024
b9f8cd8
PMM-13129 Encrypt fixture.
JiriCtvrtka Jun 10, 2024
ab2a641
PMM-13129 Encryption test.
JiriCtvrtka Jun 10, 2024
c518942
PMM-13129 File mode test.
JiriCtvrtka Jun 10, 2024
66996a2
PMM-13129 Fix credentials for test env.
JiriCtvrtka Jun 10, 2024
81e22b7
PMM-13129 Clean.
JiriCtvrtka Jun 10, 2024
c386d1d
PMM-13129 Correct DB for encryption test.
JiriCtvrtka Jun 10, 2024
cb200b1
PMM-13129 Moved to utils folder.
JiriCtvrtka Jun 12, 2024
f953b92
PMM-13129 Empty password fix.
JiriCtvrtka Jun 12, 2024
70e9634
PMM-13129 Debug logs to warning level.
JiriCtvrtka Jun 12, 2024
bccf86e
PMM-13129 Format.
JiriCtvrtka Jun 12, 2024
3e64fba
PMM-13129 Small change in generated query.
JiriCtvrtka Jun 14, 2024
917de87
PMM-13129 Password set check.
JiriCtvrtka Jun 17, 2024
6146958
PMM-13129 Fix wrong field.
JiriCtvrtka Jun 17, 2024
7a12c8f
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 19, 2024
cf2c40f
PMM-13129 Init in migration.
JiriCtvrtka Jun 19, 2024
38beab9
PMM-13129 Precheck if already encrypted, moved into managed utils.
JiriCtvrtka Jun 20, 2024
2846918
PMM-13129 Migration.
JiriCtvrtka Jun 20, 2024
25408b1
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 21, 2024
f745581
PMM-13129 Fix for EncryptDB. Encrypt/Decrypt username.
JiriCtvrtka Jun 23, 2024
dce40dd
Merge branch 'PMM-13129-encryption' of github.com:percona/pmm into PM…
JiriCtvrtka Jun 23, 2024
a4f9262
PMM-13129 Formatting of encryption error, createAgent username fix.
JiriCtvrtka Jun 24, 2024
f9518d5
PMM-13129 Remove unused method for now.
JiriCtvrtka Jun 24, 2024
00dae9c
PMM-13129 Correct mode for cert file.
JiriCtvrtka Jun 24, 2024
e8ee71e
PMM-13129 Remove DB test, small refactor.
JiriCtvrtka Jun 24, 2024
285275a
PMM-13129 Encryption for external exporter.
JiriCtvrtka Jun 24, 2024
3627429
PMM-13129 Fix tests after external exporter encryption.
JiriCtvrtka Jun 24, 2024
abebb36
PMM-13129 Fix mongo tests.
JiriCtvrtka Jun 24, 2024
a03ed0d
PMM-13129 Fix another test to expect encrypted username.
JiriCtvrtka Jun 24, 2024
08f4f8f
PMM-13129 Another fix for tests to expect encrypted username.
JiriCtvrtka Jun 24, 2024
2bf51de
PMM-13129 Fix for DecryptDB.
JiriCtvrtka Jun 24, 2024
72968d1
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 24, 2024
16b9b40
PMM-13129 Err if encryption is not initialized.
JiriCtvrtka Jun 24, 2024
ec3f391
PMM-13129 Delimiter fix.
JiriCtvrtka Jun 24, 2024
e799003
PMM-13129 Fix DecryptDB.
JiriCtvrtka Jun 24, 2024
9e255f2
PMM-13129 Small change in agent test.
JiriCtvrtka Jun 24, 2024
fbd3ee6
PMM-13129 Fix non related test to make it green for now.
JiriCtvrtka Jun 24, 2024
06314c2
PMM-13129 Add license headers.
JiriCtvrtka Jun 25, 2024
f94745b
PMM-13129 License.
JiriCtvrtka Jun 25, 2024
be8bc4c
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 25, 2024
3f3391b
PMM-13129 Lint.
JiriCtvrtka Jun 25, 2024
edd87e9
Merge branch 'PMM-13129-encryption' of github.com:percona/pmm into PM…
JiriCtvrtka Jun 25, 2024
bc8146d
PMM-13129 Another lint.
JiriCtvrtka Jun 25, 2024
40196bf
PMM-13129 Lint.
JiriCtvrtka Jun 25, 2024
d991077
PMM-13129 Default encryption changes.
JiriCtvrtka Jun 25, 2024
f8f7368
PMM-13129 Encrypt, decrypt all other secret, credentials in agents.
JiriCtvrtka Jun 25, 2024
ea60e41
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 26, 2024
bba01fd
PMM-13129 Changes, some refactors.
JiriCtvrtka Jun 26, 2024
d7449be
Merge branch 'PMM-13129-encryption' of github.com:percona/pmm into PM…
JiriCtvrtka Jun 26, 2024
c423e1d
PMM-13129 Another changes.
JiriCtvrtka Jun 26, 2024
9790f7c
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 26, 2024
5ab0a81
PMM-13129 Refactor.
JiriCtvrtka Jun 26, 2024
bc249ff
PMM-13129 Fix.
JiriCtvrtka Jun 26, 2024
8c9d21a
PMM-13129 Changes.
JiriCtvrtka Jun 26, 2024
f35ad67
PMM-13129 Changes.
JiriCtvrtka Jun 26, 2024
d1abf77
PMM-13129 Save.
JiriCtvrtka Jun 26, 2024
88271bb
PMM-13129 Changes.
JiriCtvrtka Jun 27, 2024
9bb9b8a
PMM-13129 Another changes.
JiriCtvrtka Jun 27, 2024
92a1b59
PMM-13129 Refactor, another changes.
JiriCtvrtka Jun 27, 2024
e3fe487
PMM-13129 Disable migration encryption until it is done.
JiriCtvrtka Jun 27, 2024
29d90df
PMM-13129 Basics for settings and migration.
JiriCtvrtka Jun 27, 2024
952ecef
PMM-13129 Original code for isPasswordSet.
JiriCtvrtka Jun 27, 2024
9d3d1ea
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jun 27, 2024
8467292
PMM-13129 Fix current settings test.
JiriCtvrtka Jun 27, 2024
192cc1f
Merge branch 'PMM-13129-encryption' of github.com:percona/pmm into PM…
JiriCtvrtka Jun 27, 2024
a5d0d35
PMM-13129 Basic changes to be able pass custom handlers.
JiriCtvrtka Jul 1, 2024
3ea748a
PMM-13129 Handlers, PG handler.
JiriCtvrtka Jul 1, 2024
639a567
PMM-13129 Refactor.
JiriCtvrtka Jul 1, 2024
80e42d0
PMM-13129 Changes, refactor.
JiriCtvrtka Jul 1, 2024
21b74e4
PMM-13129 Migrate and encrypt all possible fields.
JiriCtvrtka Jul 1, 2024
1478695
PMM-13129 Fix for service info broker.
JiriCtvrtka Jul 1, 2024
96e2026
PMM-13129 Fix for settings helper test.
JiriCtvrtka Jul 1, 2024
6a2d4f2
PMM-13129 Refactor.
JiriCtvrtka Jul 1, 2024
32fa22f
PMM-13129 Lint.
JiriCtvrtka Jul 1, 2024
2ff1602
PMM-13129 Lint.
JiriCtvrtka Jul 1, 2024
206e7a0
PMM-13129 Format.
JiriCtvrtka Jul 1, 2024
e20d52a
PMM-13129 Fix settings helpers test.
JiriCtvrtka Jul 1, 2024
c7edac8
PMM-13129 License header.
JiriCtvrtka Jul 1, 2024
ec6e6fe
PMM-13129 Another lint.
JiriCtvrtka Jul 1, 2024
5d379a3
PMM-13129 Lint.
JiriCtvrtka Jul 1, 2024
252741b
PMM-13129 Changes to fix tests. Refactor.
JiriCtvrtka Jul 2, 2024
cfeb84e
PMM-13129 Format.
JiriCtvrtka Jul 2, 2024
af6b061
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jul 2, 2024
7854d50
PMM-13129 Fix.
JiriCtvrtka Jul 2, 2024
5f0094d
PMM-13129 Encrypt items now receive opened DB connection, refactor.
JiriCtvrtka Jul 2, 2024
12c3bb1
PMM-13129 Lint (correct ctx).
JiriCtvrtka Jul 2, 2024
0d0bef4
PMM-13129 Refactor, lint.
JiriCtvrtka Jul 2, 2024
3a5bd60
PMM-13129 Check.
JiriCtvrtka Jul 2, 2024
7fbe257
PMM-13129 Lint.
JiriCtvrtka Jul 2, 2024
586b75a
PMM-13129 Fix settings test.
JiriCtvrtka Jul 2, 2024
15244cb
PMM-13129 Fix to prevent double encryption on setup fixtures.
JiriCtvrtka Jul 2, 2024
e2c720e
PMM-13129 Changes.
JiriCtvrtka Jul 2, 2024
d0a454c
PMM-13129 Encrypt only basic fields in tests (migration).
JiriCtvrtka Jul 2, 2024
64f8b13
PMM-13129 Test.
JiriCtvrtka Jul 2, 2024
b55d559
PMM-13129 Lint.
JiriCtvrtka Jul 2, 2024
8861cbe
PMM-13129 Different encrypted columns for different migration versions.
JiriCtvrtka Jul 2, 2024
98bf78f
PMM-13129 Fix.
JiriCtvrtka Jul 2, 2024
9544ea0
PMM-13129 TODO.
JiriCtvrtka Jul 2, 2024
a4cad29
PMM-13129 TODO.
JiriCtvrtka Jul 3, 2024
98dee60
PMM-13129 Check for nothing to encrypt.
JiriCtvrtka Jul 3, 2024
b4714bf
PMM-13129 Encrypted fields based on migration version.
JiriCtvrtka Jul 3, 2024
a0cea8b
PMM-13129 Better debug.
JiriCtvrtka Jul 3, 2024
a1df8c8
PMM-13129 Lint.
JiriCtvrtka Jul 3, 2024
a55f422
PMM-13129 Fix, better debug.
JiriCtvrtka Jul 3, 2024
3821c70
PMM-13129 Exit in case of encryption initialization error.
JiriCtvrtka Jul 3, 2024
b009d0f
PMM-13129 Handle nil migration version.
JiriCtvrtka Jul 3, 2024
f4bdf3d
PMM-13129 Typo.
JiriCtvrtka Jul 3, 2024
5f67dcc
PMM-13129 Fix for service broker and connection check.
JiriCtvrtka Jul 3, 2024
e3b1341
PMM-13129 Comments.
JiriCtvrtka Jul 3, 2024
1e147a2
PMM-13129 Remove debug logging.
JiriCtvrtka Jul 4, 2024
fb85645
PMM-13129 Remove pointer in EncryptAgent, DecryptAgent.
JiriCtvrtka Jul 4, 2024
db7cff7
PMM-13129 Fix.
JiriCtvrtka Jul 4, 2024
68be0a5
PMM-13129 Fix for service_info_broker.
JiriCtvrtka Jul 4, 2024
46c6cd6
PMM-13129 Fix service_info_broker options pointer propagation.
JiriCtvrtka Jul 4, 2024
b68421a
PMM-13129 Fix for custom labels after removed pointer.
JiriCtvrtka Jul 4, 2024
53ba9a9
PMM-13129 Hide cipherText in error message.
JiriCtvrtka Jul 5, 2024
fae5504
PMM-13129 Panic in case of unavailable encryption.
JiriCtvrtka Jul 5, 2024
db111b8
PMM-13129 Remove CA certificates from encryption/decryption.
JiriCtvrtka Jul 5, 2024
b9bf58b
PMM-13129 Required refactor.
JiriCtvrtka Jul 5, 2024
54c215e
Update api/serverpb/server.proto
JiriCtvrtka Jul 5, 2024
7dcabf4
Update managed/models/database.go
JiriCtvrtka Jul 5, 2024
607450e
Update managed/utils/encryption/encryption.go
JiriCtvrtka Jul 5, 2024
5e40835
Update managed/utils/encryption/models.go
JiriCtvrtka Jul 5, 2024
ae77773
Update managed/utils/encryption/models.go
JiriCtvrtka Jul 5, 2024
fde529b
Update managed/utils/encryption/helpers.go
JiriCtvrtka Jul 5, 2024
f2b6838
Merge branch 'PMM-13129-encryption' of github.com:percona/pmm into PM…
JiriCtvrtka Jul 5, 2024
f5def78
PMM-13129 Gen.
JiriCtvrtka Jul 5, 2024
fc78344
PMM-13129 Identifiers word.
JiriCtvrtka Jul 5, 2024
cab2773
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jul 8, 2024
ff38d33
PMM-13129 Remove CAs from handlers.
JiriCtvrtka Jul 9, 2024
0a069f5
Update managed/models/settings.go
JiriCtvrtka Jul 9, 2024
dfcb8d1
Update managed/utils/encryption/encryption.go
JiriCtvrtka Jul 9, 2024
82d881f
Update managed/utils/encryption/encryption.go
JiriCtvrtka Jul 9, 2024
d2b64da
Merge branch 'PMM-13129-encryption' of github.com:percona/pmm into PM…
JiriCtvrtka Jul 9, 2024
fe3be31
PMM-13129 Dereference all DB options on encrypt/decrypt.
JiriCtvrtka Jul 9, 2024
903b4ef
PMM-13129 Custom labels.
JiriCtvrtka Jul 9, 2024
9fd8982
Revert "PMM-13129 Custom labels."
JiriCtvrtka Jul 9, 2024
f955040
Revert "PMM-13129 Dereference all DB options on encrypt/decrypt."
JiriCtvrtka Jul 9, 2024
687a2e2
Reapply "PMM-13129 Custom labels."
JiriCtvrtka Jul 9, 2024
f09bef1
Reapply "PMM-13129 Dereference all DB options on encrypt/decrypt."
JiriCtvrtka Jul 9, 2024
0229c65
PMM-13129 Remove old migrations tests, required refactor.
JiriCtvrtka Jul 9, 2024
c7dd080
Revert "Reapply "PMM-13129 Custom labels.""
JiriCtvrtka Jul 9, 2024
771ca54
Revert "Reapply "PMM-13129 Dereference all DB options on encrypt/decr…
JiriCtvrtka Jul 9, 2024
98e51be
PMM-13129 Logic change.
JiriCtvrtka Jul 9, 2024
41d98db
PMM-13129 Remove username, aws_access_key, aws_secret_key from enc.
JiriCtvrtka Jul 9, 2024
e4fab91
PMM-13129 Env variable for custom encryption key.
JiriCtvrtka Jul 9, 2024
70bda62
PMM-13129 Custom key for main check.
JiriCtvrtka Jul 9, 2024
21e94f1
PMM-13129 Remove decrypt agent from create agent methods.
JiriCtvrtka Jul 9, 2024
3690411
PMM-13129 Change to skip empty values from encryption.
JiriCtvrtka Jul 10, 2024
028312d
PMM-13129 Remove unused struct.
JiriCtvrtka Jul 10, 2024
f0eb328
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jul 10, 2024
1b6ef0f
Update managed/models/database.go
JiriCtvrtka Jul 11, 2024
caad234
PMM-13129 Renaming of variable.
JiriCtvrtka Jul 11, 2024
2ffdc3a
PMM-13129 Remove EncryptedItems field from settings proto.
JiriCtvrtka Jul 11, 2024
5d0583b
PMM-13129 Workaround to create FB for now. Will be reverted.
JiriCtvrtka Jul 11, 2024
e524c23
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jul 22, 2024
2af5bca
PMM-13129 Fix connection checker dsn bug.
JiriCtvrtka Jul 23, 2024
0788e74
PMM-13129 Another dsn bug.
JiriCtvrtka Jul 23, 2024
fb76317
PMM-13129 Add back decrypt after insert to fix connection checker.
JiriCtvrtka Jul 23, 2024
d70d472
PMM-13129 Update reduct words.
JiriCtvrtka Jul 23, 2024
2bcb756
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Jul 23, 2024
5929939
PMM-13129 Fix for test after new redact word.
JiriCtvrtka Jul 23, 2024
182b3d7
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Sep 9, 2024
8a805fe
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Sep 12, 2024
74edcb1
PMM-13132 Basics.
JiriCtvrtka Sep 12, 2024
3e62767
PMM-13132 Some changes.
JiriCtvrtka Sep 12, 2024
97bed88
PMM-13132 Make format.
JiriCtvrtka Sep 12, 2024
50fead6
PMM-13132 Mod fix, tidy.
JiriCtvrtka Sep 12, 2024
fcf215d
PMM-13132 Fix.
JiriCtvrtka Sep 12, 2024
57a2024
PMM-13132 Changes.
JiriCtvrtka Sep 12, 2024
937bbcd
PMM-13132 Changes.
JiriCtvrtka Sep 12, 2024
8961b3f
PMM-13132 Rotation.
JiriCtvrtka Sep 16, 2024
0176934
PMM-13132 Format.
JiriCtvrtka Sep 16, 2024
65d2234
PMM-13132 Changes.
JiriCtvrtka Sep 16, 2024
782e82f
PMM-13132 Fix.
JiriCtvrtka Sep 16, 2024
2cb54e1
PMM-13132 Backup and restore of previous key.
JiriCtvrtka Sep 16, 2024
b0ddeab
PMM-13132 Changes.
JiriCtvrtka Sep 16, 2024
ad3fec9
PMM-13132 Lint.
JiriCtvrtka Sep 16, 2024
dd8a75b
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Sep 18, 2024
cb5b6c5
Merge branch 'PMM-13129-encryption' into PMM-13132-encryption-rotation
JiriCtvrtka Sep 18, 2024
50f0c83
PMM-13132 Correct message.
JiriCtvrtka Sep 18, 2024
07edcc7
PMM-13132 Changes related to tests.
JiriCtvrtka Sep 18, 2024
a1de53c
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Sep 18, 2024
4a0588b
Merge branch 'PMM-13129-encryption' into PMM-13132-encryption-rotation
JiriCtvrtka Sep 18, 2024
c8e275f
PMM-13132 Test for whole cycle.
JiriCtvrtka Sep 18, 2024
8107431
PMM-13132 Handle OS interuptions.
JiriCtvrtka Sep 18, 2024
a60eda2
PMM-13132 Lint.
JiriCtvrtka Sep 18, 2024
3474974
PMM-13132 Lint.
JiriCtvrtka Sep 18, 2024
7e58301
PMM-13132 Logger and logs.
JiriCtvrtka Sep 18, 2024
e8f94bf
PMM-13132 Test DB.
JiriCtvrtka Sep 18, 2024
5fb3fe6
Revert "PMM-13132 Test DB."
JiriCtvrtka Sep 18, 2024
977c64f
PMM-13132 Changes, CI.
JiriCtvrtka Sep 18, 2024
23d5d33
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Sep 19, 2024
be0c4b7
Merge branch 'PMM-13129-encryption' into PMM-13132-encryption-rotation
JiriCtvrtka Sep 19, 2024
7986a5b
PMM-13132 Fix in test.
JiriCtvrtka Sep 19, 2024
236ade5
PMM-13132 Changes.
JiriCtvrtka Sep 19, 2024
d5e479d
PMM-13132 Skip encryption-rotation test in main test.
JiriCtvrtka Sep 19, 2024
7ff24b6
PMM-13132 Basic makefile for encryption-rotation.
JiriCtvrtka Sep 19, 2024
f59d89c
PMM-13132 Remove duplicate defaults.
JiriCtvrtka Sep 19, 2024
699f31e
PMM-13132 Changes in workflow.
JiriCtvrtka Sep 19, 2024
a047d3e
PMM-13132 Remove devcontainer from makefile.
JiriCtvrtka Sep 19, 2024
45125df
PMM-13132 Add ENV variable for rotation key.
JiriCtvrtka Sep 19, 2024
6f4a525
PMM-13132 Add PG.
JiriCtvrtka Sep 19, 2024
5e6a3d8
PMM-13132 Remove user, pass in PG compose.
JiriCtvrtka Sep 19, 2024
fbc86a8
PMM-13132 Test of user.
JiriCtvrtka Sep 19, 2024
da0ff75
PMM-13132 Change path for test.
JiriCtvrtka Sep 19, 2024
ae7094f
PMM-13132 Test of simpler structure.
JiriCtvrtka Sep 19, 2024
e3d146a
PMM-13132 Another changes in structure.
JiriCtvrtka Sep 19, 2024
d38a8ca
PMM-13132 Another changes to simplify rotation.
JiriCtvrtka Sep 19, 2024
d978cc3
PMM-13132 Format.
JiriCtvrtka Sep 19, 2024
ec82c91
PMM-13132 Improvements.
JiriCtvrtka Sep 19, 2024
b13abe8
PMM-13132 Add command to makefile, lint.
JiriCtvrtka Sep 19, 2024
7aeaec5
PMM-13132 Lint.
JiriCtvrtka Sep 19, 2024
096fc93
PMM-13132 Lint.
JiriCtvrtka Sep 19, 2024
229e08a
PMM-13132 Wrappers around default on newly added methods.
JiriCtvrtka Sep 19, 2024
89692ac
PMM-13132 Move into cmd of pmm-managed.
JiriCtvrtka Sep 20, 2024
f603530
PMM-13132 Suggested refactor.
JiriCtvrtka Sep 20, 2024
7fab00f
PMM-13132 Another suggested refactor.
JiriCtvrtka Sep 20, 2024
8a86a53
PMM-13132 Fix.
JiriCtvrtka Sep 20, 2024
e27d3b0
PMM-13132 Move encryption models into encryption file.
JiriCtvrtka Sep 23, 2024
07921cf
PMM-13132 Make.
JiriCtvrtka Sep 23, 2024
8d9d4cc
PMM-13132 Migration to kong.
JiriCtvrtka Sep 23, 2024
999c4c8
PMM-13132 Add consts.
JiriCtvrtka Sep 23, 2024
dd463b6
PMM-13132 Lint.
JiriCtvrtka Sep 23, 2024
6dbc1f9
PMM-13132 Specs.
JiriCtvrtka Sep 23, 2024
751c084
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Sep 23, 2024
3f00936
Merge branch 'PMM-13129-encryption' into PMM-13132-encryption-rotation
JiriCtvrtka Sep 23, 2024
32a760d
PMM-13132 Move encryption rotation to services.
JiriCtvrtka Sep 23, 2024
f4211bf
PMM-13132 Lint.
JiriCtvrtka Sep 24, 2024
6539cbf
PMM-13132 Add interval and retries.
JiriCtvrtka Sep 24, 2024
c1d804d
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Oct 4, 2024
6dff2a2
Merge branch 'PMM-13129-encryption' into PMM-13132-encryption-rotation
JiriCtvrtka Oct 4, 2024
ae1fc4f
Merge branch 'v3' into PMM-13129-encryption
JiriCtvrtka Oct 8, 2024
e57a73a
Merge branch 'PMM-13129-encryption' into PMM-13132-encryption-rotation
JiriCtvrtka Oct 8, 2024
e820038
Merge branch 'v3' into PMM-13132-encryption-rotation
JiriCtvrtka Nov 4, 2024
123f444
PMM-13132 Fix after conflicts.
JiriCtvrtka Nov 4, 2024
de5de5c
Merge branch 'v3' into PMM-13132-encryption-rotation
JiriCtvrtka Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
name: Checks
runs-on: ubuntu-22.04

env:
PMM_ENCRYPTION_KEY_PATH: pmm-encryption.key

steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ TARGET ?= _bash
env: ## Run `make TARGET` in devcontainer (`make env TARGET=help`); TARGET defaults to bash
COMPOSE_PROFILES=$(PROFILES) \
docker exec -it --workdir=/root/go/src/github.com/percona/pmm pmm-server make $(TARGET)

rotate-encryption: ## Rotate encryption key
go run ./encryption-rotation/main.go
5 changes: 5 additions & 0 deletions build/packages/rpm/server/SPECS/pmm-managed.spec
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ install -d -p %{buildroot}%{_sbindir}
install -d -p %{buildroot}%{_datadir}/%{name}
install -d -p %{buildroot}%{_datadir}/pmm-ui
install -p -m 0755 bin/pmm-managed %{buildroot}%{_sbindir}/pmm-managed
install -p -m 0755 bin/pmm-encryption-rotation %{buildroot}%{_sbindir}/pmm-encryption-rotation
install -p -m 0755 bin/pmm-managed-init %{buildroot}%{_sbindir}/pmm-managed-init
install -p -m 0755 bin/pmm-managed-starlark %{buildroot}%{_sbindir}/pmm-managed-starlark

Expand All @@ -62,12 +63,16 @@ cp -pa ./ui/dist/. %{buildroot}%{_datadir}/pmm-ui
%license src/%{provider}/LICENSE
%doc src/%{provider}/README.md
%{_sbindir}/pmm-managed
%{_sbindir}/pmm-encryption-rotation
%{_sbindir}/pmm-managed-init
%{_sbindir}/pmm-managed-starlark
%{_datadir}/%{name}
%{_datadir}/pmm-ui

%changelog
* Mon Sep 23 2024 Jiri Ctvrtka <[email protected]> - 3.0.0-1
- PMM-13132 add PMM encryption rotation tool

* Fri Mar 22 2024 Matej Kubinec <[email protected]> - 3.0.0-1
- PMM-11231 add pmm ui

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ require (
github.com/go-sql-driver/mysql v1.7.1
github.com/gogo/status v1.1.1
github.com/golang-migrate/migrate/v4 v4.17.0
github.com/google/tink/go v1.7.0
github.com/google/uuid v1.6.0
github.com/grafana/grafana-api-golang-client v0.27.0
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
Expand Down Expand Up @@ -65,6 +66,7 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/objx v0.5.2
github.com/stretchr/testify v1.9.0
github.com/tink-crypto/tink-go v0.0.0-20230613075026-d6de17e3f164
go.mongodb.org/mongo-driver v1.16.1
go.starlark.net v0.0.0-20230717150657-8a3343210976
golang.org/x/crypto v0.26.0
Expand Down Expand Up @@ -101,7 +103,6 @@ require (
github.com/google/btree v1.0.0 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
github.com/hashicorp/go-msgpack/v2 v2.1.1 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/miekg/dns v1.1.41 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/tink/go v1.7.0 h1:6Eox8zONGebBFcCBqkVmt60LaWZa6xg1cl/DwAh/J1w=
github.com/google/tink/go v1.7.0/go.mod h1:GAUOd+QE3pgj9q8VKIGTCP33c/B7eb4NhxLcgTJZStM=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down Expand Up @@ -508,6 +510,8 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tink-crypto/tink-go v0.0.0-20230613075026-d6de17e3f164 h1:yhVO0Yhq84FjdcotvFFvDJRNHJ7mO743G12VdcW4Evc=
github.com/tink-crypto/tink-go v0.0.0-20230613075026-d6de17e3f164/go.mod h1:HhtDVdE/PRZFRia834tkmcwuscnaAzda1RJUW9Pr3Rg=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
Expand Down
4 changes: 3 additions & 1 deletion managed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ clean: ## Remove generated files

release: ## Build pmm-managed release binaries
env CGO_ENABLED=0 go build -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/...
$(PMM_RELEASE_PATH)/pmm-managed --version

release-encryption-rotation: ## Build PMM encryption rotation tool
env CGO_ENABLED=0 go build -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/pmm-encryption-rotation/...

release-starlark:
env CGO_ENABLED=0 go build -v $(PMM_LD_FLAGS) -o $(PMM_RELEASE_PATH)/ ./cmd/pmm-managed-starlark/...
Expand Down
94 changes: 94 additions & 0 deletions managed/cmd/pmm-encryption-rotation/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright (C) 2023 Percona LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// Package main is the main package for encryption keys rotation.
package main

import (
"fmt"
"os"
"os/signal"
"syscall"

"github.com/alecthomas/kong"
"github.com/sirupsen/logrus"

"github.com/percona/pmm/managed/models"
"github.com/percona/pmm/utils/logger"
"github.com/percona/pmm/version"
)

const codeDBConnectionFailed = 1

func main() {
signal.Ignore(syscall.SIGINT, syscall.SIGTERM) // to prevent any interuptions during process

logger.SetupGlobalLogger()

logrus.Infof("PMM Encryption Rotation Tools version: %s", version.Version)

sqlDB, err := models.OpenDB(setupParams())
if err != nil {
logrus.Error(err)
os.Exit(codeDBConnectionFailed)
}

statusCode := models.RotateEncryptionKey(sqlDB, "pmm-managed")
sqlDB.Close() //nolint:errcheck

os.Exit(statusCode)
}

type flags struct {
Address string `name:"postgres-addr" default:"${address}" help:"PostgreSQL address with port"`
DBName string `name:"postgres-name" default:"pmm-managed" help:"PostgreSQL database name"`
DBUsername string `name:"postgres-username" default:"pmm-managed" help:"PostgreSQL database username name"`
DBPassword string `name:"postgres-password" default:"pmm-managed" help:"PostgreSQL database password"`
SSLMode string `name:"postgres-ssl-mode" default:"${disable_sslmode}" help:"PostgreSQL SSL mode" enum:"${disable_sslmode}, ${require_sslmode},${verify_sslmode}, ${verify_full_sslmode}"` //nolint:lll
SSLCAPath string `name:"postgres-ssl-ca-path" help:"PostgreSQL SSL CA root certificate path" type:"path"`
SSLKeyPath string `name:"postgres-ssl-key-path" help:"PostgreSQL SSL key path" type:"path"`
SSLCertPath string `name:"postgres-ssl-cert-path" help:"PostgreSQL SSL certificate path" type:"path"`
}

func setupParams() models.SetupDBParams {
var opts flags
kong.Parse(
&opts,
kong.Name("encryption-rotation"),
kong.Description(fmt.Sprintf("Version %s", version.Version)),
kong.UsageOnError(),
kong.ConfigureHelp(kong.HelpOptions{
Compact: true,
NoExpandSubcommands: true,
}),
kong.Vars{
"address": models.DefaultPostgreSQLAddr,
"disable_sslmode": models.DisableSSLMode,
"require_sslmode": models.RequireSSLMode,
"verify_sslmode": models.VerifyCaSSLMode,
"verify_full_sslmode": models.VerifyFullSSLMode,
},
)

return models.SetupDBParams{
Address: opts.Address,
Name: opts.DBName,
Username: opts.DBUsername,
Password: opts.DBPassword,
SSLMode: opts.SSLMode,
SSLCAPath: opts.SSLCAPath,
SSLKeyPath: opts.SSLKeyPath,
SSLCertPath: opts.SSLCertPath,
}
}
45 changes: 29 additions & 16 deletions managed/models/agent_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@

agents := make([]*Agent, len(structs))
for i, s := range structs {
agents[i] = s.(*Agent) //nolint:forcetypeassert
decryptedAgent := DecryptAgent(*s.(*Agent)) //nolint:forcetypeassert
agents[i] = &decryptedAgent
}

return agents, nil
Expand All @@ -249,8 +250,9 @@
}
return nil, errors.WithStack(err)
}
decryptedAgent := DecryptAgent(*agent)

return agent, nil
return &decryptedAgent, nil
}

// FindAgentsByIDs finds Agents by IDs.
Expand All @@ -272,7 +274,8 @@

res := make([]*Agent, len(structs))
for i, s := range structs {
res[i] = s.(*Agent) //nolint:forcetypeassert
decryptedAgent := DecryptAgent(*s.(*Agent)) //nolint:forcetypeassert
res[i] = &decryptedAgent
}
return res, nil
}
Expand Down Expand Up @@ -323,7 +326,8 @@

res := make([]*Agent, len(structs))
for i, s := range structs {
res[i] = s.(*Agent) //nolint:forcetypeassert
decryptedAgent := DecryptAgent(*s.(*Agent)) //nolint:forcetypeassert
res[i] = &decryptedAgent
}

if len(res) == 0 {
Expand All @@ -350,8 +354,8 @@

res := make([]*Agent, 0, len(structs))
for _, str := range structs {
row := str.(*Agent) //nolint:forcetypeassert
res = append(res, row)
decryptedAgent := DecryptAgent(*str.(*Agent)) //nolint:forcetypeassert
res = append(res, &decryptedAgent)
}

return res, nil
Expand Down Expand Up @@ -395,8 +399,8 @@
}
res := make([]*Agent, 0, len(pmmAgentRecords))
for _, str := range pmmAgentRecords {
row := str.(*Agent) //nolint:forcetypeassert
res = append(res, row)
decryptedAgent := DecryptAgent(*str.(*Agent)) //nolint:forcetypeassert
res = append(res, &decryptedAgent)
}

return res, nil
Expand Down Expand Up @@ -477,7 +481,8 @@

res := make([]*Agent, len(allAgents))
for i, s := range allAgents {
res[i] = s.(*Agent) //nolint:forcetypeassert
decryptedAgent := DecryptAgent(*s.(*Agent)) //nolint:forcetypeassert
res[i] = &decryptedAgent
}
return res, nil
}
Expand Down Expand Up @@ -624,8 +629,8 @@
return nil, err
}
if !IsPushMetricsSupported(pmmAgent.Version) {
return nil, status.Errorf(codes.FailedPrecondition, "cannot use push_metrics_enabled with pmm_agent version=%q,"+

Check failure on line 632 in managed/models/agent_helpers.go

View workflow job for this annotation

GitHub Actions / Checks

string `cannot use push_metrics_enabled with pmm_agent version=%q,` has 3 occurrences, make it a constant (goconst)
" it doesn't support it, minimum supported version=%q", pointer.GetString(pmmAgent.Version), PMMAgentWithPushMetricsSupport.String())

Check failure on line 633 in managed/models/agent_helpers.go

View workflow job for this annotation

GitHub Actions / Checks

string ` it doesn't support it, minimum supported version=%q` has 3 occurrences, make it a constant (goconst)
}
row := &Agent{
AgentID: id,
Expand All @@ -641,11 +646,14 @@
if err := row.SetCustomLabels(customLabels); err != nil {
return nil, err
}
if err := q.Insert(row); err != nil {

encryptedAgent := EncryptAgent(*row)
if err := q.Insert(&encryptedAgent); err != nil {
return nil, errors.WithStack(err)
}
agent := DecryptAgent(encryptedAgent)

return row, nil
return &agent, nil
}

// CreateExternalExporterParams params for add external exporter.
Expand Down Expand Up @@ -725,11 +733,14 @@
if err := row.SetCustomLabels(params.CustomLabels); err != nil {
return nil, err
}
if err := q.Insert(row); err != nil {

encryptedAgent := EncryptAgent(*row)
if err := q.Insert(&encryptedAgent); err != nil {
return nil, errors.WithStack(err)
}
agent := DecryptAgent(encryptedAgent)

return row, nil
return &agent, nil
}

// CreateAgentParams params for add common exporter.
Expand Down Expand Up @@ -912,15 +923,17 @@
DisabledCollectors: params.DisableCollectors,
LogLevel: pointer.ToStringOrNil(params.LogLevel),
}

if err := row.SetCustomLabels(params.CustomLabels); err != nil {
return nil, err
}
if err := q.Insert(row); err != nil {

encryptedAgent := EncryptAgent(*row)
if err := q.Insert(&encryptedAgent); err != nil {
return nil, errors.WithStack(err)
}
agent := DecryptAgent(encryptedAgent)

return row, nil
return &agent, nil
}

// ChangeCommonAgentParams contains parameters that can be changed for all Agents.
Expand Down
Loading
Loading