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) +