ttyd: add test & use systemd LoadCredential

This commit is contained in:
Felix Buehler
2024-01-20 17:33:00 +01:00
parent 221d90520a
commit c34493d7c0
4 changed files with 26 additions and 1 deletions

View File

@@ -180,10 +180,11 @@ in
# Runs login which needs to be run as root
# login: Cannot possibly work without effective root
User = "root";
LoadCredential = lib.optionalString (cfg.passwordFile != null) "TTYD_PASSWORD_FILE:${cfg.passwordFile}";
};
script = if cfg.passwordFile != null then ''
PASSWORD=$(cat ${escapeShellArg cfg.passwordFile})
PASSWORD=$(cat "$CREDENTIALS_DIRECTORY/TTYD_PASSWORD_FILE")
${pkgs.ttyd}/bin/ttyd ${lib.escapeShellArgs args} \
--credential ${escapeShellArg cfg.username}:"$PASSWORD" \
${pkgs.shadow}/bin/login