Commit 191df928 authored by Brian May's avatar Brian May

Ensure tempfiles are chmod 600

parent 6dfbc467
...@@ -41,7 +41,7 @@ def rewrite_etc_hosts(port): ...@@ -41,7 +41,7 @@ def rewrite_etc_hosts(port):
os.chmod(tmpname, st.st_mode) os.chmod(tmpname, st.st_mode)
else: else:
os.chown(tmpname, 0, 0) os.chown(tmpname, 0, 0)
os.chmod(tmpname, 0o644) os.chmod(tmpname, 0o600)
os.rename(tmpname, HOSTSFILE) os.rename(tmpname, HOSTSFILE)
......
...@@ -37,6 +37,7 @@ def write_host_cache(): ...@@ -37,6 +37,7 @@ def write_host_cache():
for name, ip in sorted(hostnames.items()): for name, ip in sorted(hostnames.items()):
f.write('%s,%s\n' % (name, ip)) f.write('%s,%s\n' % (name, ip))
f.close() f.close()
os.chmod(tmpname, 0o600)
os.rename(tmpname, CACHEFILE) os.rename(tmpname, CACHEFILE)
finally: finally:
try: try:
......
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