updated code security in pki state

This commit is contained in:
Paul 2021-09-25 17:17:29 +02:00
parent d0d57526c8
commit 5966e77b98

View File

@ -31,6 +31,7 @@ def fetched(name=None,
domains=domain_concat)
if currentcert != newcert or currentkey != newkey:
if len(newcert) > 10 or len(newkey) > 10:
wcert = __salt__['pki.write_file_content'](newcert, fullcertfile)
wkey = __salt__['pki.write_file_content'](newkey, keyfile)
@ -40,6 +41,9 @@ def fetched(name=None,
ret["changes"]["new"])
ret["comment"] = "Updated certificates and keys"
ret["result"] = all([wcert, wkey])
else:
ret["comment"] = "Error fetching in certificate / key length"
return ret
else:
ret["comment"] = "Config is good and not changed"
ret["result"] = True