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

167 lines
5 KiB
Nix
Raw Normal View History

2024-08-22 11:39:42 +02:00
{ config, pkgs, lib, ... }:
{
2023-12-17 17:22:12 +01:00
age.secrets = {
tud.file = ../../../../secrets/thinkpad/tud.age;
agdsn.file = ../../../../secrets/thinkpad/agdsn.age;
2024-08-07 13:40:02 +02:00
dyport-auth = {
file = ../../../../secrets/thinkpad/dyport-auth.age;
2023-12-24 23:40:01 +01:00
};
2023-11-16 13:29:18 +01:00
};
2022-12-29 20:25:07 +01:00
networking = {
2024-08-22 11:39:42 +02:00
supplicant = {
"LAN" = {
2024-08-07 13:40:02 +02:00
userControlled.enable = true;
driver = "wired";
2024-09-26 17:48:59 +02:00
configFile.path = pkgs.writeText "supplicant-lan.conf" ''
ctrl_interface=/run/wpa_supplicant
ap_scan=0
network={
ssid="apb-ifsr"
key_mgmt=IEEE8021X
eap=TTLS
anonymous_identity="rose159e@apb-ifsr"
ca_cert="/etc/ssl/certs/ca-certificates.crt"
domain_suffix_match="radius-tud.zih.tu-dresden.de"
identity="rose159e@apb-ifsr"
password=ext:TUD_AUTH
phase2="auth=PAP"
disabled=1
}
network={
ssid="zih-ma"
key_mgmt=IEEE8021X
eap=TTLS
anonymous_identity="rose159e@zih-ma"
ca_cert="/etc/ssl/certs/ca-certificates.crt"
domain_suffix_match="radius-tud.zih.tu-dresden.de"
identity="rose159e@zih-ma"
password=ext:TUD_AUTH
phase2="auth=PAP"
disabled=1
}
ext_password_backend=file:${config.age.secrets.dyport-auth.path}
'';
# configFile.path = config.age.secrets.dyport-auth.path;
2024-08-07 13:40:02 +02:00
};
2023-12-24 23:40:01 +01:00
};
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"
2024-09-26 17:48:59 +02:00
password=ext: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"
2024-09-26 17:48:59 +02:00
password=ext:AGDSN_WIFI_AUTH
2023-10-22 15:45:30 +02:00
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
2024-09-26 17:48:59 +02:00
password=ext:AGDSN_AUTH
2022-12-29 20:25:07 +01:00
phase2="auth=PAP"
'';
2024-08-13 11:38:01 +02:00
extraConfig = "disabled=1";
2022-12-29 20:25:07 +01:00
authProtocols = [ "WPA-EAP" ];
};
2024-07-31 14:16:33 +02:00
agdsn_fritzbox = {
2024-09-26 17:48:59 +02:00
psk = "ext:AGDSN_FRITZBOX_PSK";
2024-07-31 14:16:33 +02:00
authProtocols = [ "WPA-PSK" ];
};
2022-12-30 22:44:05 +01:00
FSR = {
2024-09-26 17:48:59 +02:00
psk = "ext:FSR_PSK";
2022-12-30 22:44:05 +01:00
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";
};
};
2024-08-07 13:40:02 +02:00
ZIH = {
protocol = "anyconnect";
gateway = "vpn2.zih.tu-dresden.de";
user = "rose159e@zih-ma-vpn";
passwordFile = config.age.secrets.tud.path;
2024-08-13 11:38:01 +02:00
autoStart = false;
extraOptions = {
authgroup = "A-Tunnel-TU-Networks";
compression = "stateless";
2024-08-07 13:40:02 +02:00
};
};
};
};
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;
};
};
2024-08-22 11:39:42 +02:00
# fix systemd dependencies for supplicant services
"supplicant-lan@" = {
wantedBy = lib.mkForce [ ];
};
2023-12-17 17:22:12 +01:00
};
}