Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopi Miettinen <toiwoton@gmail.com>2020-03-27 14:00:09 +0300
committerTopi Miettinen <toiwoton@gmail.com>2020-03-27 14:05:56 +0300
commit5c5cc43c6f7effe83adc8eeb65e7202e5ce10a73 (patch)
tree8f14b40bb34c65d3c48a67b542473249506d94fb /include/tests_crypto
parent603d5b16a282b6c2f646bae450002e385bd91b3f (diff)
Check if system uses encrypted swap devices
Add test CRYP-7931 to check if the system uses any encrypted swap devices. Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
Diffstat (limited to 'include/tests_crypto')
-rw-r--r--include/tests_crypto25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/tests_crypto b/include/tests_crypto
index 466f6b52..47c03451 100644
--- a/include/tests_crypto
+++ b/include/tests_crypto
@@ -174,6 +174,31 @@
#
#################################################################################
#
+ # Test : CRYP-7931
+ # Description : Determine if system uses encrypted swap
+ if [ -e "${SWAPONBINARY}" -a -e "${CRYPTSETUPBINARY}" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
+ Register --test-no CRYP-7931 --preqs-met ${PREQS_MET} --os Linux --weight L --network NO --root-only YES --category security --description "Determine if system uses encrypted swap"
+ if [ ${SKIPTEST} -eq 0 ]; then
+ ENCRYPTED_SWAPS=0
+ UNENCRYPTED_SWAPS=0
+ SWAPS=$(${SWAPONBINARY} --show=NAME --noheadings)
+ for BLOCK_DEV in ${SWAPS}; do
+ if ${CRYPTSETUPBINARY} isLuks "${BLOCK_DEV}" 2> /dev/null; then
+ LogText "Result: Found LUKS encrypted swap device: ${BLOCK_DEV}"
+ ENCRYPTED_SWAPS=$((ENCRYPTED_SWAPS +1))
+ elif ${CRYPTSETUPBINARY} status "${BLOCK_DEV}" | ${GREPBINARY} --quiet "cipher:"; then
+ LogText "Result: Found non-LUKS encrypted swap device: ${BLOCK_DEV}"
+ ENCRYPTED_SWAPS=$((ENCRYPTED_SWAPS +1))
+ else
+ LogText "Result: Found unencrypted swap device: ${BLOCK_DEV}"
+ UNENCRYPTED_SWAPS=$((UNENCRYPTED_SWAPS +1))
+ fi
+ done
+ Display --indent 2 --text "- Found ${ENCRYPTED_SWAPS} encrypted and ${UNENCRYPTED_SWAPS} unencrypted swap devices in use." --result OK --color WHITE
+ fi
+#
+#################################################################################
+#
# Test : CRYP-8002
# Description : Gather available kernel entropy
Register --test-no CRYP-8002 --os Linux --weight L --network NO --root-only NO --category security --description "Gather available kernel entropy"