diff --git a/packages/ns-migration/README.md b/packages/ns-migration/README.md index 7278d0566..b52f14ab6 100644 --- a/packages/ns-migration/README.md +++ b/packages/ns-migration/README.md @@ -133,6 +133,8 @@ 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 cb6797aab..3c65bd34f 100755 --- a/packages/ns-migration/files/scripts/redirects +++ b/packages/ns-migration/files/scripts/redirects @@ -8,6 +8,11 @@ import nsmigration 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" # delete existing, if any @@ -42,6 +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, VPN zones are dropped + if pf.get('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])