2024-08-12 02:06:47 +02:00
|
|
|
{ pkgs, ... }: {
|
2024-06-23 12:07:50 +02:00
|
|
|
networking = {
|
|
|
|
firewall = {
|
|
|
|
enable = true;
|
|
|
|
allowedTCPPorts = [
|
2024-07-07 04:15:42 +02:00
|
|
|
80 # HTTP
|
|
|
|
443 # HTTPS
|
|
|
|
42420 # Vintage Story
|
|
|
|
25565 # Minecraft
|
2024-06-23 12:07:50 +02:00
|
|
|
1443 # Headscale DERP (tcp)
|
2024-07-07 04:15:42 +02:00
|
|
|
25 # Mailserver
|
|
|
|
143 # Mailserver
|
|
|
|
465 # Mailserver
|
|
|
|
587 # Mailserver
|
|
|
|
993 # Mailserver
|
|
|
|
4190 # Mailserver
|
|
|
|
4443 # Jitsi
|
2024-06-23 12:07:50 +02:00
|
|
|
];
|
|
|
|
allowedUDPPorts = [
|
|
|
|
3478 # Headscale DERP (udp)
|
2024-07-07 04:15:42 +02:00
|
|
|
10000 # Jitsi Meet (udp)
|
|
|
|
15636 # Enshrouded - Game
|
|
|
|
15637 # Enshrouded - Query Port
|
2024-06-23 12:07:50 +02:00
|
|
|
];
|
|
|
|
};
|
2024-07-07 04:15:42 +02:00
|
|
|
|
|
|
|
nftables = {
|
|
|
|
enable = true;
|
|
|
|
ruleset = ''
|
|
|
|
table ip nat {
|
|
|
|
chain PREROUTING {
|
|
|
|
type nat hook prerouting priority dstnat; policy accept;
|
|
|
|
iifname "enp0s4" udp dport 10000 dnat to 10.100.0.2:10000;
|
|
|
|
iifname "enp0s4" udp dport 15636 dnat to 10.100.1.2:15636;
|
|
|
|
iifname "enp0s4" udp dport 15637 dnat to 10.100.1.2:15637;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
nat = {
|
|
|
|
enable = true;
|
|
|
|
internalInterfaces = [ "enp0s4" ];
|
|
|
|
externalInterface = "wireguard0";
|
|
|
|
forwardPorts = [
|
|
|
|
{ sourcePort = 10000; proto = "udp"; destination = "10.100.0.2:10000"; }
|
|
|
|
{ sourcePort = 15636; proto = "udp"; destination = "10.100.1.2:15636"; }
|
|
|
|
{ sourcePort = 15637; proto = "udp"; destination = "10.100.1.2:15637"; }
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-12 02:06:47 +02:00
|
|
|
environment.systemPackages = [ pkgs.cacert ];
|
2024-09-30 02:38:20 +02:00
|
|
|
|
2024-09-30 05:01:20 +02:00
|
|
|
services.haproxy = {
|
2024-07-07 04:15:42 +02:00
|
|
|
enable = true;
|
|
|
|
config = ''
|
|
|
|
defaults
|
|
|
|
timeout connect 10s
|
|
|
|
timeout client 30s
|
|
|
|
timeout server 30s
|
2024-08-12 02:06:47 +02:00
|
|
|
maxconn 3000
|
|
|
|
log global
|
2024-07-07 04:15:42 +02:00
|
|
|
|
|
|
|
frontend http
|
|
|
|
mode http
|
|
|
|
bind :80
|
2024-08-12 02:06:47 +02:00
|
|
|
bind :443 ssl crt /Storage/Data/Docker/sysctl.io/letsencrypt/external/*.sysctl.io/combined.pem
|
2024-09-30 02:38:20 +02:00
|
|
|
|
2024-08-12 02:06:47 +02:00
|
|
|
http-request redirect scheme https unless { ssl_fc }
|
2024-07-07 04:15:42 +02:00
|
|
|
default_backend backend_http
|
2024-08-12 02:06:47 +02:00
|
|
|
backend backend_http
|
|
|
|
mode http
|
|
|
|
option forwardfor
|
|
|
|
option forwarded
|
|
|
|
server warsaw-ovh-01 10.100.0.2:443 ssl verify required ca-file ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt sni req.hdr(Host)
|
2024-08-26 14:46:56 +02:00
|
|
|
|
|
|
|
frontend vintage-story
|
|
|
|
mode tcp
|
|
|
|
bind :42420
|
|
|
|
default_backend backend_tcp
|
|
|
|
backend backend_tcp
|
|
|
|
mode tcp
|
|
|
|
server vintage-story-wg 10.100.1.5
|
|
|
|
|
2024-07-07 04:15:42 +02:00
|
|
|
frontend tcp
|
|
|
|
mode tcp
|
2024-08-12 02:06:47 +02:00
|
|
|
bind :25565
|
|
|
|
bind :4443
|
|
|
|
default_backend backend_tcp
|
|
|
|
backend backend_tcp
|
|
|
|
mode tcp
|
|
|
|
server warsaw-ovh-01 10.100.0.2
|
2024-07-07 04:15:42 +02:00
|
|
|
|
|
|
|
frontend mail
|
|
|
|
mode tcp
|
|
|
|
bind :25
|
|
|
|
bind :143
|
|
|
|
bind :465
|
|
|
|
bind :587
|
|
|
|
bind :993
|
|
|
|
bind :4190
|
|
|
|
default_backend backend_mail
|
|
|
|
backend backend_mail
|
|
|
|
mode tcp
|
|
|
|
server mailserver-wg 10.100.1.3
|
|
|
|
'';
|
2024-06-23 12:07:50 +02:00
|
|
|
};
|
|
|
|
}
|