Skip to content

Commit f350700

Browse files
committed
Merge remote-tracking branch 'couchbase/trinity' into phoenix
* couchbase/trinity: MB-61592: Re-trust OOTB CA when node cert regenerated MB-61592: [cluster_tests] Add support for retry_on_assert... MB-68190 - detailed chart doesn't reflect the currently selected bucket Change-Id: I65f550f2e8206b7811a3553a74f2f4f2a814c793
2 parents 525ff7a + 7079a7d commit f350700

File tree

4 files changed

+368
-67
lines changed

4 files changed

+368
-67
lines changed

apps/ns_server/src/ns_server_cert.erl

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,23 @@ generate_cluster_CA(ForceRegenerateCA, DropUploadedCerts) ->
122122
fun (Txn) ->
123123
case chronicle_kv:txn_get(root_cert_and_pkey, Txn) of
124124
{ok, {{_, OldKey} = OldPair, _}}
125-
when not ForceRegenerateCA,
126-
not DropUploadedCerts,
127-
OldKey /= undefined ->
125+
when not ForceRegenerateCA,
126+
not DropUploadedCerts,
127+
OldKey /= undefined ->
128128
{abort, {ok, undefined, OldPair}};
129-
{ok, {{_, OldKey} = OldPair, _}}
130-
when not ForceRegenerateCA,
131-
OldKey /= undefined ->
129+
{ok, {{OldCert, OldKey} = OldPair, _}}
130+
when not ForceRegenerateCA,
131+
OldKey /= undefined ->
132+
%% In case the CA cert is not trusted, we attempt to
133+
%% add it here. Note that add_CAs_txn_fun will check
134+
%% for the cert already being trusted, so there's no
135+
%% need for such a check here
136+
{ok, AddOldCA} =
137+
add_CAs_txn_fun(generated, OldCert, []),
138+
{commit, Changes0, _} = AddOldCA(Txn),
132139
Epoch = ReadEpoch(Txn) + 1,
133-
{commit, [{set, cluster_certs_epoch, Epoch}],
134-
OldPair};
140+
Changes1 = [{set, cluster_certs_epoch, Epoch}],
141+
{commit, Changes0 ++ Changes1, OldPair};
135142
_ ->
136143
Changes0 =
137144
case DropUploadedCerts of

0 commit comments

Comments
 (0)