summaryrefslogtreecommitdiffstats
path: root/build-stuff/build-host.py
diff options
context:
space:
mode:
Diffstat (limited to 'build-stuff/build-host.py')
-rw-r--r--build-stuff/build-host.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/build-stuff/build-host.py b/build-stuff/build-host.py
index 6e7b435..40fbc20 100644
--- a/build-stuff/build-host.py
+++ b/build-stuff/build-host.py
@@ -123,11 +123,17 @@ location via cli options (--help)")
log.error(__doc__)
sys.exit(1)
-def create_passwords(sec):
+def create_passwords(sec,usernames):
import crypt
- with open(path_join(sec,"hashedPasswords.nix")):
- #python3 -c 'import crypt; print(crypt.crypt("test",
- #crypt.mksalt(crypt.METHOD_SHA512)))'
+ from getpass import getpass
+ with open(path_join(sec,"hashedPasswords.nix"),"w+") as f:
+ f.write("{\n")
+ for usr in usernames:
+ # TODO: do not block, set password via another channel
+ pw = getpass("Password for {}:".format(usr))
+ crypted = crypt.crypt(pw, crypt.mksalt(crypt.METHOD_SHA512))
+ f.write(' {} = "{}";\n'.format(usr,crypted))
+ f.write("}\n")
def main():
@@ -155,7 +161,8 @@ def main():
write_stockholm_1systems(ret,stockholm_dir)
print_stockholm_krebs_entry(ret)
- pass
+ if args["--create-passwords"]:
+ create_passwords(host_secrets,["root",username])
if __name__ == '__main__':
main()