summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-06-13 19:42:09 +0200
committerChristian Poessinger <christian@poessinger.com>2021-06-13 19:42:09 +0200
commit0361c3ac449f183476f7aee31439417d9f7f8012 (patch)
treefa8f8249359589900da752611ffc1deeb3c18956 /python
parentb42b42e6c6cca00c9d8e6808822504ac72d588e7 (diff)
downloadvyos-1x-0361c3ac449f183476f7aee31439417d9f7f8012.tar.gz
vyos-1x-0361c3ac449f183476f7aee31439417d9f7f8012.zip
pppoe: T3621: validate that both username and password are set
A validator is missing checking that if authentication is used on a PPPoE interface, both username and password are set.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configverify.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 0ff45da2a..ee0fd94f7 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -122,6 +122,19 @@ def verify_mirror(config):
raise ConfigError(f'Can not mirror "{direction}" traffic back ' \
'the originating interface!')
+def verify_authentication(config):
+ """
+ Common helper function used by interface implementations to perform
+ recurring validation of authentication for either PPPoE or WWAN interfaces.
+
+ If authentication CLI option is defined, both username and password must
+ be set!
+ """
+ if 'authentication' not in config:
+ return
+ if not {'user', 'password'} <= set(config['authentication']):
+ raise ConfigError('Authentication requires both username and ' \
+ 'password to be set!')
def verify_address(config):
"""