Skip to content

Commit

Permalink
Remove root certificates like other credentials on cbgtManager close
Browse files Browse the repository at this point in the history
  • Loading branch information
torcolvin committed Dec 2, 2024
1 parent 5dc2b50 commit ea548ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion base/dcp_feed_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,16 @@ func getCbgtCredentials(dbName string) (cbgtCreds, bool) {
return creds, found
}

// See the comment of cbgtRootCAsProvider for usage details.
// setCbgtRootCertsForBucket creates root certificates for a given bucket. If TLS should be used, this function must be called. If tls certificate verification is skipped, then this function should be called with pool as nil. See the comment of cbgtRootCAsProvider for usage details.
func setCbgtRootCertsForBucket(bucketUUID string, pool *x509.CertPool) {
cbgtGlobalsLock.Lock()
defer cbgtGlobalsLock.Unlock()
cbgtRootCertPools[bucketUUID] = pool
}

// removeCbgtRootCertsForBucket removes all the root certificates for a bucket. See the comment of cbgtRootCAsProvider for usage details.
func removeCbgtRootCertsForBucket(bucketUUID string) {
cbgtGlobalsLock.Lock()
defer cbgtGlobalsLock.Unlock()
delete(cbgtRootCertPools, bucketUUID)
}
1 change: 1 addition & 0 deletions base/dcp_sharded.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ func (c *CbgtContext) Stop() {

func (c *CbgtContext) RemoveFeedCredentials(dbName string) {
removeCbgtCredentials(dbName)
removeCbgtRootCertsForBucket(c.sourceUUID)
}

// Format of dest key for retrieval of import dest from cbgtDestFactories
Expand Down

0 comments on commit ea548ac

Please sign in to comment.