tangled
alpha
login
or
join now
devins.page
/
flake
0
fork
atom
configurations for my servers and desktops
nix
nixos
flake
dots
dotfiles
0
fork
atom
overview
issues
pulls
pipelines
fix: stuff
devins.page
3 months ago
828b78e2
bbc9af8d
+39
-27
2 changed files
expand all
collapse all
unified
split
hosts
bluepill-proxy
default.nix
services
nftables.nix
+1
-1
hosts/bluepill-proxy/default.nix
···
1
1
-
{pkgs, ...}: {
1
1
+
{...}: {
2
2
imports = [
3
3
./hardware.nix
4
4
./services/caddy.nix
+38
-26
hosts/bluepill-proxy/services/nftables.nix
···
1
1
-
{pkgs, ...}: {
2
2
-
networking.sysctl = {
3
3
-
"net.ipv4.ip_forward" = 1;
4
4
-
"net.ipv6.conf.all.forwarding" = 1;
5
5
-
};
1
1
+
{
2
2
+
networking = {
3
3
+
sysctl = {
4
4
+
"net.ipv4.ip_forward" = 1;
5
5
+
"net.ipv6.conf.all.forwarding" = 1;
6
6
+
};
6
7
7
7
-
networking.firewall = {
8
8
-
enable = true;
9
9
-
allowedTCPPorts = [25565];
10
10
-
allowedUDPPorts = [25565 24454 19132];
11
11
-
};
8
8
+
firewall = {
9
9
+
enable = true;
10
10
+
allowedTCPPorts = [25565];
11
11
+
allowedUDPPorts = [25565 24454 19132];
12
12
13
13
-
networking.nftables = {
14
14
-
enable = true;
15
15
-
extraRules = ''
16
16
-
table ip nat {
17
17
-
chain prerouting {
18
18
-
type nat hook prerouting priority dstnat; policy accept;
19
19
-
tcp dport 25565 dnat to 100.109.134.42:25565;
20
20
-
udp dport 25565 dnat to 100.109.134.42:25565;
21
21
-
udp dport 24454 dnat to 100.109.134.42:24454;
22
22
-
udp dport 19132 dnat to 100.109.134.42:19132;
23
23
-
}
13
13
+
extraCommands = ''
14
14
+
nft add rule ip nat postrouting oif tailscale0 ip daddr 100.109.134.42 counter snat to 100.108.47.83
15
15
+
'';
16
16
+
};
24
17
25
25
-
chain postrouting {
26
26
-
type nat hook postrouting priority srcnat; policy accept;
27
27
-
ip daddr 100.109.134.42 snat to 100.108.47.83;
18
18
+
nat = {
19
19
+
enable = true;
20
20
+
forwardPorts = [
21
21
+
{
22
22
+
sourcePort = 25565;
23
23
+
proto = "tcp";
24
24
+
destination = "100.109.134.42:25565";
28
25
}
29
29
-
}
30
30
-
'';
26
26
+
{
27
27
+
sourcePort = 25565;
28
28
+
proto = "udp";
29
29
+
destination = "100.109.134.42:25565";
30
30
+
}
31
31
+
{
32
32
+
sourcePort = 24454;
33
33
+
proto = "udp";
34
34
+
destination = "100.109.134.42:24454";
35
35
+
}
36
36
+
{
37
37
+
sourcePort = 19132;
38
38
+
proto = "udp";
39
39
+
destination = "100.109.134.42:19132";
40
40
+
}
41
41
+
];
42
42
+
};
31
43
};
32
44
}