diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-06-13 19:42:09 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-06-13 20:25:09 +0200 |
commit | cc967f1e3287970908062affd23b94f66ccee4b8 (patch) | |
tree | 9b20e4076fd3e94d8e7ef57a84dab074c237b7d7 /python | |
parent | f8b37aa4792e88a332c0e37f196480ef0220718b (diff) | |
download | vyos-1x-cc967f1e3287970908062affd23b94f66ccee4b8.tar.gz vyos-1x-cc967f1e3287970908062affd23b94f66ccee4b8.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.
(cherry picked from commit 0361c3ac449f183476f7aee31439417d9f7f8012)
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/configverify.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index 88cbf2d5b..979e28b11 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -166,6 +166,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): """ |