2022-12-09 16:18:57 +01:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
let
|
|
|
|
wireguard_port = 51820;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
sops.secrets = {
|
|
|
|
"wg-fsr" = {
|
|
|
|
owner = config.users.users.systemd-network.name;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
hostId = "a71c81fc";
|
2023-09-01 10:42:22 +02:00
|
|
|
rdns = "x8d1e1ea9.agdsn.tu-dresden.de";
|
2022-12-09 16:18:57 +01:00
|
|
|
enableIPv6 = true;
|
|
|
|
useDHCP = true;
|
2023-04-23 18:15:13 +02:00
|
|
|
interfaces.ens18.useDHCP = true;
|
2022-12-09 16:18:57 +01:00
|
|
|
useNetworkd = true;
|
|
|
|
|
|
|
|
firewall.allowedUDPPorts = [ wireguard_port ];
|
|
|
|
wireguard.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.resolved = {
|
|
|
|
enable = true;
|
2023-02-15 13:34:14 +01:00
|
|
|
#dnssec = "false";
|
2022-12-09 16:18:57 +01:00
|
|
|
fallbackDns = [ "1.1.1.1" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# workaround for networkd waiting for shit
|
|
|
|
systemd.services.systemd-networkd-wait-online.serviceConfig.ExecStart = [
|
|
|
|
"" # clear old command
|
|
|
|
"${config.systemd.package}/lib/systemd/systemd-networkd-wait-online --any"
|
|
|
|
];
|
|
|
|
|
|
|
|
systemd.network = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
# Interfaces on the machine
|
|
|
|
networks."10-ether-bond" = {
|
2023-04-23 18:15:13 +02:00
|
|
|
matchConfig.Name = "ens18";
|
2023-02-15 13:34:14 +01:00
|
|
|
|
|
|
|
address = [ "141.30.30.169/25" ];
|
|
|
|
routes = [
|
2023-02-15 13:35:32 +01:00
|
|
|
{
|
|
|
|
routeConfig.Gateway = "141.30.30.129";
|
|
|
|
}
|
2023-02-15 13:34:14 +01:00
|
|
|
];
|
2022-12-09 16:18:57 +01:00
|
|
|
networkConfig = {
|
|
|
|
DNS = "141.30.1.1";
|
|
|
|
#IPv6AcceptRA = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# defining network device for wireguard connections
|
|
|
|
netdevs."fsr-wg" = {
|
|
|
|
netdevConfig = {
|
|
|
|
Kind = "wireguard";
|
|
|
|
Name = "fsr-wg";
|
|
|
|
Description = "fsr enterprise wireguard";
|
|
|
|
};
|
|
|
|
wireguardConfig = {
|
|
|
|
PrivateKeyFile = config.sops.secrets."wg-fsr".path;
|
|
|
|
ListenPort = wireguard_port;
|
|
|
|
};
|
|
|
|
wireguardPeers = [
|
|
|
|
{
|
|
|
|
# tassilo
|
|
|
|
wireguardPeerConfig = {
|
|
|
|
PublicKey = "vgo3le9xrFsIbbDZsAhQZpIlX+TuWjfEyUcwkoqUl2Y=";
|
|
|
|
AllowedIPs = [ "10.66.66.100/32" ];
|
|
|
|
PersistentKeepalive = 25;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# fsr wireguard server
|
|
|
|
networks."fsr-wg" = {
|
|
|
|
matchConfig.Name = "fsr-wg";
|
|
|
|
networkConfig = {
|
|
|
|
Address = "10.66.66.1/24";
|
|
|
|
IPForward = "ipv4";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|