* [ima-evm-utils][PATCH 0/3] travis: misc software TPM changes
@ 2020-10-16 20:17 Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 1/3] travis: retry sending tssstartup Mimi Zohar
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mimi Zohar @ 2020-10-16 20:17 UTC (permalink / raw)
To: linux-integrity; +Cc: Ken Goldman, Mimi Zohar, Bruno Meneguele, Petr Vorel
Here are a few more software TPM related changes.
Mimi
Mimi Zohar (3):
travis: retry sending tssstartup
travis: rename the software tpm variables
travis: properly kill the software TPM
tests/boot_aggregate.test | 56 +++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 23 deletions(-)
--
2.18.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ima-evm-utils][PATCH 1/3] travis: retry sending tssstartup
2020-10-16 20:17 [ima-evm-utils][PATCH 0/3] travis: misc software TPM changes Mimi Zohar
@ 2020-10-16 20:17 ` Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 2/3] travis: rename the software tpm variables Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 3/3] travis: properly kill the software TPM Mimi Zohar
2 siblings, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2020-10-16 20:17 UTC (permalink / raw)
To: linux-integrity; +Cc: Ken Goldman, Mimi Zohar, Bruno Meneguele, Petr Vorel
The software TPM might not be listening for commands yet. Try re-sending
the tssstartup.
Reported-by: Ken Goldman <kgoldman@us.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
tests/boot_aggregate.test | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/tests/boot_aggregate.test b/tests/boot_aggregate.test
index d58c54fa1110..edebf1d29f23 100755
--- a/tests/boot_aggregate.test
+++ b/tests/boot_aggregate.test
@@ -97,8 +97,20 @@ swtpm_init() {
return "$SKIP"
fi
- echo "INFO: Walking ${BINARY_BIOS_MEASUREMENTS} initializing the software TPM"
+ echo "INFO: Sending software TPM startup"
"${TSSDIR}/tssstartup"
+ if [ $? -ne 0 ]; then
+ echo "INFO: Retry sending software TPM startup"
+ sleep 1
+ "${TSSDIR}/tssstartup"
+ fi
+
+ if [ $? -ne 0 ]; then
+ echo "INFO: Software TPM startup failed"
+ return "$SKIP"
+ fi
+
+ echo "INFO: Walking ${BINARY_BIOS_MEASUREMENTS} initializing the software TPM"
# $(${TSSDIR}/tsseventextend -tpm -if "${BINARY_BIOS_MEASUREMENTS}" -v) 2>&1 > /dev/null
"${TSSDIR}/tsseventextend" -tpm -if "${BINARY_BIOS_MEASUREMENTS}" -v > /dev/null 2>&1
}
--
2.18.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [ima-evm-utils][PATCH 2/3] travis: rename the software tpm variables
2020-10-16 20:17 [ima-evm-utils][PATCH 0/3] travis: misc software TPM changes Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 1/3] travis: retry sending tssstartup Mimi Zohar
@ 2020-10-16 20:17 ` Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 3/3] travis: properly kill the software TPM Mimi Zohar
2 siblings, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2020-10-16 20:17 UTC (permalink / raw)
To: linux-integrity; +Cc: Ken Goldman, Mimi Zohar, Bruno Meneguele, Petr Vorel
The existing variable names swtpm and swtpm1 is confusing. Rename
"swtpm" to "tpm_server" and "swtpm1" as "swtpm".
Reported-by: Ken Goldman <kgoldman@us.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
tests/boot_aggregate.test | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/tests/boot_aggregate.test b/tests/boot_aggregate.test
index edebf1d29f23..ab061d5e5845 100755
--- a/tests/boot_aggregate.test
+++ b/tests/boot_aggregate.test
@@ -54,36 +54,36 @@ cleanup() {
# Try to start a software TPM if needed.
swtpm_start() {
- local swtpm swtpm1
+ local tpm_server swtpm
- swtpm="$(which tpm_server)"
- swtpm1="$(which swtpm)"
- if [ -z "${swtpm}" ] && [ -z "${swtpm1}" ]; then
+ tpm_server="$(which tpm_server)"
+ swtpm="$(which swtpm)"
+ if [ -z "${tpm_server}" ] && [ -z "${swtpm}" ]; then
echo "${CYAN}SKIP: Software TPM (tpm_server and swtpm) not found${NORM}"
return "$SKIP"
fi
- if [ -n "${swtpm1}" ]; then
- pgrep swtpm1
+ if [ -n "${swtpm}" ]; then
+ pgrep swtpm
if [ $? -eq 0 ]; then
echo "INFO: Software TPM (swtpm) already running"
return 114
else
- echo "INFO: Starting software TPM: ${swtpm1}"
- mkdir ./myvtpm
- ${swtpm1} socket --tpmstate dir=./myvtpm --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init > /dev/null 2>&1 &
+ echo -n "INFO: Starting software TPM: ${swtpm}"
+ mkdir -p ./myvtpm
+ ${swtpm} socket --tpmstate dir=./myvtpm --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init > /dev/null 2>&1 &
SWTPM_PPID=$!
fi
- elif [ -n "${swtpm}" ]; then
+ elif [ -n "${tpm_server}" ]; then
# tpm_server uses the Microsoft simulator encapsulated packet format
export TPM_SERVER_TYPE="mssim"
- pgrep swtpm
+ pgrep tpm_server
if [ $? -eq 0 ]; then
echo "INFO: Software TPM (tpm_server) already running"
return 114
else
- echo "INFO: Starting software TPM: ${swtpm}"
- ${swtpm} > /dev/null 2>&1 &
+ echo "INFO: Starting software TPM: ${tpm_server}"
+ ${tpm_server} > /dev/null 2>&1 &
SWTPM_PPID=$!
fi
fi
--
2.18.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [ima-evm-utils][PATCH 3/3] travis: properly kill the software TPM
2020-10-16 20:17 [ima-evm-utils][PATCH 0/3] travis: misc software TPM changes Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 1/3] travis: retry sending tssstartup Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 2/3] travis: rename the software tpm variables Mimi Zohar
@ 2020-10-16 20:17 ` Mimi Zohar
2 siblings, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2020-10-16 20:17 UTC (permalink / raw)
To: linux-integrity; +Cc: Ken Goldman, Mimi Zohar, Bruno Meneguele, Petr Vorel
Send "tsstpmcmd -stop" to properly stop the tpm_server. Send SIGTERM
to stop the swtpm process.
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
tests/boot_aggregate.test | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/tests/boot_aggregate.test b/tests/boot_aggregate.test
index ab061d5e5845..42ed7b4cfb3a 100755
--- a/tests/boot_aggregate.test
+++ b/tests/boot_aggregate.test
@@ -41,14 +41,12 @@ else
fi
-# Only stop this test's software TPM. Preferred method: "tsstpmcmd -stop"
+# Only stop this test's software TPM
cleanup() {
- if [ -n "${SWTPM_PPID}" ]; then
- if [ -f "${TSSDIR}/tsstpmcmd" ]; then
- "${TSSDIR}/tsstpmcmd" -stop
- else
- pkill -P "${SWTPM_PPID}"
- fi
+ if [ -n "${SWTPM_PID}" ]; then
+ kill -SIGTERM "${SWTPM_PID}"
+ elif [ -n "${TPMSERVER_PID}" ]; then
+ "${TSSDIR}/tsstpmcmd" -stop
fi
}
@@ -72,7 +70,7 @@ swtpm_start() {
echo -n "INFO: Starting software TPM: ${swtpm}"
mkdir -p ./myvtpm
${swtpm} socket --tpmstate dir=./myvtpm --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init > /dev/null 2>&1 &
- SWTPM_PPID=$!
+ SWTPM_PID=$!
fi
elif [ -n "${tpm_server}" ]; then
# tpm_server uses the Microsoft simulator encapsulated packet format
@@ -84,7 +82,7 @@ swtpm_start() {
else
echo "INFO: Starting software TPM: ${tpm_server}"
${tpm_server} > /dev/null 2>&1 &
- SWTPM_PPID=$!
+ TPMSERVER_PID=$!
fi
fi
return 0
--
2.18.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-16 20:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-16 20:17 [ima-evm-utils][PATCH 0/3] travis: misc software TPM changes Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 1/3] travis: retry sending tssstartup Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 2/3] travis: rename the software tpm variables Mimi Zohar
2020-10-16 20:17 ` [ima-evm-utils][PATCH 3/3] travis: properly kill the software TPM Mimi Zohar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).