mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-04-30 22:24:55 +02:00
Ensure tempfiles are chmod 600
This commit is contained in:
parent
6dfbc467c0
commit
191df92824
@ -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():
|
|||||||
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user