You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Attila Bukor (Code Review)" <ge...@cloudera.org> on 2023/06/12 18:34:06 UTC

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Hello Marton Greber, Zoltan Chovan, Alexey Serbin, Abhishek Chennaka,

I'd like you to do a code review. Please visit

    http://gerrit.cloudera.org:8080/20050

to review the following change.


Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate they IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/sys_catalog.cc
M src/kudu/security/token_signing_key.cc
3 files changed, 50 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/1
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 1
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 7:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/catalog_manager.cc
File src/kudu/master/catalog_manager.cc:

http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/catalog_manager.cc@1351
PS5, Line 1351: 
              :   MAYBE_INJECT_RANDOM_LATENCY(FLAGS_catalog_manager_inject_latency_load_ca_info_ms
> The idea is to move this 're-encrypt' logic at the level of InitCertAuthori
That's a good point, changed it.


http://gerrit.cloudera.org:8080/#/c/20050/6/src/kudu/master/sys_catalog.cc
File src/kudu/master/sys_catalog.cc:

http://gerrit.cloudera.org:8080/#/c/20050/6/src/kudu/master/sys_catalog.cc@933
PS6, Line 933:   CHECK_OK(row.SetInt8(kSysCatalogTableColType, CERT_AUTHORITY_INFO));
             :   CHECK_OK(row.SetStringNoCopy(kSysCatalogTableColId, kSysCertAuthorityEntryId));
             :   CHECK_OK(row.SetStringNoCopy(kSysCatalogTableColMetadata, metadata_buf));
             :   RowOperationsPBEncoder enc(req.mutable_row_operations());
             :   enc.Add(op, row);
             : 
             :   return SyncWrite(req);
             : }
             : 
             : 
             : 
             : Status SysCatalogTable::AddTskEntry(const SysTskEntryPB& entry) {
             :   WriteRequestPB req;
             :   req.set_tablet_id(kSysCatalogTabletId);
             :   CHECK_OK(SchemaToPB(schema_, req.mutable_schema()));
             : 
> Is it possible to have an utility method that's parameterized by the operat
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 7
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Fri, 23 Jun 2023 13:54:45 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has removed a vote on this change.

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Removed Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteVote
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 12
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#11).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate the IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/integration-tests/security-itest.cc
M src/kudu/master/catalog_manager.cc
M src/kudu/master/catalog_manager.h
M src/kudu/master/sys_catalog.cc
M src/kudu/master/sys_catalog.h
M src/kudu/security/token_signing_key.cc
6 files changed, 146 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/11
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 11
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#10).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate the IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/integration-tests/security-itest.cc
M src/kudu/master/catalog_manager.cc
M src/kudu/master/catalog_manager.h
M src/kudu/master/sys_catalog.cc
M src/kudu/master/sys_catalog.h
M src/kudu/security/token_signing_key.cc
6 files changed, 145 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/10
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 10
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#6).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate the IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/sys_catalog.cc
M src/kudu/master/sys_catalog.h
M src/kudu/security/token_signing_key.cc
4 files changed, 77 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/6
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 6
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate the IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Reviewed-on: http://gerrit.cloudera.org:8080/20050
Reviewed-by: Alexey Serbin <al...@apache.org>
Tested-by: Alexey Serbin <al...@apache.org>
---
M src/kudu/integration-tests/security-itest.cc
M src/kudu/master/catalog_manager.cc
M src/kudu/master/catalog_manager.h
M src/kudu/master/sys_catalog.cc
M src/kudu/master/sys_catalog.h
M src/kudu/security/token_signing_key.cc
6 files changed, 153 insertions(+), 4 deletions(-)

Approvals:
  Alexey Serbin: Looks good to me, approved; Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 13
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 10:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/20050/9//COMMIT_MSG
Commit Message:

PS9: 
> Is it possible to add a new test scenario to verify that switching from non
Done


http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/catalog_manager.cc
File src/kudu/master/catalog_manager.cc:

http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/catalog_manager.cc@1363
PS9, Line 1363: LOG(INF
> Since that's going to be just a single run when this happens, maybe change 
Done


http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/catalog_manager.cc@1373
PS9, Line 1373: LOG(INF
> ditto
Done


http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/sys_catalog.h
File src/kudu/master/sys_catalog.h:

http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/sys_catalog.h@271
PS9, Line 271: 
> nit: in
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 10
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Mon, 26 Jun 2023 11:47:06 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Marton Greber (Code Review)" <ge...@cloudera.org>.
Marton Greber has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 6: Code-Review+1


-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 6
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Fri, 16 Jun 2023 10:45:43 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#8).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate the IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/catalog_manager.h
M src/kudu/master/sys_catalog.cc
M src/kudu/master/sys_catalog.h
M src/kudu/security/token_signing_key.cc
5 files changed, 97 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/8
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 8
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#3).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate they IPKI key.

A test verifying the cert authority can't be rewritten in the
sys-catalog table has been deleted, as the cert authority can be
rewritten now.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/sys_catalog-test.cc
M src/kudu/master/sys_catalog.cc
M src/kudu/security/token_signing_key.cc
4 files changed, 52 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/3
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 3
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 5: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 5
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Jun 2023 16:04:26 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#5).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate they IPKI key.

A test verifying the cert authority can't be rewritten in the
sys-catalog table has been deleted, as the cert authority can be
rewritten now.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/sys_catalog-test.cc
M src/kudu/master/sys_catalog.cc
M src/kudu/security/token_signing_key.cc
4 files changed, 52 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/5
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 5
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 12: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 12
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Mon, 26 Jun 2023 20:54:10 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 12: Verified+1

unrelated test failures in Java test: org.apache.kudu.spark.kudu.DefaultSourceTest (a known flake)


-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 12
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Mon, 26 Jun 2023 22:06:04 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#7).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate the IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/catalog_manager.h
M src/kudu/master/sys_catalog.cc
M src/kudu/master/sys_catalog.h
M src/kudu/security/token_signing_key.cc
5 files changed, 96 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/7
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 7
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 5:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/20050/5//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/20050/5//COMMIT_MSG@24
PS5, Line 24: they
> nit: the
Done


http://gerrit.cloudera.org:8080/#/c/20050/5//COMMIT_MSG@27
PS5, Line 27: has been deleted
> Consider introducing a dedicated method there, instead of re-using AddCertA
Done


http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/catalog_manager.cc
File src/kudu/master/catalog_manager.cc:

http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/catalog_manager.cc@1351
PS5, Line 1351:       RETURN_NOT_OK_PREPEND(sys_catalog_->AddCertAuthorityEntry(info),
              :                             "IPKI certificate couldn't be written to syscatalog");
> Did you consider doing this not in LoadCertAuthorityInfo(), but in the oute
I'm not sure I agree, we're not generating a new CA in this case, just changing the way it's stored, while using the same key as before. Also, LoadCertAuthorityInfo() method is called in two separate places, so we'd need to handle this in two different places instead of in a single place.


http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/sys_catalog.cc
File src/kudu/master/sys_catalog.cc:

http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/sys_catalog.cc@927
PS5, Line 927: enc.Add(RowOperationsPB::UPSERT, row);
> Maybe, introduce a separate dedicated method UpdateCertAuthorityEntry() or 
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 5
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Fri, 16 Jun 2023 07:29:18 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 5:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/20050/5//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/20050/5//COMMIT_MSG@24
PS5, Line 24: they
nit: the


http://gerrit.cloudera.org:8080/#/c/20050/5//COMMIT_MSG@27
PS5, Line 27: has been deleted
Consider introducing a dedicated method there, instead of re-using AddCertAuthorityEntry() from different semantic contexts.


http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/catalog_manager.cc
File src/kudu/master/catalog_manager.cc:

http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/catalog_manager.cc@1351
PS5, Line 1351:       RETURN_NOT_OK_PREPEND(sys_catalog_->AddCertAuthorityEntry(info),
              :                             "IPKI certificate couldn't be written to syscatalog");
Did you consider doing this not in LoadCertAuthorityInfo(), but in the outer scope?  For example, in InitCertAuthority().  That way it would be cleaner from the logical perspective: LoadCertAuthorityInfo() would only try to load the data, but not modify it.

In that approach, LoadCertAuthorityInfo() could return an extra piece of information (via an 'out' parameter?), so the follow-up actions up updating the CA information would be contained in the InitCertAuthority() scope.


http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/sys_catalog.cc
File src/kudu/master/sys_catalog.cc:

http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/sys_catalog.cc@927
PS5, Line 927: enc.Add(RowOperationsPB::UPSERT, row);
Maybe, introduce a separate dedicated method UpdateCertAuthorityEntry() or RewriteCertAuthorityEntry() for this use-case of encrypting the CA data?  Code-wise, it could share the code, but it's important to call a proper method from particular semantic context.  The reason is documented in a long comment in CatalogManager::InitCertAuthority() under the 'if (s.IsNotFound())' scope.  Basically, that's to have a guarantee that upon first generation of the CA information a multi-master cluster will not end up having two different CA data in the system catalog.



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 5
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Thu, 15 Jun 2023 22:17:32 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Marton Greber (Code Review)" <ge...@cloudera.org>.
Marton Greber has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 5: Code-Review+1


-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 5
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Thu, 15 Jun 2023 14:31:57 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 5:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/catalog_manager.cc
File src/kudu/master/catalog_manager.cc:

http://gerrit.cloudera.org:8080/#/c/20050/5/src/kudu/master/catalog_manager.cc@1351
PS5, Line 1351:       RETURN_NOT_OK_PREPEND(sys_catalog_->AddCertAuthorityEntry(info),
              :                             "IPKI certificate couldn't be written to syscatalog");
> I'm not sure I agree, we're not generating a new CA in this case, just chan
The idea is to move this 're-encrypt' logic at the level of InitCertAuthority(), to be called from the same place as StoreCertAuthorityInfo(). 

LoadCertAuthorityInfo() called from follower master shouldn't even try to update the information in the system catalog, so that's one more fact against having this logic here in LoadCertAuthorityInfo().


http://gerrit.cloudera.org:8080/#/c/20050/6/src/kudu/master/sys_catalog.cc
File src/kudu/master/sys_catalog.cc:

http://gerrit.cloudera.org:8080/#/c/20050/6/src/kudu/master/sys_catalog.cc@933
PS6, Line 933:   WriteRequestPB req;
             :   req.set_tablet_id(kSysCatalogTabletId);
             :   CHECK_OK(SchemaToPB(schema_, req.mutable_schema()));
             : 
             :   CHECK(entry.tsk().has_key_seq_num());
             :   CHECK(entry.tsk().has_expire_unix_epoch_seconds());
             :   CHECK(entry.tsk().has_rsa_key_der());
             : 
             :   faststring metadata_buf;
             :   pb_util::SerializeToString(entry, &metadata_buf);
             : 
             :   // This is crucial to keep entry_id alive until its put into the
             :   // WriteRequestPB object by RowOperationsPBEncoder.
             :   const string entry_id = TskSeqNumberToEntryId(entry.tsk().key_seq_num());
             : 
             :   KuduPartialRow row(&sc
Is it possible to have an utility method that's parameterized by the operation, and UpdateCertAuthorityEntry() and AddCertAuthorityEntry() would call the method with corresponding parameter set?



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 5
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Wed, 21 Jun 2023 18:36:24 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#9).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate the IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/catalog_manager.h
M src/kudu/master/sys_catalog.cc
M src/kudu/master/sys_catalog.h
M src/kudu/security/token_signing_key.cc
5 files changed, 97 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/9
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 9
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 9: Code-Review+1

(4 comments)

Overall looks good to me, just a request to add a test and add more logging for traceability.

http://gerrit.cloudera.org:8080/#/c/20050/9//COMMIT_MSG
Commit Message:

PS9: 
Is it possible to add a new test scenario to verify that switching from non-encrypted to encrypted keys works as expected?  That's to cover the newly introduced functionality, and to catch regressions (if any) in the future.

The scenario seems to be straightforward:
* create a start a new Kudu cluster with IPKI and TSK keys stored non-encrypted in the system catalog
* create a new a Kudu client, connect to the cluster, create a table, write some data into the table
* stop the cluster
* add the flags to store the keys encrypted
* start the cluster back
* make sure the client that has the CA cert from the prior run of the cluster (that was with non-encrypted keys) is able to connect to the cluster using its authn keys, and read back the data
* restart cluster one more time when keys are already stored encrypted in the system catalog (to make sure it works as expected when the keys are stored encrypted)
* make sure the same client is still able to connect to the cluster and read/write data


http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/catalog_manager.cc
File src/kudu/master/catalog_manager.cc:

http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/catalog_manager.cc@1363
PS9, Line 1363: VLOG(1)
Since that's going to be just a single run when this happens, maybe change VLOG(1) into LOG(INFO)?


http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/catalog_manager.cc@1373
PS9, Line 1373: VLOG(1)
ditto


http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/sys_catalog.h
File src/kudu/master/sys_catalog.h:

http://gerrit.cloudera.org:8080/#/c/20050/9/src/kudu/master/sys_catalog.h@271
PS9, Line 271: into
nit: in



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 9
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Sun, 25 Jun 2023 23:24:11 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has removed a vote on this change.

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Removed Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteVote
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 5
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#2).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate they IPKI key.

A test verifying the cert authority can't be rewritten in the
sys-catalog table has been deleted, as the cert authority can be
rewritten now.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/sys_catalog-test.cc
M src/kudu/master/sys_catalog.cc
M src/kudu/security/token_signing_key.cc
4 files changed, 50 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/2
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 2
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Marton Greber (Code Review)" <ge...@cloudera.org>.
Marton Greber has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 4:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/20050/4/src/kudu/master/catalog_manager.cc
File src/kudu/master/catalog_manager.cc:

http://gerrit.cloudera.org:8080/#/c/20050/4/src/kudu/master/catalog_manager.cc@1327
PS4, Line 1327: wxisted
nit: existed



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 4
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Jun 2023 08:48:16 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#12).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate the IPKI key.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/integration-tests/security-itest.cc
M src/kudu/master/catalog_manager.cc
M src/kudu/master/catalog_manager.h
M src/kudu/master/sys_catalog.cc
M src/kudu/master/sys_catalog.h
M src/kudu/security/token_signing_key.cc
6 files changed, 153 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/12
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 12
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 5:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/20050/4/src/kudu/master/catalog_manager.cc
File src/kudu/master/catalog_manager.cc:

http://gerrit.cloudera.org:8080/#/c/20050/4/src/kudu/master/catalog_manager.cc@1327
PS4, Line 1327: existed
> nit: existed
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 5
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Tue, 13 Jun 2023 16:17:03 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Tidy Bot, Zoltan Chovan, Alexey Serbin, Kudu Jenkins, Abhishek Chennaka, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20050

to look at the new patch set (#4).

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................

KUDU-3448 Add support for encrypting existing keys

On an existing cluster before KUDU-3448, the IPKI and TSK private keys
were stored in clear text. With KUDU-3448, it is now possible to encrypt
these keys, but without this commit, it's not possible to use this
feature in an existing cluster.

This commit introduces a fallback when trying to decrypt the stored
private keys, so that if that fails, it tries to read it without
decrypting it.

If it succeeds to read the IPKI private key, it encrypts it using the
password, and rewrites it in the sys-catalog table. It does no such
thing with the TSK, as they will be rolled out soon anyway, but it
encrypts the new keys, so it's still not possible to go back from
encrypted TSKs after a new key has been generated.

This commit doesn't make it possible to rotate they IPKI key.

A test verifying the cert authority can't be rewritten in the
sys-catalog table has been deleted, as the cert authority can be
rewritten now.

Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
---
M src/kudu/master/catalog_manager.cc
M src/kudu/master/sys_catalog-test.cc
M src/kudu/master/sys_catalog.cc
M src/kudu/security/token_signing_key.cc
4 files changed, 52 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/50/20050/4
-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 4
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Marton Greber (Code Review)" <ge...@cloudera.org>.
Marton Greber has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 9: Code-Review+1


-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 9
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Sun, 25 Jun 2023 21:19:48 +0000
Gerrit-HasComments: No

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 10:

(4 comments)

overall looks good to me, just a few nits and it seems IWYU isn't yet happy:

04:11:30 >>> Fixing #includes in '/home/jenkins-slave/workspace/kudu-master/1/src/kudu/master/sys_catalog.h'
04:11:30 @@ -26,6 +26,7 @@
04:11:30 
04:11:30  #include <gtest/gtest_prod.h>
04:11:30 
04:11:30 +#include "kudu/common/row_operations.pb.h"
04:11:30  #include "kudu/common/schema.h"
04:11:30  #include "kudu/consensus/metadata.pb.h"
04:11:30  #include "kudu/gutil/macros.h"
04:11:30 IWYU would have edited 1 files on your behalf.

http://gerrit.cloudera.org:8080/#/c/20050/9//COMMIT_MSG
Commit Message:

PS9: 
> Done
Thanks a lot!


http://gerrit.cloudera.org:8080/#/c/20050/10/src/kudu/integration-tests/security-itest.cc
File src/kudu/integration-tests/security-itest.cc:

http://gerrit.cloudera.org:8080/#/c/20050/10/src/kudu/integration-tests/security-itest.cc@1161
PS10, Line 1161:   ASSERT_OK(StartCluster());
nit: does it make sense to add SKIP_IF_SLOW_NOT_ALLOWED() here since this scenario is supposed to hit timeout as well?


http://gerrit.cloudera.org:8080/#/c/20050/10/src/kudu/integration-tests/security-itest.cc@1166
PS10, Line 1166: SmokeTestCluster
nit for here and below for SmokeTestCluster() call sites: does it make sense to wrap this into NO_FATALS() to bail out right away if anything fails?


http://gerrit.cloudera.org:8080/#/c/20050/10/src/kudu/integration-tests/security-itest.cc@1179
PS10, Line 1179:   cluster_->Shutdown();
               :   ASSERT_TRUE(cluster_->Restart().IsTimedOut());
nit: it would be great to have a small comment to explain why timeout is expected on shutting down the cluster -- it's not quite obvious why the flags would be affect shutting down (say, I'd not expect the keys to be loaded when a cluster is being shut down?)



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 10
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Mon, 26 Jun 2023 19:40:58 +0000
Gerrit-HasComments: Yes

[kudu-CR] KUDU-3448 Add support for encrypting existing keys

Posted by "Attila Bukor (Code Review)" <ge...@cloudera.org>.
Attila Bukor has posted comments on this change. ( http://gerrit.cloudera.org:8080/20050 )

Change subject: KUDU-3448 Add support for encrypting existing keys
......................................................................


Patch Set 12:

(3 comments)

http://gerrit.cloudera.org:8080/#/c/20050/10/src/kudu/integration-tests/security-itest.cc
File src/kudu/integration-tests/security-itest.cc:

http://gerrit.cloudera.org:8080/#/c/20050/10/src/kudu/integration-tests/security-itest.cc@1161
PS10, Line 1161:   SKIP_IF_SLOW_NOT_ALLOWED();
> nit: does it make sense to add SKIP_IF_SLOW_NOT_ALLOWED() here since this s
Done


http://gerrit.cloudera.org:8080/#/c/20050/10/src/kudu/integration-tests/security-itest.cc@1166
PS10, Line 1166: ASSERT_OK(cluste
> nit for here and below for SmokeTestCluster() call sites: does it make sens
Done


http://gerrit.cloudera.org:8080/#/c/20050/10/src/kudu/integration-tests/security-itest.cc@1179
PS10, Line 1179:   }
               :   cluster_->Shutdown();
> nit: it would be great to have a small comment to explain why timeout is ex
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/20050
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ide6ec4fb86325897f2b011aee9643d276044279d
Gerrit-Change-Number: 20050
Gerrit-PatchSet: 12
Gerrit-Owner: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Attila Bukor <ab...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Reviewer: Zoltan Chovan <zc...@cloudera.com>
Gerrit-Comment-Date: Mon, 26 Jun 2023 20:30:12 +0000
Gerrit-HasComments: Yes