ensuring only relevant access is provided
This commit is contained in:
1 parent
5b2621acbc
commit
ed558a196f
3 files changed
+9
-2
No files matched your search
@@ -70,6 +70,9 @@ services.hermenix.publish = [
|
|||||||
```
|
```
|
||||||
|
|
||||||
DNATs the uplink port and opens the forward rule. Ports need not match.
|
DNATs the uplink port and opens the forward rule. Ports need not match.
|
||||||
|
A published port only answers on the host's own addresses (LAN, tailscale, and
|
||||||
|
so on). Traffic to other addresses the host routes for, such as containers with
|
||||||
|
their own LAN IPs, is left alone.
|
||||||
Publishing is the one change that lets the outside world start conversations
|
Publishing is the one change that lets the outside world start conversations
|
||||||
with the agent's machine — put TLS/auth in front of anything that isn't a toy.
|
with the agent's machine — put TLS/auth in front of anything that isn't a toy.
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ in
|
|||||||
type nat hook prerouting priority dstnat;
|
type nat hook prerouting priority dstnat;
|
||||||
''
|
''
|
||||||
+ lib.concatMapStrings (s: ''
|
+ lib.concatMapStrings (s: ''
|
||||||
iifname != "${net.bridge}" ${s.proto} dport ${toString s.hostPort} dnat to ${net.guestAddress}:${toString s.guestPort}
|
iifname != "${net.bridge}" fib daddr type local ${s.proto} dport ${toString s.hostPort} dnat to ${net.guestAddress}:${toString s.guestPort}
|
||||||
'') cfg.publish
|
'') cfg.publish
|
||||||
+ ''
|
+ ''
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,11 @@ let
|
|||||||
hostResults = {
|
hostResults = {
|
||||||
# --- NAT mode: the original behaviour has to be unchanged ----------
|
# --- NAT mode: the original behaviour has to be unchanged ----------
|
||||||
"nat: no bridged-mode bridge table" = !(natNft ? "hermenix-bridge");
|
"nat: no bridged-mode bridge table" = !(natNft ? "hermenix-bridge");
|
||||||
"nat: publish is DNATed to the guest" = has "dnat to 10.77.0.2:8080" natNat.content;
|
"nat: publish is DNATed to the guest, only for the host's own addresses" =
|
||||||
|
has "fib daddr type local tcp dport 8080 dnat to 10.77.0.2:8080" natNat.content;
|
||||||
|
"nat: every DNAT rule is limited to the host's own addresses" = lib.all (
|
||||||
|
l: !(has "dnat to" l) || has "fib daddr type local" l
|
||||||
|
) (lib.splitString "\n" natNat.content);
|
||||||
"nat: outbound masquerades on the uplink" = has "masquerade" natNat.content;
|
"nat: outbound masquerades on the uplink" = has "masquerade" natNat.content;
|
||||||
"nat: input rules match the fixed service-net address" =
|
"nat: input rules match the fixed service-net address" =
|
||||||
has "ip saddr 10.77.0.2 tcp dport 5000 accept" natInput && !(has "meta mark" natInput);
|
has "ip saddr 10.77.0.2 tcp dport 5000 accept" natInput && !(has "meta mark" natInput);
|
||||||
|
|||||||
Reference in new issue
Block a user