Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/ns-migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions packages/ns-migration/files/scripts/redirects
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])

Expand Down
Loading