1
0
Fork 0
dotfiles/home/programs/ssh.nix

141 lines
3 KiB
Nix
Raw Normal View History

2022-04-14 18:25:49 +00:00
{ pkgs, config, ... }:
2022-01-25 21:21:15 +00:00
let
2022-07-31 22:23:56 +00:00
ssh-directory = "${config.home.homeDirectory}/.ssh";
ssh-keys = import ../../system/shared/ssh-keys.nix;
auth-socket = "${ssh-directory}/1password.sock";
signers-directory = "${ssh-directory}/allowed_signers";
2022-08-04 18:11:40 +00:00
secret-sail = import ../../secret/hosts/sail.nix;
2022-01-25 21:21:15 +00:00
in
2022-01-10 21:41:52 +00:00
{
2022-04-14 18:25:49 +00:00
home.packages = [ pkgs.openssh ];
2022-01-10 21:41:52 +00:00
programs.ssh = {
enable = true;
forwardAgent = false;
compression = false;
hashKnownHosts = true;
serverAliveInterval = 60;
extraConfig = ''
2022-04-06 20:20:03 +00:00
IdentityAgent "${auth-socket}"
2022-01-10 21:41:52 +00:00
UpdateHostKeys ask
VerifyHostKeyDNS yes
'';
matchBlocks = {
# Work
"git.app.nedeco.de" = {
port = 22;
user = "git";
2022-03-17 09:33:21 +00:00
identityFile = "~/.ssh/nedeco_gitlab.pub";
2022-01-10 21:41:52 +00:00
identitiesOnly = true;
compression = true;
};
"nedeco-smartos-hosting" = {
host = "10.0.90.*";
port = 22;
user = "root";
2022-03-17 09:33:21 +00:00
identityFile = "~/.ssh/nedeco.pub";
2022-01-10 21:41:52 +00:00
identitiesOnly = true;
};
2022-05-31 13:46:57 +00:00
"msc.nedeco.local" = {
port = 22;
user = "root";
identityFile = "~/.ssh/nedeco.pub";
identitiesOnly = true;
};
2022-01-10 21:41:52 +00:00
# Private
"github.com" = {
port = 22;
user = "git";
2022-03-17 09:33:21 +00:00
identityFile = "~/.ssh/GitHub.pub";
2022-01-10 21:41:52 +00:00
identitiesOnly = true;
compression = true;
};
"gitlab.com" = {
port = 22;
user = "git";
2022-03-19 21:54:55 +00:00
identityFile = "~/.ssh/GitLab.pub";
2022-01-10 21:41:52 +00:00
identitiesOnly = true;
compression = true;
};
2022-01-11 22:13:08 +00:00
"router" = {
hostname = "10.0.0.1";
port = 22;
user = "root";
};
2022-01-10 21:41:52 +00:00
"nas" = {
2022-01-11 22:13:08 +00:00
hostname = "10.0.0.100";
2022-01-10 21:41:52 +00:00
port = 22;
user = "daniel";
identityFile = "~/.ssh/LAN.pub";
2022-01-10 21:41:52 +00:00
identitiesOnly = true;
2022-05-07 21:31:58 +00:00
};
2022-08-04 18:11:40 +00:00
"piboat.lan" = {
2022-05-07 21:31:58 +00:00
port = 22;
2022-08-04 18:11:40 +00:00
user = "pi";
2022-05-07 21:31:58 +00:00
identityFile = "~/.ssh/LAN.pub";
identitiesOnly = true;
};
2022-08-04 22:39:12 +00:00
"adsb-antenna" = {
hostname = "adsb-antenna.laniot";
port = 22;
user = "daniel";
forwardAgent = true;
identityFile = "~/.ssh/LAN.pub";
identitiesOnly = true;
};
2022-08-04 18:11:40 +00:00
"sail" = {
hostname = secret-sail.publicIP;
2022-07-09 22:12:22 +00:00
port = 22;
2022-08-04 18:11:40 +00:00
user = "daniel";
2022-08-04 22:39:12 +00:00
forwardAgent = true;
2022-08-04 18:11:40 +00:00
identityFile = "~/.ssh/Hetzner.pub";
2022-07-15 13:08:10 +00:00
identitiesOnly = true;
2022-07-09 22:12:22 +00:00
};
2022-08-04 18:11:40 +00:00
# Builder
"builder-sail" = {
hostname = secret-sail.publicIP;
port = 22;
2022-05-07 21:31:58 +00:00
user = "root";
identityFile = "~/.ssh/Hetzner.pub";
identitiesOnly = true;
2022-01-10 21:41:52 +00:00
};
};
2022-01-11 22:13:08 +00:00
includes = [
"~/.ssh/config_work"
];
2022-01-10 21:41:52 +00:00
};
2022-01-25 21:21:15 +00:00
2022-04-06 20:20:03 +00:00
home.sessionVariables.SSH_AUTH_SOCK = "${auth-socket}";
2022-07-31 22:23:56 +00:00
home.file = {
"${ssh-directory}/GitHub.pub".text = ssh-keys.GitHub;
"${ssh-directory}/GitLab.pub".text = ssh-keys.GitLab;
"${ssh-directory}/Hetzner.pub".text = ssh-keys.Hetzner;
"${ssh-directory}/LAN.pub".text = ssh-keys.LAN;
"${signers-directory}" = {
source = ../config/ssh/allowed_signers;
recursive = true;
};
2022-01-25 21:21:15 +00:00
};
2022-01-10 21:41:52 +00:00
}