blob: 5730ead24ed400ca90d97e10477e88c8bf1b1717 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
{
config,
flakeRoot,
...
}:
let
secrets = config.sops.secrets;
in
{
imports = [ (flakeRoot + /wireguard.nix) ];
sops = {
age.keyFile = "/var/lib/sops-nix/key.txt";
secrets."wireless.env" = {
sopsFile = ../../secrets/wireless.env;
format = "dotenv";
reloadUnits = [ "iwd.service" ];
};
};
networking = {
hostName = "nyaan";
useNetworkd = true;
firewall.enable = false;
nftables = {
enable = true;
tables.filter = {
enable = true;
family = "inet";
content = ''
set temp-ports {
type inet_proto . inet_service
flags interval
comment "Temporarily opened ports"
}
chain rpfilter {
type filter hook prerouting priority mangle + 10; policy drop;
meta nfproto ipv4 udp sport . udp dport { 68 . 67, 67 . 68 } accept comment "DHCPv4 client/server"
fib saddr . mark . iif check exists accept
jump rpfilter-allow
}
chain rpfilter-allow {
}
chain prerouting {
type filter hook prerouting priority mangle;
iifname "wg0" meta mark set 42
}
chain input {
type filter hook input priority filter; policy drop;
iifname "lo" accept comment "trusted interfaces"
icmpv6 type echo-reply accept
ct state vmap { invalid : drop, established : accept, related : accept, new : jump input-allow, untracked : jump input-allow }
}
chain input-allow {
# tcp dport { 22, 80, 443 } accept
udp dport 51820 accept
meta l4proto . th dport @temp-ports accept
icmp type echo-request accept comment "allow ping"
icmpv6 type != { nd-redirect, 139 } accept comment "Accept all ICMPv6 messages except redirects and node information queries (type 139). See RFC 4890, section 4.4."
ip6 daddr fe80::/64 udp dport 546 accept comment "DHCPv6 client"
}
'';
};
};
};
networking.wireless.iwd-ext = {
enable = true;
secretsEnvFile = secrets."wireless.env".path;
networks = {
"KopsiNet-5" = {
networkType = "psk";
config.Security.Passphrase = "@KOPSINET_PSK@";
};
"Pixel_3169" = {
networkType = "psk";
config.Security.Passphrase = "@PHONE_HOTSPOT_PSK@";
};
"eduroam" = {
networkType = "8021x";
config.Security = {
EAP-Method = [
"TTLS"
"PEAP"
"TLS"
];
EAP-Identity = "mbastaja@tvz.hr";
EAP-AnonymousIdentity = "anonymous@tvz.hr";
DomainSuffixMatch = "freeradius.tvz.hr";
EAP-TTLS-Phase2-Method = "Tunneled-PAP";
};
};
"Students-TVZ" = {
networkType = "8021x";
config.Security = {
EAP-Method = "PAP";
EAP-Identity = "mbastaja@tvz.hr";
EAP-PAEP-ServerDomainMasl = "freeradius.tvz.hr";
EAP-PEAP-Phase2-Method = "MSCHAPV2";
EAP-PEAP-Phase2-Identity = "mbastaja@tvz.hr";
EAP-PEAP-Phase2-Password = "@EDUROAM_PASS@";
};
};
};
};
}
|