diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-05 17:34:38 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-05 17:34:40 +0100 |
commit | 6af0e8af2ab4b9151df5dbce8b4899e6f1093852 (patch) | |
tree | 39b3beae124f31e65fe672092b10af9f40906b45 /src/conf_mode/system-login.py | |
parent | e8fc4cb5240fb637d25ea03e08df6c0267d052cf (diff) | |
download | vyos-1x-6af0e8af2ab4b9151df5dbce8b4899e6f1093852.tar.gz vyos-1x-6af0e8af2ab4b9151df5dbce8b4899e6f1093852.zip |
login: T2050: extend verify() on public-keys
* A type must be present for any one public-key element
* A key must be present for any one public-key element
Diffstat (limited to 'src/conf_mode/system-login.py')
-rwxr-xr-x | src/conf_mode/system-login.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py index a7fb8ee8f..959e86e5b 100755 --- a/src/conf_mode/system-login.py +++ b/src/conf_mode/system-login.py @@ -196,6 +196,14 @@ def verify(login): if cur_user in login['del_users']: raise ConfigError('Attempting to delete current user: {}'.format(cur_user)) + for user in login['add_users']: + for key in user['public_keys']: + if not key['type']: + raise ConfigError('SSH public key type missing for "{}"!'.format(key['name'])) + + if not key['key']: + raise ConfigError('SSH public key for id "{}" missing!'.format(key['name'])) + # At lease one RADIUS server must not be disabled if len(login['radius_server']) > 0: fail = True |