Bug #3346

Cannot use main as provider name

Added by Filippo Carletti over 5 years ago. Updated over 5 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:nethserver-firewall-base
Target version:v6.7
Security class: Resolution:
Affected version:v6.7 NEEDINFO:No

Description

Creating a multiwan provider named "main", the system returns a generic error, and shorewall doesn't start.
shorewall check returns:

ERROR: Duplicate provider (main) /etc/shorewall/providers (line 24)

main is a reserved iproute2 rt_name.
I propose to forbid the option to use such a name for a provider.

The same applies for the name "local".

Associated revisions

Revision 7d7de7e1
Added by Filippo Carletti over 5 years ago

multi-wan: forbid main and local names (thanks Giacomo). Refs #3346

History

#1 Updated by Giacomo Sanchietti over 5 years ago

This patch should do the work:

--- Providers/Modify.php.ori    2016-01-27 16:19:26.930175676 +0100
+++ Providers/Modify.php    2016-01-27 16:19:41.055138879 +0100
@@ -48,7 +48,7 @@
         }

         $p = $this->getPlatform();
-        $nv = $p->createValidator()->maxLength(5)->minLength(1);
+        $nv = $p->createValidator()->maxLength(5)->minLength(1)->regexp('/^(?:(?!main).)*$/')->regexp('/^(?:(?!local).)*$/');
         $parameterSchema = array(
             array('name', $nv, \Nethgui\Controller\Table\Modify::KEY),
             array('interface', $p->createValidator()->memberOf($this->interfaces), \Nethgui\Controller\Table\Modify::FIELD),

#2 Updated by Filippo Carletti over 5 years ago

  • Status changed from NEW to TRIAGED
  • % Done changed from 0 to 20

#3 Updated by Filippo Carletti over 5 years ago

  • Status changed from TRIAGED to ON_DEV
  • Assignee set to Filippo Carletti
  • % Done changed from 20 to 30

#4 Updated by Filippo Carletti over 5 years ago

  • Status changed from ON_DEV to MODIFIED
  • Assignee deleted (Filippo Carletti)
  • % Done changed from 30 to 60

#5 Updated by Filippo Carletti over 5 years ago

  • Status changed from MODIFIED to ON_QA
  • % Done changed from 60 to 70

Packages in nethserver-testing:

nethserver-firewall-base-2.10.1-1.1.g7d7de7e.ns6.noarch.rpm
nethserver-firewall-base-ui-2.10.1-1.1.g7d7de7e.ns6.noarch.rpm

Test case:
try to create a multiwannamed "main" or "local" - it should fail and display a red error box with the following error


Name
regular expression /^(?:(?!main).)*$/

#6 Updated by Filippo Carletti over 5 years ago

  • Target version set to v6.7

#7 Updated by dz0 0te over 5 years ago

  • Assignee set to dz0 0te

#8 Updated by dz0 0te over 5 years ago

  • Status changed from ON_QA to VERIFIED
  • Assignee deleted (dz0 0te)
  • % Done changed from 70 to 90

System and Package Version installed
VM KVM - Clean install of Nethserver 6.7 fully updated dual eth
Package Installed:
nethserver-firewall-base-2.10.1-1.ns6.noarch
nethserver-firewall-base-ui-2.10.1-1.ns6.noarch
Other Package installed: Basic firewall, Intrusion Prevention System

Test Original Problem
replicated the bug, trying to create a multiwan provider named "main"

Install Updated Package

yum --enablerepo=nethserver-testing  update nethserver-firewall-base-2.10.1-1.1.g7d7de7e.ns6.noarch nethserver-firewall-base-ui-2.10.1-1.1.g7d7de7e.ns6.noarch

Test Results after update
Test case 1:
now trying to create a multiwan named "main" or "local" fail and display a red error box with the following error

Name
regular expression /^(?:(?!main).)*$/

Verified or Reopen
Verified

Note

#9 Updated by Giacomo Sanchietti over 5 years ago

  • Status changed from VERIFIED to CLOSED
  • % Done changed from 90 to 100

Released in 6.7/nethserver-updates:
nethserver-firewall-base-2.10.2-1.ns6.noarch.rpm
nethserver-firewall-base-ui-2.10.2-1.ns6.noarch.rpm

Released in 7.2.1511/nethserver-updates:
nethserver-firewall-base-2.10.2-1.12.g0a45b0d.ns7.noarch.rpm
nethserver-firewall-base-ui-2.10.2-1.12.g0a45b0d.ns7.noarch.rpm

Also available in: Atom PDF