Commit d3ff0e56 authored by Julien Muchembled's avatar Julien Muchembled

If possible, preserve ownership when renewing certificates

parent 6cade8ad
......@@ -134,6 +134,11 @@ def maybe_renew(path, cert, info, renew):
new_path = path + '.new'
with open(new_path, 'w') as f:
f.write(pem)
try:
s = os.stat(path)
os.chown(new_path, s.st_uid, s.st_gid)
except OSError:
pass
os.rename(new_path, path)
logging.info("%s renewed until %s UTC",
info, time.asctime(time.gmtime(utils.notAfter(cert))))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment