summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-02-23 12:26:34 +0100
committerChristian Poessinger <christian@poessinger.com>2020-02-23 14:36:56 +0100
commit3d0162557f9c2217d4a925e6c893863b1af55e58 (patch)
treeb204c47d4450161654a6d75e6f203097ed82e54f
parent07273632fcf59d04be988f2c43fe53e7bec8d46a (diff)
downloadvyos-1x-3d0162557f9c2217d4a925e6c893863b1af55e58.tar.gz
vyos-1x-3d0162557f9c2217d4a925e6c893863b1af55e58.zip
pppoe: T1318: migrate user-id and password nodes under an authentication node
-rw-r--r--interface-definitions/interfaces-pppoe.xml.in27
-rwxr-xr-xsrc/conf_mode/interfaces-pppoe.py28
-rwxr-xr-xsrc/migration-scripts/interfaces/4-to-511
3 files changed, 42 insertions, 24 deletions
diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in
index 8bae0e490..933d9edf1 100644
--- a/interface-definitions/interfaces-pppoe.xml.in
+++ b/interface-definitions/interfaces-pppoe.xml.in
@@ -26,6 +26,23 @@
<constraintErrorMessage>Access concentrator name must be composed of uppper and lower case letters or numbers only</constraintErrorMessage>
</properties>
</leafNode>
+ <node name="authentication">
+ <properties>
+ <help>Authentication settings</help>
+ </properties>
+ <children>
+ <leafNode name="user">
+ <properties>
+ <help>User name</help>
+ </properties>
+ </leafNode>
+ <leafNode name="password">
+ <properties>
+ <help>Password</help>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
<leafNode name="connect-on-demand">
<properties>
<help>Automatic establishment of PPPOE connection when traffic is sent</help>
@@ -143,11 +160,6 @@
<constraintErrorMessage>Must be either 'auto' or 'none'</constraintErrorMessage>
</properties>
</leafNode>
- <leafNode name="password">
- <properties>
- <help>Password for authenticating local machine to PPPoE server</help>
- </properties>
- </leafNode>
<leafNode name="remote-address">
<properties>
<help>IPv4 address of remote end of the PPPoE link</help>
@@ -169,11 +181,6 @@
<constraintErrorMessage>Service name must be composed of uppper and lower case letters or numbers only</constraintErrorMessage>
</properties>
</leafNode>
- <leafNode name="user-id">
- <properties>
- <help>Authentication name supplied to PPPoE server</help>
- </properties>
- </leafNode>
</children>
</tagNode>
</children>
diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py
index 49902b989..d2147fa1f 100755
--- a/src/conf_mode/interfaces-pppoe.py
+++ b/src/conf_mode/interfaces-pppoe.py
@@ -78,9 +78,9 @@ replacedefaultroute
{% endif %}
mtu {{ mtu }}
mru {{ mtu }}
-user "{{ user_id }}"
-password "{{ password }}"
-{% if 'auto' in name_server -%}
+user "{{ auth_username }}"
+password "{{ auth_password }}"
+{% if name_server -%}
usepeerdns
{% endif %}
{% if ipv6_enable -%}
@@ -91,6 +91,8 @@ usepeerdns
default_config_data = {
'access_concentrator': '',
+ 'auth_username': '',
+ 'auth_password': '',
'on_demand': False,
'default_route': 'auto',
'deleted': False,
@@ -103,10 +105,8 @@ default_config_data = {
'local_address': '',
'mtu': '1492',
'name_server': 'auto',
- 'password': '',
'remote_address': '',
'service_name': '',
- 'user_id': '',
'source_interface': ''
}
@@ -137,6 +137,14 @@ def get_config():
if conf.exists(['access-concentrator']):
pppoe['access_concentrator'] = conf.return_values(['access-concentrator'])
+ # Authentication name supplied to PPPoE server
+ if conf.exists(['authentication', 'user']):
+ pppoe['auth_username'] = conf.return_value(['authentication', 'user'])
+
+ # Password for authenticating local machine to PPPoE server
+ if conf.exists(['authentication', 'password']):
+ pppoe['auth_password'] = conf.return_value(['authentication', 'password'])
+
# Access concentrator name (only connect to this concentrator)
if conf.exists(['connect-on-demand']):
pppoe['on_demand'] = True
@@ -181,11 +189,7 @@ def get_config():
if conf.exists(['name-server']):
pppoe['name_server'] = conf.return_value(['name-server'])
- # Password for authenticating local machine to PPPoE server
- if conf.exists(['password']):
- pppoe['password'] = conf.return_value(['password'])
-
- # IPv4 address of local end of the PPPoE link
+ # IPv4 address for remote end of PPPoE session
if conf.exists(['remote-address']):
pppoe['remote_address'] = conf.return_value(['remote-address'])
@@ -193,10 +197,6 @@ def get_config():
if conf.exists(['service-name']):
pppoe['service_name'] = conf.return_value(['service-name'])
- # Authentication name supplied to PPPoE server
- if conf.exists(['user-id']):
- pppoe['user_id'] = conf.return_value(['user-id'])
-
return pppoe
def verify(pppoe):
diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5
index 0683861f2..19e0352c8 100755
--- a/src/migration-scripts/interfaces/4-to-5
+++ b/src/migration-scripts/interfaces/4-to-5
@@ -19,6 +19,17 @@ def migrate_dialer(config, tree, intf):
# parts
config.copy(tree + [pppoe], pppoe_base)
+ # Migrate user-id and password nodes under an 'authentication'
+ # node
+ if config.exists(pppoe_base + ['user-id']):
+ user = config.return_value(pppoe_base + ['user-id'])
+ config.set(pppoe_base + ['authentication', 'user'], value=user)
+ config.delete(pppoe_base + ['user-id'])
+
+ if config.exists(pppoe_base + ['password']):
+ pwd = config.return_value(pppoe_base + ['password'])
+ config.set(pppoe_base + ['authentication', 'password'], value=pwd)
+ config.delete(pppoe_base + ['password'])
# remove enable-ipv6 node and rather place it under ipv6 node
if config.exists(pppoe_base + ['enable-ipv6']):