Skip to content

Commit

Permalink
Fix & enable LUKS tests
Browse files Browse the repository at this point in the history
This fixes the issue with copying out the RESULT file
from encrypted partitionings properly and reenables
the LUKS tests.
  • Loading branch information
jikortus committed Oct 11, 2023
1 parent 5e684e6 commit 880ebb8
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 24 deletions.
26 changes: 26 additions & 0 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,32 @@ 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})
if [ ${md_devices_count} -ne 1 ]; then
echo "Only 1 RAID device supported by encrypted_file_encrypted_raid()" > ${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}
" >> /tmp/copy_encrypted_files_raid.debug
echo "disks: '$disks'" >> /tmp/copy_encrypted_files_raid.debug
}

copy_interesting_files_from_system() {
local disksdir="$1"

Expand Down
2 changes: 1 addition & 1 deletion lvm-luks-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lvm-luks-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lvm-luks-3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lvm-luks-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions part-luks-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>

# 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

Expand Down
4 changes: 1 addition & 3 deletions part-luks-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>

# 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

Expand Down
4 changes: 1 addition & 3 deletions part-luks-3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>

# 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

Expand Down
4 changes: 1 addition & 3 deletions part-luks-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#
# Red Hat Author(s): Vendula Poncova <[email protected]>

# 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

Expand Down
4 changes: 2 additions & 2 deletions raid-luks-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -33,5 +33,5 @@ prepare_disks() {
}

copy_file() {
copy_file_encrypted "$@"
copy_file_encrypted_raid "$@"
}
4 changes: 2 additions & 2 deletions raid-luks-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -33,5 +33,5 @@ prepare_disks() {
}

copy_file() {
copy_file_encrypted "$@"
copy_file_encrypted_raid "$@"
}
4 changes: 2 additions & 2 deletions raid-luks-3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -33,5 +33,5 @@ prepare_disks() {
}

copy_file() {
copy_file_encrypted "$@"
copy_file_encrypted_raid "$@"
}
4 changes: 2 additions & 2 deletions raid-luks-4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -33,5 +33,5 @@ prepare_disks() {
}

copy_file() {
copy_file_encrypted "$@"
copy_file_encrypted_raid "$@"
}

0 comments on commit 880ebb8

Please sign in to comment.