From b7b45384b4398d1b4fa6ef94664eed600c9d71aa Mon Sep 17 00:00:00 2001 From: hagbard Date: Thu, 22 Nov 2018 10:35:42 -0800 Subject: T835: accel-ppp: pppoe implementation - verify if an auth mode is set and if its local checking that a user and password for chap-secrets exists. --- src/conf_mode/accel_pppoe.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/conf_mode/accel_pppoe.py b/src/conf_mode/accel_pppoe.py index 7f721f932..f0a7fcf96 100755 --- a/src/conf_mode/accel_pppoe.py +++ b/src/conf_mode/accel_pppoe.py @@ -368,7 +368,9 @@ def get_config(): config_data['snmp'] = 'enable-ma' #### authentication mode local - + if not c.exists('authentication mode'): + raise ConfigError('pppoe-server authentication mode required') + if c.exists('authentication mode local'): if c.exists('authentication local-users username'): for usr in c.list_nodes('authentication local-users username'): @@ -478,13 +480,16 @@ def get_config(): def verify(c): if c == None: return None - - for usr in c['authentication']['local-users']: - if not c['authentication']['local-users'][usr]: - raise ConfigError('user ' + usr + ' has no password set') + if c['authentication']['mode'] == 'local': + if not c['authentication']['local-users']: + raise ConfigError('pppoe-server authentication local-users required') + + for usr in c['authentication']['local-users']: + if not c['authentication']['local-users'][usr]['passwd']: + raise ConfigError('user ' + usr + ' requires a password') if not c['ppp_gw']: - raise ConfigError('pppoe gateway-ip required') + raise ConfigError('pppoe-server local-ip required') if c['authentication']['mode'] == 'radius': if len(c['authentication']['radiussrv']) == 0: -- cgit v1.2.3