From c5029006068f5bae0ed716e430317d80da74ee56 Mon Sep 17 00:00:00 2001 From: jgaunt Date: Wed, 27 Nov 2019 12:03:19 -0500 Subject: [PATCH] Update 'freenas_network_unlock.py' --- freenas_network_unlock.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/freenas_network_unlock.py b/freenas_network_unlock.py index 1aa4503..d5e96a5 100644 --- a/freenas_network_unlock.py +++ b/freenas_network_unlock.py @@ -68,5 +68,12 @@ rc = call("mdmfs -s 1m md /mnt/ramfs", shell=True) # Send our unlock/mount script to the pi and execute it on the pi using ssh rc = call("ssh {}@{} 'mkdir /mnt/FreeNASRecoveryKeys; echo -n {} | cryptsetup luksOpen {} FreeNASRecoveryKeys -d - && mount /dev/mapper/FreeNASRecoveryKeys /mnt/FreeNASRecoveryKeys'".format(config.KEY_HOST_USER, config.KEY_HOST, config.LUKS_PASSWORD, config.LUKS_VOLUME), shell=True) +# Now we can copy the keys to the ramfs +for keyName in config.POOL_NAMES: + rc= call("scp {}@{}:/mnt/FreeNASRecoveryKeys/{}.recoveryKey /mnt/ramfs".format(config.KEY_HOST_USER, config.KEY_HOST, keyName), shell=True) + +# We can close the luks volume now +rc = call("ssh {}@{} 'umount /mnt/FreeNASRecoveryKeys; cryptsetup luksClose FreeNASRecoveryKeys'".format(config.KEY_HOST_USER, config.KEY_HOST), shell=True) +