Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration: MWAN policy issues with long and similar names #1067

Open
francio87 opened this issue Feb 6, 2025 · 3 comments
Open

Migration: MWAN policy issues with long and similar names #1067

francio87 opened this issue Feb 6, 2025 · 3 comments
Labels
verified All test cases were verified successfully

Comments

@francio87
Copy link
Member

francio87 commented Feb 6, 2025

When migrating NethSecurity 7.9 to version 8, if there are two similar red interface names (e.g., timenet_ftth_12345 and timenet_fttc_212345), the process fails to correctly reassign the WAN zone to devices.

Steps to reproduce

Configure two WAN interfaces with similar names, such as timenet_ftth_12345 and timenet_fttc_12345.
Perform a migration to version 8 on the system.

Expected behavior

The system correctly reassigns the WAN zone to devices without errors.

Actual behavior

The system fails to reassign the WAN zone to devices.

The problem is that the name of the interface used inside the firewall db does not match with the named used inside the network db.

Value saved inside the network db:

    config interface 'timenet_ftth_1'
        option proto 'static'

Value saved inside 'firewall' db:

    config zone 'ns_wan'
        option name 'wan'
        option output 'ACCEPT'
        option input 'DROP'
        option forward 'REJECT'
        list network 'timenet_ftth_12345'

Also, the following unrelated error appears in the migration.log:

/usr/share/ns-migration/20wan /tmp/tmp.mMNElB/export
Command failed: Not found
Traceback (most recent call last):
  File "/usr/share/ns-migration/20wan", line 89, in <module>
    mwan.store_policy(u, f'{pname[0:6]}_only', [i])
  File "/usr/lib/python3.11/site-packages/nethsec/mwan/__init__.py", line 257, in store_policy
nethsec.utils.ValidationError: ('name', 'unique', 'timene_only')

Components
NethSecurity version: 8-23.05.5-ns.1.4.1

See also

@github-project-automation github-project-automation bot moved this to ToDo 🕐 in NethSecurity Feb 6, 2025
@Tbaile Tbaile changed the title Migration: issue with similar wan interface names Migration: MWAN policy issues with long and similar names Feb 6, 2025
@Tbaile Tbaile moved this from ToDo 🕐 to In Progress 🛠 in NethSecurity Feb 6, 2025
@Tbaile Tbaile self-assigned this Feb 6, 2025
@Tbaile Tbaile added this to the NethSecurity 8.5 milestone Feb 6, 2025
@Tbaile
Copy link
Contributor

Tbaile commented Feb 24, 2025

NS7: Using nethserver-firewall-migration-1.0.3-1.1.pr57.g60a838f.ns7.noarch.rpm check that exported network entries don't have labels but roles in the interface field.

NSec8: Using the image provided, check that ingesting a migration is successful and ensure no single network policy in MWAN is created.

Copy link
Contributor

Testing image version: 8-24.10.0-ns.1.4.99-alpha1-9-g6f17bcc3

@github-actions github-actions bot added the testing Packages are available from testing repositories label Feb 24, 2025
@Tbaile Tbaile removed their assignment Feb 24, 2025
@Tbaile Tbaile moved this from In Progress 🛠 to Testing in NethSecurity Feb 24, 2025
@francio87 francio87 self-assigned this Mar 3, 2025
@francio87
Copy link
Member Author

TC1 NS79 OK

{
  "snats": [],
  "forwardings": [],
  "bonds": [],
  "devices": {
    "52:54:00:16:d0:92": "eth0",
    "52:54:00:ed:96:94": "eth1",
    "52:54:00:e8:d1:bd": "eth2",
    "52:54:00:2c:96:5d": "eth3"
  },
  "skipped": [],
  "bridges": [],
  "zones": [
    {
      "network": [
        "wan1",
        "wan2",
        "wan3"
      ],
      "input": "DROP",
      "forward": "REJECT",
      "name": "wan",
      "output": "ACCEPT"
    },
    {
      "network": [
        "lan1"
      ],
      "input": "ACCEPT",
      "forward": "ACCEPT",
      "name": "lan",
      "output": "ACCEPT"
    }
  ],
  "vlans": [],
  "interfaces": [
    {
      "proto": "static",
      "zone": "lan",
      "name": "eth0",
      "hwaddr": "52:54:00:16:d0:92",
      "interface": "lan1",
      "netmask": "255.255.255.0",
      "role": "green",
      "ipaddr": "10.65.50.254"
    },
    {
      "proto": "static",
      "gateway": "192.168.122.1",
      "zone": "wan",
      "name": "eth1",
      "hwaddr": "52:54:00:ed:96:94",
      "bandwidth_up": "",
      "bandwidth_down": "",
      "interface": "wan1",
      "netmask": "255.255.255.0",
      "role": "red",
      "ipaddr": "192.168.122.166"
    },
    {
      "proto": "static",
      "gateway": "192.168.5.254",
      "zone": "wan",
      "name": "eth2",
      "hwaddr": "52:54:00:e8:d1:bd",
      "bandwidth_up": "",
      "bandwidth_down": "",
      "interface": "wan2",
      "netmask": "255.255.255.0",
      "role": "red",
      "ipaddr": "192.168.5.1"
    },
    {
      "proto": "static",
      "gateway": "192.168.6.254",
      "zone": "wan",
      "name": "eth3",
      "hwaddr": "52:54:00:2c:96:5d",
      "bandwidth_up": "",
      "bandwidth_down": "",
      "interface": "wan3",
      "netmask": "255.255.255.0",
      "role": "red",
      "ipaddr": "192.168.6.1"
    }
  ],
  "aliases": []
}

TC2 NSec8 OK

The migration is successful , no single policy are created in MWAN.

root@ns79:~# mwan3 status  
Interface status:
 interface wan1 is online and tracking is active (online 00h:01m:59s, uptime 00h:02m:02s)
 interface wan2 is offline and tracking is active
 interface wan3 is offline and tracking is active

Current ipv4 policies:
ns_ns7balance:
 wan1 (100%)

Current ipv6 policies:
ns_ns7balance:
 default

@francio87 francio87 added verified All test cases were verified successfully and removed testing Packages are available from testing repositories labels Mar 3, 2025
@francio87 francio87 removed their assignment Mar 3, 2025
@nethbot nethbot moved this from Testing to Verified in NethSecurity Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
verified All test cases were verified successfully
Projects
Status: Verified
Development

No branches or pull requests

2 participants