2015-08-28 19:48:29 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with import ../4lib { inherit lib pkgs; };
|
|
|
|
|
|
|
|
let
|
|
|
|
tvpkgs = import ../5pkgs { inherit lib pkgs; };
|
|
|
|
|
|
|
|
out = {
|
2015-08-28 20:14:34 +00:00
|
|
|
environment.systemPackages = [
|
|
|
|
su-test
|
|
|
|
];
|
2015-08-28 19:48:29 +00:00
|
|
|
security.sudo.extraConfig = ''
|
|
|
|
tv ALL=(test) NOPASSWD: ALL
|
|
|
|
'';
|
|
|
|
users.extraUsers.test = {
|
|
|
|
shell = "${test-shell}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-08-28 20:14:34 +00:00
|
|
|
su-test = tvpkgs.execveBin "su-test" rec {
|
|
|
|
filename = "/var/setuid-wrappers/sudo";
|
|
|
|
argv = ["sudo" "-u" "test" "-i"];
|
|
|
|
};
|
|
|
|
|
2015-08-28 19:48:29 +00:00
|
|
|
test-shell = tvpkgs.execve "test-shell" rec {
|
|
|
|
filename = "${pkgs.bash}/bin/bash";
|
|
|
|
argv = ["sh" "--noprofile" "-l"];
|
|
|
|
envp.ENV = pkgs.writeText "test-env" ''
|
|
|
|
${shell.cat "Hello, `$(j0w\nd0g!)`!\\o/\n"} >&2
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in out
|