diff --git a/functions.sh b/functions.sh index ade6d8af..2341f04b 100644 --- a/functions.sh +++ b/functions.sh @@ -125,6 +125,33 @@ copy_file_encrypted() { run_with_timeout ${COPY_FROM_IMAGE_TIMEOUT} "guestfish --keys-from-stdin --ro ${disks} -i copy-out ${file} ${dir}" } +copy_file_encrypted_raid() { + disks="$1" + file="$2" + dir="$3" + + # we only assume 1 RAID device + md_device=$(run_with_timeout ${COPY_FROM_IMAGE_TIMEOUT} "guestfish --ro ${disks} launch : list-md-devices" 2>&1) + md_devices_count=$(wc -l <<< ${md_device}) + echo "copy_file_encrypted_raid: md_device: ${md_device}" + if [ ${md_devices_count} -ne 1 ]; then + echo "Only 1 RAID device supported by encrypted_file_encrypted_raid()" > ${dir}/RESULT + echo -e "${md_devices_count} MD devices found:\n${md_device}" >> ${dir}/RESULT + exit 1 + fi + + # the here-string is unindented on purpose, as the passphrase can't contain leading spaces; + # it's not possible to use --key /dev/xyz:key:key_string, likely due to a bug? + run_with_timeout ${COPY_FROM_IMAGE_TIMEOUT} "guestfish --ro --keys-from-stdin ${disks}" <<< " +launch +# the line following after cryptsetup-open contains a LUKS passphrase +cryptsetup-open ${md_device} encrypted-root +passphrase +mount /dev/mapper/encrypted-root / +copy_out ${file} ${dir} +" +} + copy_interesting_files_from_system() { local disksdir="$1" diff --git a/lvm-luks-1.sh b/lvm-luks-1.sh index 91d05ad3..a86ca721 100755 --- a/lvm-luks-1.sh +++ b/lvm-luks-1.sh @@ -20,7 +20,7 @@ # Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="manual storage lvm luks" +TESTTYPE="storage lvm luks" . ${KSTESTDIR}/functions.sh diff --git a/lvm-luks-2.sh b/lvm-luks-2.sh index 91d05ad3..a86ca721 100755 --- a/lvm-luks-2.sh +++ b/lvm-luks-2.sh @@ -20,7 +20,7 @@ # Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="manual storage lvm luks" +TESTTYPE="storage lvm luks" . ${KSTESTDIR}/functions.sh diff --git a/lvm-luks-3.sh b/lvm-luks-3.sh index 73dcd2c1..6c216544 100755 --- a/lvm-luks-3.sh +++ b/lvm-luks-3.sh @@ -20,7 +20,7 @@ # Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="manual storage lvm luks" +TESTTYPE="storage lvm luks" . ${KSTESTDIR}/functions.sh diff --git a/lvm-luks-4.sh b/lvm-luks-4.sh index 91d05ad3..a86ca721 100755 --- a/lvm-luks-4.sh +++ b/lvm-luks-4.sh @@ -20,7 +20,7 @@ # Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="manual storage lvm luks" +TESTTYPE="storage lvm luks" . ${KSTESTDIR}/functions.sh diff --git a/part-luks-1.sh b/part-luks-1.sh index b8263542..9eaebbe9 100755 --- a/part-luks-1.sh +++ b/part-luks-1.sh @@ -17,11 +17,9 @@ # # Red Hat Author(s): Vendula Poncova -# On RHEL the test is manual because of broken reading of the results from image. -# Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="skip-on-rhel storage partition luks" +TESTTYPE="storage partition luks" . ${KSTESTDIR}/functions.sh diff --git a/part-luks-2.sh b/part-luks-2.sh index b8263542..9eaebbe9 100755 --- a/part-luks-2.sh +++ b/part-luks-2.sh @@ -17,11 +17,9 @@ # # Red Hat Author(s): Vendula Poncova -# On RHEL the test is manual because of broken reading of the results from image. -# Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="skip-on-rhel storage partition luks" +TESTTYPE="storage partition luks" . ${KSTESTDIR}/functions.sh diff --git a/part-luks-3.sh b/part-luks-3.sh index b8263542..9eaebbe9 100755 --- a/part-luks-3.sh +++ b/part-luks-3.sh @@ -17,11 +17,9 @@ # # Red Hat Author(s): Vendula Poncova -# On RHEL the test is manual because of broken reading of the results from image. -# Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="skip-on-rhel storage partition luks" +TESTTYPE="storage partition luks" . ${KSTESTDIR}/functions.sh diff --git a/part-luks-4.sh b/part-luks-4.sh index b8263542..9eaebbe9 100755 --- a/part-luks-4.sh +++ b/part-luks-4.sh @@ -17,11 +17,9 @@ # # Red Hat Author(s): Vendula Poncova -# On RHEL the test is manual because of broken reading of the results from image. -# Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="skip-on-rhel storage partition luks" +TESTTYPE="storage partition luks" . ${KSTESTDIR}/functions.sh diff --git a/raid-luks-1.sh b/raid-luks-1.sh index 85a161a7..9d1e6cd4 100755 --- a/raid-luks-1.sh +++ b/raid-luks-1.sh @@ -20,7 +20,7 @@ # Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="manual storage raid luks" +TESTTYPE="storage raid luks" . ${KSTESTDIR}/functions.sh @@ -33,5 +33,5 @@ prepare_disks() { } copy_file() { - copy_file_encrypted "$@" + copy_file_encrypted_raid "$@" } diff --git a/raid-luks-2.sh b/raid-luks-2.sh index 85a161a7..9d1e6cd4 100755 --- a/raid-luks-2.sh +++ b/raid-luks-2.sh @@ -20,7 +20,7 @@ # Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="manual storage raid luks" +TESTTYPE="storage raid luks" . ${KSTESTDIR}/functions.sh @@ -33,5 +33,5 @@ prepare_disks() { } copy_file() { - copy_file_encrypted "$@" + copy_file_encrypted_raid "$@" } diff --git a/raid-luks-3.sh b/raid-luks-3.sh index 85a161a7..9d1e6cd4 100755 --- a/raid-luks-3.sh +++ b/raid-luks-3.sh @@ -20,7 +20,7 @@ # Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="manual storage raid luks" +TESTTYPE="storage raid luks" . ${KSTESTDIR}/functions.sh @@ -33,5 +33,5 @@ prepare_disks() { } copy_file() { - copy_file_encrypted "$@" + copy_file_encrypted_raid "$@" } diff --git a/raid-luks-4.sh b/raid-luks-4.sh index 85a161a7..9d1e6cd4 100755 --- a/raid-luks-4.sh +++ b/raid-luks-4.sh @@ -20,7 +20,7 @@ # Check the results on the running VM. # Ignore unused variable parsed out by tooling scripts as test tags metadata # shellcheck disable=SC2034 -TESTTYPE="manual storage raid luks" +TESTTYPE="storage raid luks" . ${KSTESTDIR}/functions.sh @@ -33,5 +33,5 @@ prepare_disks() { } copy_file() { - copy_file_encrypted "$@" + copy_file_encrypted_raid "$@" }