crypto: open files in read-only mode for importing (#2536)

closes #2535
This commit is contained in:
Angel Nunez Mencias 2022-03-21 10:46:09 +01:00 committed by GitHub
parent a3eb72d160
commit 8b95e9f97a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -61,7 +61,7 @@ def certificate_discovery(self: MonitoredTask):
else:
cert_name = path.name.replace(path.suffix, "")
try:
with open(path, "r+", encoding="utf-8") as _file:
with open(path, "r", encoding="utf-8") as _file:
body = _file.read()
if "PRIVATE KEY" in body:
private_keys[cert_name] = ensure_private_key_valid(body)