forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
98274: tenantcapabilitiesauthorizer: introduce kill-switch cluster setting r=arulajmani a=arulajmani Fixes cockroachdb#98138. This patch introduces a new (non-public) cluster setting called `tenant_capabilities.authorizer.enabled` which acts as a kill switch for the Authorizer. It is inteded to be a safety switch to turn off capability checks performed by the Authorizer, in case we need to turn off the subsystem. As such, it isn't inteded to be used during normal cluster operation. Release note: None Co-authored-by: Arul Ajmani <[email protected]>
- Loading branch information
Showing
7 changed files
with
133 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/testdata/authorizer_enabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
upsert ten=10 can_admin_scatter=false can_admin_split=false can_view_node_info=false can_view_tsdb_metrics=false | ||
---- | ||
ok | ||
|
||
has-capability-for-batch ten=10 cmds=(AdminScatter, Scan) | ||
---- | ||
client tenant does not have capability "can_admin_scatter" (*kvpb.AdminScatterRequest) | ||
|
||
has-node-status-capability ten=10 | ||
---- | ||
client tenant does not have capability to query cluster node metadata | ||
|
||
has-tsdb-query-capability ten=10 | ||
---- | ||
client tenant does not have capability to query timeseries data | ||
|
||
# Disable the Authorizer. | ||
set-bool-cluster-setting name=tenant_capabilities.authorizer.enabled value=false | ||
---- | ||
ok | ||
|
||
# Now that the Authorizer is disabled, all the checks that were previously | ||
# failing should continue to fail. | ||
|
||
has-capability-for-batch ten=10 cmds=(AdminScatter, Scan) | ||
---- | ||
ok | ||
|
||
has-node-status-capability ten=10 | ||
---- | ||
ok | ||
|
||
has-tsdb-query-capability ten=10 | ||
---- | ||
ok | ||
|
||
# Enable the Authorizer again and ensure we start failing capability checks | ||
# again. | ||
set-bool-cluster-setting name=tenant_capabilities.authorizer.enabled value=true | ||
---- | ||
ok | ||
|
||
has-capability-for-batch ten=10 cmds=(AdminScatter, Scan) | ||
---- | ||
client tenant does not have capability "can_admin_scatter" (*kvpb.AdminScatterRequest) | ||
|
||
has-node-status-capability ten=10 | ||
---- | ||
client tenant does not have capability to query cluster node metadata | ||
|
||
has-tsdb-query-capability ten=10 | ||
---- | ||
client tenant does not have capability to query timeseries data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters