This commit is contained in:
brent s 2017-05-04 13:48:53 -04:00
parent b597fb7bd1
commit 0e3b4572f9

View File

@ -12,9 +12,9 @@ os.makedirs(keydir, exist_ok = True)
os.chown(keydir, 0, 0) os.chown(keydir, 0, 0)
os.chmod(keydir, 0o700) os.chmod(keydir, 0o700)


with open('{0}/authorized_keys', 'w') as f: with open('{0}/authorized_keys'.format(keydir), 'w') as f:
with urlopen(keyfile) as url: with urlopen(keyfile) as url:
f.write(url.read().decode('utf-8')) f.write(url.read().decode('utf-8'))


os.chown('{0}/authorized_keys', 0, 0) os.chown('{0}/authorized_keys'.format(keydir), 0, 0)
os.chmod('{0}/authorized_keys', 0o600) os.chmod('{0}/authorized_keys'.format(keydir), 0o600)