Module: check_mk
Branch: master
Commit: 8762bd8edb997477192d88641bfa386b2e68c4cf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8762bd8edb9974…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 11 16:11:46 2019 +0100
Prevent adding site CAs multitple times to trusted_certificate_authorities
Change-Id: Id8b3547e7fc0b57b1241b181c28391e628f97443
---
cmk/gui/wato/pages/sites.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/cmk/gui/wato/pages/sites.py b/cmk/gui/wato/pages/sites.py
index 04f0b0b..392418a 100644
--- a/cmk/gui/wato/pages/sites.py
+++ b/cmk/gui/wato/pages/sites.py
@@ -1084,7 +1084,15 @@ class ModeSiteLivestatusEncryption(WatoMode):
trusted = global_settings.get(
"trusted_certificate_authorities",
watolib.ConfigDomain.get_all_default_globals()["trusted_certificate_authorities"])
- trusted.setdefault("trusted_cas", []).append(cert_pem)
+ trusted_cas = trusted.setdefault("trusted_cas", [])
+
+ if cert_pem in trusted_cas:
+ raise MKUserError(
+ None,
+ _("The CA is already a <a href=\"%s\">trusted
CA</a>.") %
+
"wato.py?mode=edit_configvar&varname=trusted_certificate_authorities")
+
+ trusted_cas.append(cert_pem)
global_settings["trusted_certificate_authorities"] = trusted
watolib.add_change(