mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-27 22:32:31 +02:00
ima-evm-utils: skip test for discrete TPM 1.2 and exec'd as normal user
boot_aggregate test make use of a software TPM 2.0 in case it doesn't find any /dev/tpm0 in the system or if the test is ran as a normal user. However, when the system has a discrete TPM 1.2 and the user runs the test with a non-root user evmctl fails to return the software TPM 2.0 boot aggregate value because it tries to access TPM 1.2 the sysfs PCRs file and, consequently, the test fails. Thus TPM 2.0 log test is not supported on systems with a discrete TPM 1.2 Signed-off-by: Bruno Meneguele <bmeneg@redhat.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
parent
c396c5a4bf
commit
c9e99f0a21
@ -23,6 +23,8 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
. ./functions.sh
|
||||
_require evmctl
|
||||
TSSDIR="$(dirname -- "$(which tssstartup)")"
|
||||
PCRFILE="/sys/class/tpm/tpm0/device/pcrs"
|
||||
MISC_PCRFILE="/sys/class/misc/tpm0/device/pcrs"
|
||||
|
||||
if [ "$(id -u)" = 0 ] && [ -c "/dev/tpm0" ]; then
|
||||
ASCII_RUNTIME_MEASUREMENTS="/sys/kernel/security/ima/ascii_runtime_measurements"
|
||||
@ -133,6 +135,11 @@ check() {
|
||||
|
||||
# Start and initialize a software TPM as needed
|
||||
if [ "$(id -u)" != 0 ] || [ ! -c "/dev/tpm0" ]; then
|
||||
if [ -f "$PCRFILE" ] || [ -f "$MISC_PCRFILE" ]; then
|
||||
echo "${CYAN}SKIP: system has discrete TPM 1.2, sample TPM 2.0 event log test not supported.${NORM}"
|
||||
exit "$SKIP"
|
||||
fi
|
||||
|
||||
swtpm_start
|
||||
error=$?
|
||||
if [ $error -eq "$SKIP" ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user