nixos/shill: Replicate port forwards for internal routing
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 17m23s
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 17m23s
This commit is contained in:
parent
20a3873d25
commit
5686aa1a01
@ -1,7 +1,7 @@
|
|||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib.my) net;
|
inherit (lib.my) net nft;
|
||||||
inherit (lib.my.c.colony) domain prefixes;
|
inherit (lib.my.c.colony) domain prefixes firewallForwards;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./containers ];
|
imports = [ ./containers ];
|
||||||
@ -151,6 +151,7 @@ in
|
|||||||
firewall = {
|
firewall = {
|
||||||
tcp.allowed = [ 19999 ];
|
tcp.allowed = [ 19999 ];
|
||||||
trustedInterfaces = [ "ctrs" ];
|
trustedInterfaces = [ "ctrs" ];
|
||||||
|
nat.forwardPorts."${allAssignments.estuary.internal.ipv4.address}" = firewallForwards allAssignments;
|
||||||
extraRules = ''
|
extraRules = ''
|
||||||
table inet filter {
|
table inet filter {
|
||||||
chain forward {
|
chain forward {
|
||||||
@ -158,6 +159,17 @@ in
|
|||||||
iifname vms oifname ctrs accept
|
iifname vms oifname ctrs accept
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
table inet nat {
|
||||||
|
# Hack to fix our NAT situation with internal routing
|
||||||
|
# We need to snat to our public IP, otherwise on the return path from e.g. middleman it will
|
||||||
|
# try to forward packet directly with its own IP, bypassing our carefully crafted DNAT...
|
||||||
|
chain ${nft.dnatChain allAssignments.estuary.internal.ipv4.address} {
|
||||||
|
ct mark set 0x1337
|
||||||
|
}
|
||||||
|
chain postrouting {
|
||||||
|
ct mark 0x1337 snat ip to ${assignments.internal.ipv4.address}
|
||||||
|
}
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user