Load balancers
router.loadBalancers: services on several hosts (HAProxy) with HTTP checks, TLS terminated on the router or passed through, the client in X-Forwarded-For or the PROXY protocol, host names that choose a service on a shared port and are published in the local DNS. A status page lists the backends.
This commit is contained in:
@@ -62,6 +62,19 @@ let
|
||||
|
||||
setOf = xs: "{ ${lib.concatMapStringsSep ", " toString xs} }";
|
||||
|
||||
# Load balancers listen on the router: their port is open in their zones.
|
||||
lbInput = lib.concatLists (
|
||||
lib.mapAttrsToList (
|
||||
name: lb:
|
||||
let
|
||||
devs = lib.unique (
|
||||
lib.concatMap (z: if z == "wan" then uplinks else zoneDevices z) lb.listen.zones
|
||||
);
|
||||
in
|
||||
lib.optional (devs != [ ]) "iifname ${set devs} tcp dport ${toString lb.listen.port} accept # load balancer ${name}"
|
||||
) cfg.loadBalancers
|
||||
);
|
||||
|
||||
# Layer 4 match; `ports` and `sports` may be ints or "a-b" ranges.
|
||||
l4 =
|
||||
proto: ports: sports:
|
||||
@@ -261,6 +274,7 @@ in
|
||||
lib.concatMapStringsSep ", " toString listenPorts
|
||||
} } accept # wireguard"
|
||||
}
|
||||
${lib.concatStringsSep "\n " lbInput}
|
||||
${lib.optionalString (dhcpIfaces != [ ]) "iifname ${set dhcpIfaces} udp dport 67 accept"}
|
||||
${lib.optionalString (mgmtIfaces != [ ]) "iifname ${set mgmtIfaces} tcp dport { ${
|
||||
lib.concatMapStringsSep ", " toString ([ 22 ] ++ config.router.managementPorts)
|
||||
|
||||
Reference in New Issue
Block a user