better ssh config

This commit is contained in:
Luj 2023-07-28 13:19:46 +02:00
parent c11c0921da
commit fba56edd2e
Signed by: luj
GPG key ID: 6FC74C847011FD83
2 changed files with 26 additions and 7 deletions

View file

@ -11,18 +11,15 @@ with lib;
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
matchBlocks = { matchBlocks = lib.mapAttrs
(n: v: { hostname = "${n}.${lib.luj.tld}"; user = v.sshUser; port = v.sshPort; })
lib.luj.machines // {
sas = { sas = {
hostname = "sas.eleves.ens.fr"; hostname = "sas.eleves.ens.fr";
user = "jmalka"; user = "jmalka";
}; };
lambda = {
hostname = "lambda.luj";
user = "root";
port = 45;
};
router = { router = {
hostname = "ci.julienmalka.me"; hostname = "vpn.saumon.network";
}; };
mails = { mails = {
hostname = "192.168.0.76"; hostname = "192.168.0.76";

View file

@ -12,6 +12,15 @@ inputs: lib: with lib; let
default = name; default = name;
readOnly = true; readOnly = true;
}; };
sshPort = mkOption {
description = "The port for the ssh server of the machine";
type = int;
default = 45;
};
sshUser = mkOption {
description = "The user for ssh connection to the machine";
default = "julien";
};
}; };
})); }));
default = { }; default = { };
@ -77,27 +86,38 @@ inputs: lib: with lib; let
inherit tld; inherit tld;
ipv4 = { public = "78.194.168.230"; local = "192.168.1.1"; vpn = "100.100.45.3"; }; ipv4 = { public = "78.194.168.230"; local = "192.168.1.1"; vpn = "100.100.45.3"; };
ipv6 = { public = "2a01:e34:ec2a:8e60:d250:99ff:fefa:b62"; vpn = "fd7a:115c:a1e0::3"; }; ipv6 = { public = "2a01:e34:ec2a:8e60:d250:99ff:fefa:b62"; vpn = "fd7a:115c:a1e0::3"; };
sshPort = 22;
sshUser = "root";
}; };
pve2 = { pve2 = {
inherit tld; inherit tld;
ipv4 = { public = "78.194.168.230"; local = "192.168.1.2"; vpn = "100.100.45.15"; }; ipv4 = { public = "78.194.168.230"; local = "192.168.1.2"; vpn = "100.100.45.15"; };
ipv6 = { public = "2a01:e34:ec2a:8e60:aaa1:59ff:fec7:1d6"; vpn = "fd7a:115c:a1e0::f"; }; ipv6 = { public = "2a01:e34:ec2a:8e60:aaa1:59ff:fec7:1d6"; vpn = "fd7a:115c:a1e0::f"; };
sshPort = 22;
sshUser = "root";
}; };
pve3 = { pve3 = {
inherit tld; inherit tld;
ipv4 = { public = "78.194.168.230"; local = "192.168.1.3"; vpn = "100.100.45.16"; }; ipv4 = { public = "78.194.168.230"; local = "192.168.1.3"; vpn = "100.100.45.16"; };
ipv6 = { public = "2a01:e34:ec2a:8e60:aaa1:59ff:fec1:aa10"; vpn = "fd7a:115c:a1e0::10"; }; ipv6 = { public = "2a01:e34:ec2a:8e60:aaa1:59ff:fec1:aa10"; vpn = "fd7a:115c:a1e0::10"; };
sshPort = 22;
sshUser = "root";
}; };
pve4 = { pve4 = {
inherit tld; inherit tld;
ipv4 = { public = "78.194.168.230"; local = "192.168.1.4"; vpn = "100.100.45.17"; }; ipv4 = { public = "78.194.168.230"; local = "192.168.1.4"; vpn = "100.100.45.17"; };
ipv6 = { public = "2a01:e34:ec2a:8e60:d250:99ff:fefa:b76"; vpn = "fd7a:115c:a1e0::11"; }; ipv6 = { public = "2a01:e34:ec2a:8e60:d250:99ff:fefa:b76"; vpn = "fd7a:115c:a1e0::11"; };
sshPort = 22;
sshUser = "root";
}; };
saves-paris = { saves-paris = {
inherit tld; inherit tld;
subdomains = [ "saves-paris.luj" ]; subdomains = [ "saves-paris.luj" ];
ipv4 = { public = "78.194.168.230"; local = "192.168.4.5"; vpn = "100.100.45.4"; }; ipv4 = { public = "78.194.168.230"; local = "192.168.4.5"; vpn = "100.100.45.4"; };
ipv6 = { public = "2a01:e34:ec2a:8e60:3af3:abff:fe6a:1f54"; vpn = "fd7a:115c:a1e0::4"; }; ipv6 = { public = "2a01:e34:ec2a:8e60:3af3:abff:fe6a:1f54"; vpn = "fd7a:115c:a1e0::4"; };
sshPort = 22;
sshUser = "root";
}; };
saves-lyon = { saves-lyon = {
@ -105,6 +125,8 @@ inputs: lib: with lib; let
subdomains = [ "saves-lyon.luj" ]; subdomains = [ "saves-lyon.luj" ];
ipv4 = { vpn = "100.100.45.20"; }; ipv4 = { vpn = "100.100.45.20"; };
ipv6 = { vpn = "fd7a:115c:a1e0::14"; }; ipv6 = { vpn = "fd7a:115c:a1e0::14"; };
sshPort = 22;
sshUser = "root";
}; };