From a2e5d4d039284a061181d0e20f97698b7044f3cb Mon Sep 17 00:00:00 2001 From: Jan Schmitt Date: Thu, 15 Dec 2022 21:46:07 +0100 Subject: [PATCH] ssh: add addKeysToAgent option --- modules/programs/ssh.nix | 11 +++++++++++ .../modules/programs/ssh/default-config-expected.conf | 1 + 2 files changed, 12 insertions(+) diff --git a/modules/programs/ssh.nix b/modules/programs/ssh.nix index f906d1bc737b..5f1717b25bad 100644 --- a/modules/programs/ssh.nix +++ b/modules/programs/ssh.nix @@ -355,6 +355,16 @@ in ''; }; + addKeysToAgent = mkOption { + type = types.enum [ "yes" "no" "ask" "confirm" ]; + default = "no"; + description = '' + When enabled, a private key that is used during authentication will be + added to ssh-agent if it is running (with confirmation enabled if + set to 'confirm'). + ''; + }; + compression = mkOption { default = false; type = types.bool; @@ -537,6 +547,7 @@ in ControlMaster ${cfg.controlMaster} ControlPath ${cfg.controlPath} ControlPersist ${cfg.controlPersist} + AddKeysToAgent ${cfg.addKeysToAgent} ${replaceStrings ["\n"] ["\n "] cfg.extraConfig} ''; diff --git a/tests/modules/programs/ssh/default-config-expected.conf b/tests/modules/programs/ssh/default-config-expected.conf index d205cab1e6e7..11f8bb9d8cc3 100644 --- a/tests/modules/programs/ssh/default-config-expected.conf +++ b/tests/modules/programs/ssh/default-config-expected.conf @@ -10,5 +10,6 @@ Host * ControlMaster no ControlPath ~/.ssh/master-%r@%n:%p ControlPersist no + AddKeysToAgent no