secrets: add sandbox user
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
options.clanCore.secretStore = lib.mkOption {
|
options.clanCore.secretStore = lib.mkOption {
|
||||||
type = lib.types.enum [ "sops" "password-store" "custom" ];
|
type = lib.types.enum [ "sops" "password-store" "custom" ];
|
||||||
@@ -69,8 +69,18 @@
|
|||||||
readOnly = true;
|
readOnly = true;
|
||||||
internal = true;
|
internal = true;
|
||||||
default = ''
|
default = ''
|
||||||
export PATH="${lib.makeBinPath config.path}"
|
set -eu -o pipefail
|
||||||
set -efu -o pipefail
|
|
||||||
|
export PATH="${lib.makeBinPath config.path}:${pkgs.coreutils}/bin"
|
||||||
|
|
||||||
|
# prepare sandbox user
|
||||||
|
mkdir -p /etc
|
||||||
|
cp ${pkgs.runCommand "fake-etc" {} ''
|
||||||
|
export PATH="${pkgs.coreutils}/bin"
|
||||||
|
mkdir -p $out
|
||||||
|
cp /etc/* $out/
|
||||||
|
''}/* /etc/
|
||||||
|
|
||||||
${config.script}
|
${config.script}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ def generate_secrets(machine: Machine) -> None:
|
|||||||
"--bind", str(facts_dir), str(facts_dir),
|
"--bind", str(facts_dir), str(facts_dir),
|
||||||
"--bind", str(secrets_dir), str(secrets_dir),
|
"--bind", str(secrets_dir), str(secrets_dir),
|
||||||
"--unshare-all",
|
"--unshare-all",
|
||||||
|
"--unshare-user",
|
||||||
|
"--uid", "1000",
|
||||||
"--",
|
"--",
|
||||||
"bash", "-c", machine.secrets_data[service]["generator"]
|
"bash", "-c", machine.secrets_data[service]["generator"]
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user