mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
Merge remote-tracking branch 'origin/master' into staging-next
This commit is contained in:
commit
51fcbf5bb7
127 changed files with 2887 additions and 1362 deletions
|
@ -491,6 +491,7 @@ in {
|
|||
plasma5 = handleTest ./plasma5.nix {};
|
||||
plasma5-systemd-start = handleTest ./plasma5-systemd-start.nix {};
|
||||
plausible = handleTest ./plausible.nix {};
|
||||
please = handleTest ./please.nix {};
|
||||
pleroma = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./pleroma.nix {};
|
||||
plikd = handleTest ./plikd.nix {};
|
||||
plotinus = handleTest ./plotinus.nix {};
|
||||
|
|
|
@ -12,7 +12,7 @@ let
|
|||
name = "oci-containers-${backend}";
|
||||
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [ adisbladis benley ] ++ lib.teams.serokell.members;
|
||||
maintainers = with lib.maintainers; [ adisbladis benley mkaito ] ++ lib.teams.serokell.members;
|
||||
};
|
||||
|
||||
nodes = {
|
||||
|
|
66
nixos/tests/please.nix
Normal file
66
nixos/tests/please.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
import ./make-test-python.nix ({ lib, ... }:
|
||||
{
|
||||
name = "please";
|
||||
meta.maintainers = with lib.maintainers; [ azahi ];
|
||||
|
||||
nodes.machine =
|
||||
{ ... }:
|
||||
{
|
||||
users.users = with lib; mkMerge [
|
||||
(listToAttrs (map
|
||||
(n: nameValuePair n { isNormalUser = true; })
|
||||
(genList (x: "user${toString x}") 6)))
|
||||
{
|
||||
user0.extraGroups = [ "wheel" ];
|
||||
}
|
||||
];
|
||||
|
||||
security.please = {
|
||||
enable = true;
|
||||
wheelNeedsPassword = false;
|
||||
settings = {
|
||||
user2_run_true_as_root = {
|
||||
name = "user2";
|
||||
target = "root";
|
||||
rule = "/run/current-system/sw/bin/true";
|
||||
require_pass = false;
|
||||
};
|
||||
user4_edit_etc_hosts_as_root = {
|
||||
name = "user4";
|
||||
type = "edit";
|
||||
target = "root";
|
||||
rule = "/etc/hosts";
|
||||
editmode = 644;
|
||||
require_pass = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
with subtest("root: can run anything by default"):
|
||||
machine.succeed('please true')
|
||||
with subtest("root: can edit anything by default"):
|
||||
machine.succeed('EDITOR=cat pleaseedit /etc/hosts')
|
||||
|
||||
with subtest("user0: can run as root because it's in the wheel group"):
|
||||
machine.succeed('su - user0 -c "please -u root true"')
|
||||
with subtest("user1: cannot run as root because it's not in the wheel group"):
|
||||
machine.fail('su - user1 -c "please -u root true"')
|
||||
|
||||
with subtest("user0: can edit as root"):
|
||||
machine.succeed('su - user0 -c "EDITOR=cat pleaseedit /etc/hosts"')
|
||||
with subtest("user1: cannot edit as root"):
|
||||
machine.fail('su - user1 -c "EDITOR=cat pleaseedit /etc/hosts"')
|
||||
|
||||
with subtest("user2: can run 'true' as root"):
|
||||
machine.succeed('su - user2 -c "please -u root true"')
|
||||
with subtest("user3: cannot run 'true' as root"):
|
||||
machine.fail('su - user3 -c "please -u root true"')
|
||||
|
||||
with subtest("user4: can edit /etc/hosts"):
|
||||
machine.succeed('su - user4 -c "EDITOR=cat pleaseedit /etc/hosts"')
|
||||
with subtest("user5: cannot edit /etc/hosts"):
|
||||
machine.fail('su - user5 -c "EDITOR=cat pleaseedit /etc/hosts"')
|
||||
'';
|
||||
})
|
|
@ -70,15 +70,15 @@ let
|
|||
|
||||
# Save the file
|
||||
machine.send_key('ctrl-s')
|
||||
machine.wait_for_text('Save')
|
||||
machine.wait_for_text('(Save|Desktop|alice|Size)')
|
||||
machine.screenshot('save_window')
|
||||
machine.send_key('ret')
|
||||
|
||||
# (the default filename is the first line of the file)
|
||||
machine.wait_for_file(f'/home/alice/{test_string}')
|
||||
|
||||
machine.send_key('ctrl-q')
|
||||
machine.wait_until_fails('pgrep -x codium')
|
||||
# machine.send_key('ctrl-q')
|
||||
# machine.wait_until_fails('pgrep -x codium')
|
||||
'';
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue