blob: 373b0d287a11d98727216ac7e885201b759097ec (
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
|
{
config,
pkgs,
lib,
inputs,
...
}: {
imports = [
inputs.disko.nixosModules.disko
./disks.nix
./minecraft.nix
./iwlwifi.nix
./caddy.nix
];
# services.tailscale.extraSetFlags = ["--advertise-exit-node"];
# backup usb teather configuration
systemd.network.networks."80-usb-teather" = {
name = "enp0s20f0u2";
networkConfig.DHCP = "yes";
};
systemd.services."disable-wifi-powersave" = {
description = "Disable wifi powersaving using iw";
after = ["network.target"];
serviceConfig.ExecStart = "${pkgs.iw}/bin/iw dev wlp108s0 set power_save off";
wantedBy = ["default.target"];
};
# VPN to server
systemd.network = {
netdevs."10-wg0" = {
netdevConfig = {
Kind = "wireguard";
Name = "wg0";
};
wireguardConfig = {
PrivateKeyFile = config.collinux.secrets."wireguard-pk".path;
ListenPort = 51820;
};
wireguardPeers = [
{
PublicKey = "seOq75FUGb+KThvOXCEAGdabWbb+jTRUntITpuAPgWA=";
AllowedIPs = "0.0.0.0/0";
Endpoint = "20.251.8.247:51820";
PersistentKeepalive = 25;
}
];
};
networks."wg0" = {
matchConfig.Name = "wg0";
address = ["10.100.0.2/24"];
DHCP = "no";
networkConfig.IPv6AcceptRA = false;
};
};
# kill-switch for qbittorrent traffic
networking.firewall.extraCommands =
# bash
''
# Allow qbittorrent to talk to itself (WebUI on 127.0.0.1)
iptables -A OUTPUT -o lo -m owner --uid-owner qbittorrent -j ACCEPT
# Allow all qbittorrent traffic over WireGuard
iptables -A OUTPUT -o wg0 -m owner --uid-owner qbittorrent -j ACCEPT
# Block everything else from qbittorrent user (kill switch)
iptables -A OUTPUT -m owner --uid-owner qbittorrent -j REJECT
'';
services.fail2ban.enable = true;
# merge logs from subdomains
services.caddy.virtualHosts."up.williamsfam.us.com".logFormat = lib.mkForce ''
output file /var/log/caddy/access-williamsfam.us.com.log
'';
# i broke something and this fixes it
environment.etc."systemd/resolved.conf.d/10-dns.conf".text = config.environment.etc."systemd/resolved.conf".text;
}
|