From 11263e90ac1f96a7f78520bcad83911e1e022363 Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 6 Dec 2023 19:48:09 +0900 Subject: [PATCH] test --- nixos/hosts/osaka-linode-01/firewall.nix | 89 +++++------------------- 1 file changed, 17 insertions(+), 72 deletions(-) diff --git a/nixos/hosts/osaka-linode-01/firewall.nix b/nixos/hosts/osaka-linode-01/firewall.nix index 52aaca28..36ef7284 100644 --- a/nixos/hosts/osaka-linode-01/firewall.nix +++ b/nixos/hosts/osaka-linode-01/firewall.nix @@ -22,77 +22,22 @@ ]; networking.firewall.extraCommands = '' - iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT - iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT - - # TCP PORTS ################################################################################################## - # PORT 80 - iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 80 - - # PORT 443 - iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 443 - - # PORT 25 - iptables -t nat -A PREROUTING -p tcp --dport 25 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 25 - - # PORT 465 - iptables -t nat -A PREROUTING -p tcp --dport 465 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 465 - - # PORT 587 - iptables -t nat -A PREROUTING -p tcp --dport 587 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 587 - - # PORT 143 - iptables -t nat -A PREROUTING -p tcp --dport 143 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 143 - - # PORT 993 - iptables -t nat -A PREROUTING -p tcp --dport 993 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 993 - - # PORT 4190 - iptables -t nat -A PREROUTING -p tcp --dport 4190 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 4190 - - # PORT 42420 - iptables -t nat -A PREROUTING -p tcp --dport 42420 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 42420 - - # PORT 25565 - iptables -t nat -A PREROUTING -p tcp --dport 25565 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 25565 - - # PORT 1443 - iptables -t nat -A PREROUTING -p tcp --dport 1443 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 1443 - - # PORT 4443 - iptables -t nat -A PREROUTING -p tcp --dport 4443 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 4443 - - # PORT 5222 - iptables -t nat -A PREROUTING -p tcp --dport 5222 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 5222 - - # PORT 5347 - iptables -t nat -A PREROUTING -p tcp --dport 5347 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 5347 - - # PORT 5280 - iptables -t nat -A PREROUTING -p tcp --dport 5280 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p tcp --dport 5280 - - # UDP PORTS ################################################################################################## - # PORT 10000 - iptables -t nat -A PREROUTING -p udp --dport 10000 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p udp --dport 10000 - - # PORT 3478 - iptables -t nat -A PREROUTING -p udp --dport 3478 -j DNAT --to-destination 10.100.0.2 - iptables -t nat -A POSTROUTING -p udp --dport 3478 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 80 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 443 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 25 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 465 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 587 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 143 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 993 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 4190 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 42420 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 25565 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 1443 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 4443 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 5222 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 5347 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 5280 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 10000 -j DNAT --to-destination 10.100.0.2 + iptables -t nat -A PREROUTING -i enp0s4 -d 172.234.84.222 --dport 3478 -j DNAT --to-destination 10.100.0.2 ''; } \ No newline at end of file