Only add LUKS keyfile if relevant, and with a 15s timeout.

This commit is contained in:
Teo Mrnjavac 2016-10-28 10:17:39 +02:00 committed by Philip
parent 9a643431dd
commit 5e81ddecad

View File

@ -43,7 +43,8 @@ def run():
if partition["mountPoint"] == "/" and "luksMapperName" in partition: if partition["mountPoint"] == "/" and "luksMapperName" in partition:
luks_root_device = partition["device"] luks_root_device = partition["device"]
luks_root_passphrase = partition["luksPassphrase"] luks_root_passphrase = partition["luksPassphrase"]
elif "luksMapperName" in partition: elif "luksMapperName" in partition and\
(partition["mountPoint"] or partition["fs"] == "linuxswap"):
additional_luks_devices.append((partition["device"], additional_luks_devices.append((partition["device"],
partition["luksPassphrase"])) partition["luksPassphrase"]))
@ -65,14 +66,16 @@ def run():
"luksAddKey", "luksAddKey",
luks_root_device, luks_root_device,
"/crypto_keyfile.bin"], "/crypto_keyfile.bin"],
luks_root_passphrase) luks_root_passphrase,
15) # timeout 15s
for additional_device in additional_luks_devices: for additional_device in additional_luks_devices:
check_target_env_call(["cryptsetup", check_target_env_call(["cryptsetup",
"luksAddKey", "luksAddKey",
additional_device[0], additional_device[0],
"/crypto_keyfile.bin"], "/crypto_keyfile.bin"],
additional_device[1]) additional_device[1],
15) # timeout 15s
check_target_env_call(["chmod", check_target_env_call(["chmod",
"g-rwx,o-rwx", "g-rwx,o-rwx",