summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2023-12-04 15:48:31 +0000
committerDaniil Baturin <daniil@baturin.org>2023-12-04 15:48:31 +0000
commitcc2872fc3eca6b5612b925b962f227b3b27ec71f (patch)
treec47f33aaac9c2ea8eee03c590b0b41b2abc466d8
parentf67173b41e4bf55e740313c588cb94d278b0b109 (diff)
downloadvyos-1x-cc2872fc3eca6b5612b925b962f227b3b27ec71f.tar.gz
vyos-1x-cc2872fc3eca6b5612b925b962f227b3b27ec71f.zip
https: T5772: require that at least one API key is present
-rwxr-xr-xsrc/conf_mode/http-api.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py
index 9c062f0aa..c0c16cfc0 100755
--- a/src/conf_mode/http-api.py
+++ b/src/conf_mode/http-api.py
@@ -59,10 +59,18 @@ def get_config():
key = conf.return_value('keys id {0} key'.format(name))
new_key = { 'id': name, 'key': key }
http_api['api_keys'].append(new_key)
+ else:
+ raise ConfigError('Missing HTTPS API key string for key id "}"'.format(name))
return http_api
def verify(http_api):
+ # Verify API server settings, if present
+ keys = http_api['api_keys']
+
+ if not keys:
+ raise ConfigError('At least one HTTPS API key is required')
+
return None
def generate(http_api):