2015-08-28 19:48:29 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2015-10-20 22:08:18 +00:00
|
|
|
with lib;
|
2015-08-28 19:48:29 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
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 22:19:52 +00:00
|
|
|
su-test = pkgs.execveBin "su-test" rec {
|
2015-08-28 20:14:34 +00:00
|
|
|
filename = "/var/setuid-wrappers/sudo";
|
|
|
|
argv = ["sudo" "-u" "test" "-i"];
|
|
|
|
};
|
|
|
|
|
2015-08-28 22:19:52 +00:00
|
|
|
test-shell = pkgs.execve "test-shell" rec {
|
2015-08-28 19:48:29 +00:00
|
|
|
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
|