From 2bfd1ad96b6418be212da4907543c0d0b4632a9f Mon Sep 17 00:00:00 2001 From: Giacomo Sanchietti Date: Fri, 20 Nov 2026 15:53:33 +0100 Subject: [PATCH 1/3] fix(migration): rename blue hairpin zone to guest NethServer 7 exports port forwards with the blue zone in their hairpin NAT zones, but the blue zone is migrated as guest. fw4 rejects the unknown zone and skips every port forward. Assisted-by: Claude Code:claude-opus-5-5 Claude-Session: https://claude.ai/code/session_01MSZ8Qo9Px5cXUv61AxqVcT --- packages/ns-migration/README.md | 1 + packages/ns-migration/files/scripts/redirects | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/ns-migration/README.md b/packages/ns-migration/README.md index 7278d0566..84990515d 100644 --- a/packages/ns-migration/README.md +++ b/packages/ns-migration/README.md @@ -133,6 +133,7 @@ Differences since NS7: - port forwards with multiple IP limitations will be split into multiple redirects - port forwards with multiple ports will be split into multiple redirects +- the `blue` hairpin zone is renamed to `guest`, like the zone itself ## Firewall rules diff --git a/packages/ns-migration/files/scripts/redirects b/packages/ns-migration/files/scripts/redirects index cb6797aab..1364debd8 100755 --- a/packages/ns-migration/files/scripts/redirects +++ b/packages/ns-migration/files/scripts/redirects @@ -42,6 +42,9 @@ for pf in data['redirects']: if restrict: sname = add_ipset(u, pfname, restrict) u.set('firewall', pfname, 'ipset', sname) + # NS7 blue zone is migrated as guest + if pf.get('reflection_zone'): + pf['reflection_zone'] = ['guest' if z == 'blue' else z for z in pf['reflection_zone']] for o in pf: u.set("firewall", pfname, o, pf[o]) From ba3c868896870ee9d4631923cbedd9ef806398ad Mon Sep 17 00:00:00 2001 From: Matteo Di Lorenzi Date: Fri, 20 Nov 2026 17:02:26 +0100 Subject: [PATCH 2/3] fix(migration): update hairpin zone names from blue/orange to guest/dmz --- packages/ns-migration/README.md | 2 +- packages/ns-migration/files/scripts/redirects | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/ns-migration/README.md b/packages/ns-migration/README.md index 84990515d..3b10224d6 100644 --- a/packages/ns-migration/README.md +++ b/packages/ns-migration/README.md @@ -133,7 +133,7 @@ Differences since NS7: - port forwards with multiple IP limitations will be split into multiple redirects - port forwards with multiple ports will be split into multiple redirects -- the `blue` hairpin zone is renamed to `guest`, like the zone itself +- the `blue` and `orange` hairpin zones are renamed to `guest` and `dmz`, like the zones themselves ## Firewall rules diff --git a/packages/ns-migration/files/scripts/redirects b/packages/ns-migration/files/scripts/redirects index 1364debd8..1352346c1 100755 --- a/packages/ns-migration/files/scripts/redirects +++ b/packages/ns-migration/files/scripts/redirects @@ -8,6 +8,9 @@ import nsmigration from nethsec import utils +# NS7 zone names that differ on NethSecurity +REFLECTION_ZONE_MAP = {'blue': 'guest', 'orange': 'dmz'} + def add_ipset(u, rname, restrict): sname = f"{rname}_ipset" # delete existing, if any @@ -42,9 +45,9 @@ for pf in data['redirects']: if restrict: sname = add_ipset(u, pfname, restrict) u.set('firewall', pfname, 'ipset', sname) - # NS7 blue zone is migrated as guest + # NS7 blue and orange zones are migrated as guest and dmz if pf.get('reflection_zone'): - pf['reflection_zone'] = ['guest' if z == 'blue' else z for z in pf['reflection_zone']] + pf['reflection_zone'] = [REFLECTION_ZONE_MAP.get(z, z) for z in pf['reflection_zone']] for o in pf: u.set("firewall", pfname, o, pf[o]) From ce7aa1e2dc3fd20e8d6e872474320bbe8fd3dd60 Mon Sep 17 00:00:00 2001 From: Matteo Di Lorenzi Date: Fri, 20 Nov 2026 17:31:28 +0100 Subject: [PATCH 3/3] fix(migration): exclude VPN zones from hairpin zone reflection --- packages/ns-migration/README.md | 1 + packages/ns-migration/files/scripts/redirects | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/ns-migration/README.md b/packages/ns-migration/README.md index 3b10224d6..b52f14ab6 100644 --- a/packages/ns-migration/README.md +++ b/packages/ns-migration/README.md @@ -134,6 +134,7 @@ Differences since NS7: - port forwards with multiple IP limitations will be split into multiple redirects - port forwards with multiple ports will be split into multiple redirects - the `blue` and `orange` hairpin zones are renamed to `guest` and `dmz`, like the zones themselves +- VPN zones (`rwopenvpn`, `openvpn`, `ipsec`) are not added as hairpin zones: reflection on them requires an explicit subnet ## Firewall rules diff --git a/packages/ns-migration/files/scripts/redirects b/packages/ns-migration/files/scripts/redirects index 1352346c1..3c65bd34f 100755 --- a/packages/ns-migration/files/scripts/redirects +++ b/packages/ns-migration/files/scripts/redirects @@ -10,6 +10,8 @@ from nethsec import utils # NS7 zone names that differ on NethSecurity REFLECTION_ZONE_MAP = {'blue': 'guest', 'orange': 'dmz'} +# reflection on VPN zones requires an explicit subnet, fw4 disables it anyway +VPN_ZONES = {'rwopenvpn', 'openvpn', 'ipsec'} def add_ipset(u, rname, restrict): sname = f"{rname}_ipset" @@ -45,9 +47,9 @@ for pf in data['redirects']: if restrict: sname = add_ipset(u, pfname, restrict) u.set('firewall', pfname, 'ipset', sname) - # NS7 blue and orange zones are migrated as guest and dmz + # NS7 blue and orange zones are migrated as guest and dmz, VPN zones are dropped if pf.get('reflection_zone'): - pf['reflection_zone'] = [REFLECTION_ZONE_MAP.get(z, z) for z in pf['reflection_zone']] + pf['reflection_zone'] = [REFLECTION_ZONE_MAP.get(z, z) for z in pf['reflection_zone'] if z not in VPN_ZONES] for o in pf: u.set("firewall", pfname, o, pf[o])