diff --git a/homes/encode42/common/ssh.nix b/homes/encode42/common/ssh.nix index 8f4b2b8..5bf496a 100644 --- a/homes/encode42/common/ssh.nix +++ b/homes/encode42/common/ssh.nix @@ -1,14 +1,30 @@ +{ osConfig, ... }: + let host = "index"; address = "192.168.1.2"; + + agentPath = "/run/user/${toString osConfig.users.users.encode42.uid}/gnupg/S.gpg-agent"; + remoteForwards = [ + { + bind.address = agentPath; + host.address = agentPath + ".extra"; + } + ]; in { + services.gpg-agent = { + enableExtraSocket = true; + }; + programs.ssh = { enable = true; enableDefaultConfig = false; matchBlocks = { "index-local" = { + inherit remoteForwards; + match = "host ${host} exec 'ping -c1 -W0.5 ${address} >/dev/null 2>&1'"; hostname = address; @@ -16,7 +32,7 @@ in }; "index-remote" = { - inherit host; + inherit host remoteForwards; hostname = "encrypted.group";