diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-08-15 20:54:08 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-08-15 20:54:46 +0200 |
commit | 28936477c4f4c4633c9a384054c0a65090ece101 (patch) | |
tree | 15732cdeaf25fa955c4a33c71175462f22c704b7 /src | |
parent | 66af9a9daa245b9478d7103861935ee5b8c2526a (diff) | |
download | vyos-1x-28936477c4f4c4633c9a384054c0a65090ece101.tar.gz vyos-1x-28936477c4f4c4633c9a384054c0a65090ece101.zip |
openconnect: T4616: bugfix KeyError: 'local_users'
To reproduce:
set vpn openconnect authentication mode local
commit
Traceback (most recent call last):
File "/usr/libexec/vyos/conf_mode/vpn_openconnect.py", line 147, in <module>
verify(c)
File "/usr/libexec/vyos/conf_mode/vpn_openconnect.py", line 64, in verify
if not ocserv["authentication"]["local_users"] or not ocserv["authentication"]["local_users"]["username"]:
KeyError: 'local_users'
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/vpn_openconnect.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/conf_mode/vpn_openconnect.py b/src/conf_mode/vpn_openconnect.py index 00b96884b..f24d5b618 100755 --- a/src/conf_mode/vpn_openconnect.py +++ b/src/conf_mode/vpn_openconnect.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2018-2020 VyOS maintainers and contributors +# Copyright (C) 2018-2022 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -61,8 +61,8 @@ def verify(ocserv): if "authentication" in ocserv: if "mode" in ocserv["authentication"]: if "local" in ocserv["authentication"]["mode"]: - if not ocserv["authentication"]["local_users"] or not ocserv["authentication"]["local_users"]["username"]: - raise ConfigError('openconnect mode local required at leat one user') + if 'local_users' not in ocserv["authentication"] or 'username' not in ocserv["authentication"]["local_users"]: + raise ConfigError('openconnect mode local requires at leat one user') else: for user in ocserv["authentication"]["local_users"]["username"]: if not "password" in ocserv["authentication"]["local_users"]["username"][user]: |