git.iko.soy/typeable/nixpkgs
on master help sign in
ssh-agent: add agentPKCS11Whitelist option

If you want to be able to use OpenSC with ssh-agent, you need to be able to add it to the ssh-agent whitelist. This adds an option, agentPKCS11Whitelist, that exposes the option. Note that I currently work around this by injecting the parameter into the agentTimeout option: programs.ssh.agentTimeout = "1h -P ${pkgs.opensc}/lib/opensc-pkcs11.so"; but I feel that a proper option would be better :)

commit8120184bf176fc34707f4504c8d1d91716d1e22d authorPhilip Potter <philip.g.potter@gmail.com> dateMon 14 Oct 2019, 20:45 (7 years ago) parent67effde
1 file changed+11
nixos/modules/programs/ssh.nix+11
nixos/modules/programs/ssh.nix+11
@@ -115,6 +115,16 @@ in
115115 '';
116116 };
117117
118+ agentPKCS11Whitelist = mkOption {
119+ type = types.nullOr types.str;
120+ default = null;
121+ example = "\${pkgs.opensc}/lib/opensc-pkcs11.so";
122+ description = ''
123+ A pattern-list of acceptable paths for PKCS#11 shared libraries
124+ that may be used with the -s option to ssh-add.
125+ '';
126+ };
127+
118128 package = mkOption {
119129 type = types.package;
120130 default = pkgs.openssh;
@@ -241,6 +251,7 @@ in
241251 ExecStart =
242252 "${cfg.package}/bin/ssh-agent " +
243253 optionalString (cfg.agentTimeout != null) ("-t ${cfg.agentTimeout} ") +
254+ optionalString (cfg.agentPKCS11Whitelist != null) ("-P ${cfg.agentPKCS11Whitelist} ")
244255 "-a %t/ssh-agent";
245256 StandardOutput = "null";
246257 Type = "forking";