fix mesh filtering
This commit is contained in:
parent
ff133ea171
commit
c0950e0d39
1 changed files with 13 additions and 5 deletions
|
@ -1,13 +1,16 @@
|
||||||
{ lib, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Import nodes
|
# Import nodes
|
||||||
nodes = import ./../../nodes.nix;
|
nodes = import ./../../nodes.nix;
|
||||||
myPeer = nodes."${config.hostName}";
|
myName = config.hostName;
|
||||||
|
|
||||||
|
# Import mapping
|
||||||
|
mapping = import ./../../mapping.nix;
|
||||||
|
|
||||||
meshUdpRange = "51000-${toString (51000 + builtins.head (
|
meshUdpRange = "51000-${toString (51000 + builtins.head (
|
||||||
builtins.sort (a: b: a > b) (
|
builtins.sort (a: b: a > b) (
|
||||||
l ib.mapAttrsToList (name: node: node.id) nodes)))}";
|
lib.mapAttrsToList (name: node: node.id) nodes)))}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
networking = {
|
networking = {
|
||||||
|
@ -49,7 +52,7 @@ in
|
||||||
# Mesh
|
# Mesh
|
||||||
udp dport ${meshUdpRange} accept
|
udp dport ${meshUdpRange} accept
|
||||||
|
|
||||||
${if lib.elem myPeer mapping.bastion then ''
|
${if lib.elem myName mapping.bastion then ''
|
||||||
# Mgmt
|
# Mgmt
|
||||||
udp dport 51920 accept
|
udp dport 51920 accept
|
||||||
'' else ""}
|
'' else ""}
|
||||||
|
@ -65,7 +68,12 @@ in
|
||||||
ct state related,established accept
|
ct state related,established accept
|
||||||
ct state invalid counter drop
|
ct state invalid counter drop
|
||||||
|
|
||||||
iifname mgmt oifname mesh accept
|
${if lib.elem myName mapping.bastion then ''
|
||||||
|
iifname mgmt oifname mesh* accept
|
||||||
|
'' else ""}
|
||||||
|
|
||||||
|
# Allow mesh bounces
|
||||||
|
iifname mesh* oifname mesh* accept
|
||||||
}
|
}
|
||||||
chain output {
|
chain output {
|
||||||
type filter hook output priority 0; policy accept;
|
type filter hook output priority 0; policy accept;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue