-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce situations in which hard-coded root privilege returned
We should only return the wildcard allowlist when the root unix domain socket session is not created by an interactive shell session. This is achieved by storing the loginuid for the middleware client pid and checking as part of the check_permission call. This ensures that STIG restrictions are properly evaluated for users who use midclt, midcli, etc from shell.
- Loading branch information
Showing
4 changed files
with
65 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pytest | ||
from truenas_api_client import Client, ClientException | ||
|
||
@pytest.fixture(scope='function') | ||
def enable_stig(): | ||
with Client() as c: | ||
c.call('datastore.update', 'system.security', 1, {'enable_gpos_stig': True}) | ||
try: | ||
yield c | ||
finally: | ||
c.call('datastore.update', 'system.security', 1, {'enable_gpos_stig': False}) | ||
|
||
def test__stig_restrictions_af_unix(enable_stig): | ||
# STIG RBAC should still be effective despite root session | ||
with pytest.raises(ClientException, match='Not authorized'): | ||
with Client() as c: | ||
c.call('virt.global.update', {}, job=True) |