nixos-config/hosts/thinkpad/modules/networks/uni.nix

120 lines
3.6 KiB
Nix
Raw Normal View History

2023-12-17 17:22:12 +01:00
{ config, pkgs, ... }:
{
2023-12-17 17:22:12 +01:00
age.secrets = {
tud.file = ../../../../secrets/thinkpad/tud.age;
agdsn.file = ../../../../secrets/thinkpad/agdsn.age;
2023-12-24 23:40:01 +01:00
ifsr-apb-auth = {
file = ../../../../secrets/thinkpad/ifsr-apb-auth.age;
};
2023-11-16 13:29:18 +01:00
};
2022-12-29 20:25:07 +01:00
networking = {
2023-12-24 23:40:01 +01:00
supplicant."enp0s31f6" = {
userControlled.enable = true;
driver = "wired";
configFile.path = config.age.secrets.ifsr-apb-auth.path;
};
2022-12-29 20:25:07 +01:00
wireless.networks = {
2022-12-29 20:50:01 +01:00
eduroam = {
2022-12-29 20:25:07 +01:00
auth = ''
eap=TTLS
2022-12-29 20:25:07 +01:00
anonymous_identity="anonymous@tu-dresden.de"
ca_cert="/etc/ssl/certs/ca-certificates.crt"
domain_suffix_match="radius-eduroam.zih.tu-dresden.de"
identity="rose159e@tu-dresden.de"
password="@EDUROAM_AUTH@"
phase2="auth=PAP"
2024-06-27 12:07:23 +02:00
bssid_ignore=7c:5a:1c:02:3d:ef 82:5a:1c:02:3d:ef 82:5a:1c:02:3d:db 7c:5a:1c:02:3d:8b
'';
extraConfig = ''
scan_ssid=1
2022-12-29 20:25:07 +01:00
'';
authProtocols = [ "WPA-EAP" ];
};
2022-12-29 20:50:01 +01:00
agdsn = {
2022-12-29 20:25:07 +01:00
auth = ''
eap=TTLS
2023-10-08 14:22:52 +02:00
anonymous_identity="wifi@agdsn.de"
2022-12-29 20:25:07 +01:00
ca_cert="/etc/ssl/certs/ca-certificates.crt"
domain_suffix_match="radius.agdsn.de"
identity="r5"
2023-10-22 15:45:30 +02:00
password="@AGDSN_WIFI_AUTH@"
phase2="auth=PAP"
2024-04-19 11:34:01 +02:00
bssid_ignore=b8:3a:5a:8b:96:c2
2023-10-22 15:45:30 +02:00
'';
authProtocols = [ "WPA-EAP" ];
};
agdsn-office = {
2023-11-20 22:46:51 +01:00
priority = 5;
2023-10-22 15:45:30 +02:00
auth = ''
eap=TTLS
anonymous_identity="wifi@agdsn.de"
ca_cert="/etc/ssl/certs/ca-certificates.crt"
domain_suffix_match="radius.agdsn.de"
identity="r5"
proto=WPA2
2022-12-29 20:25:07 +01:00
password="@AGDSN_AUTH@"
phase2="auth=PAP"
'';
authProtocols = [ "WPA-EAP" ];
};
2024-07-31 14:16:33 +02:00
agdsn_fritzbox = {
psk = "@AGDSN_FRITZBOX_PSK@";
authProtocols = [ "WPA-PSK" ];
};
2022-12-30 22:44:05 +01:00
FSR = {
psk = "@FSR_PSK@";
authProtocols = [ "WPA-PSK" ];
};
};
2022-12-29 20:25:07 +01:00
openconnect.interfaces = {
2023-01-10 11:31:33 +01:00
TUD-A-Tunnel = {
# apparently device names have a character limit
2022-12-29 20:25:07 +01:00
protocol = "anyconnect";
gateway = "vpn2.zih.tu-dresden.de";
user = "rose159e@tu-dresden.de";
2023-11-16 13:29:18 +01:00
passwordFile = config.age.secrets.tud.path;
2022-12-29 20:25:07 +01:00
autoStart = false;
extraOptions = {
authgroup = "A-Tunnel-TU-Networks";
compression = "stateless";
};
};
2023-01-10 11:31:33 +01:00
TUD-C-Tunnel = {
2023-01-02 22:46:26 +01:00
protocol = "anyconnect";
gateway = "vpn2.zih.tu-dresden.de";
user = "rose159e@tu-dresden.de";
2023-11-16 13:29:18 +01:00
passwordFile = config.age.secrets.tud.path;
2023-01-02 22:46:26 +01:00
autoStart = false;
extraOptions = {
authgroup = "C-Tunnel-All-Networks";
compression = "stateless";
};
};
};
};
2023-12-17 17:22:12 +01:00
systemd.services = {
openfortivpn-agdsn = {
description = "AG DSN Fortinet VPN";
2024-07-31 14:16:33 +02:00
script = "${pkgs.openfortivpn}/bin/openfortivpn vpn.agdsn.de:443 --realm admin-vpn -u r5 -p $(cat $CREDENTIALS_DIRECTORY/password) --trusted-cert f49ac8a174c758737c3e27d93bc2f5de37e634e2f04029a85bdb629c0ebeed31";
2023-12-17 17:22:12 +01:00
requires = [ "network-online.target" ];
after = [ "network.target" "network-online.target" ];
serviceConfig = {
Type = "simple";
LoadCredential = [
"password:${config.age.secrets.agdsn.path}"
];
ProtectSystem = true;
ProtectKernelLogs = true;
ProtectKernelTunables = true;
ProtectKernelModules = true;
ProtectHome = true;
ProtectClock = true;
PrivateTmp = true;
LockPersonality = true;
};
};
};
}