mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-12-23 02:36:05 +01:00
refactor nitrokey ssh
This commit is contained in:
parent
2cb56b413c
commit
441a8bba33
34
yodaTab/nitrokey-ssh-gpg.nix
Normal file
34
yodaTab/nitrokey-ssh-gpg.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Enable SSH server.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
# Forbid root login through SSH.
|
||||
settings.PermitRootLogin = "no";
|
||||
# Use authorized keys only.
|
||||
settings.PasswordAuthentication = false;
|
||||
};
|
||||
|
||||
# Use NitroKey USB smartcard with SSH.
|
||||
# https://nixos.wiki/wiki/Nitrokey
|
||||
#
|
||||
# Restart gpg-agent after config change.
|
||||
# Otherwise there might be a gpg error about "no pinentry".
|
||||
# https://discourse.nixos.org/t/cant-get-gnupg-to-work-no-pinentry/15373/19
|
||||
#
|
||||
# Not sure if this is needed: Reload udev rules.
|
||||
# sudo -- udevadm control --reload-rules && udevadm trigger
|
||||
#
|
||||
services.udev.packages = [ pkgs.nitrokey-udev-rules ];
|
||||
programs = {
|
||||
ssh.startAgent = false;
|
||||
gnupg.agent = {
|
||||
enable = true;
|
||||
# ... Also sets SSH_AUTH_SOCK environment variable correctly.
|
||||
enableSSHSupport = true;
|
||||
};
|
||||
};
|
||||
# Smartcard daemon.
|
||||
services.pcscd.enable = true;
|
||||
}
|
Loading…
Reference in New Issue
Block a user