fix: another service's account of the same name is left alone (NetOrk/netork#1817)
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 30s
driver / security (pull_request) Successful in 55s
driver / build (pull_request) Successful in 26s
driver / test (3.12) (pull_request) Successful in 56s
CI / driver (pull_request) Successful in 56s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 30s
driver / security (pull_request) Successful in 55s
driver / build (pull_request) Successful in 26s
driver / test (3.12) (pull_request) Successful in 56s
CI / driver (pull_request) Successful in 56s
driver / publish (pull_request) Skipped
On bw-01, netork is the satellite's own user (nologin, in docker). add_service_account opened it, gave it the passwordless sudo rule and netOrk's key, and only the login as it failed. An account that is there and cannot log in (nologin, false) is now refused before anything changes.
This commit is contained in:
1 parent
3f59023f46
commit
47751d12d6
3 files changed
+49
-9
No files matched your search
@@ -280,3 +280,22 @@ def test_a_driver_that_cannot_set_a_uid_says_so(host: _ServiceHost, driver: _Dri
|
||||
|
||||
assert not result["success"]
|
||||
assert "uid" in result["output"]
|
||||
|
||||
|
||||
# -- another service's account of the same name (bw-01: the satellite's) ------------------
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"shell", ["/usr/sbin/nologin", "/sbin/nologin", "/bin/false", "/usr/bin/false"]
|
||||
)
|
||||
def test_an_account_that_cannot_log_in_is_another_services_and_left_alone(
|
||||
host: _ServiceHost, driver: _Driver, shell: str
|
||||
) -> None:
|
||||
host.accounts["netork"] = _Account(
|
||||
999, "/home/netork", shell=shell, groups=["netork", "docker"]
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="cannot log in"):
|
||||
driver.add_service_account("netork", NETORK_KEY)
|
||||
assert not _root_commands(host)
|
||||
assert service_sudoers_rule_path(_Driver.SUDOERS_DIR, "netork") not in host.files
|
||||
Reference in new issue
Block a user