Skip to content

Commit 3aa47e6

Browse files
committed
Add push model subtest to keylime_agent_container-basic-attestation
1 parent c4f0f6d commit 3aa47e6

File tree

2 files changed

+31
-9
lines changed
  • container/functional/keylime_agent_container-basic-attestation

2 files changed

+31
-9
lines changed

container/functional/keylime_agent_container-basic-attestation/main.fmf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ recommend:
2323
- keylime
2424
duration: 10m
2525
enabled: true
26-
id: 3b782552-e418-4b35-86c3-d346cb8b0442
27-
extra-nitrate: TC#0615276
28-
2926
adjust:
3027
- when: swtpm != yes
3128
enabled: false
3229
because: We need to emulate multiple TPM devices with swtpm
30+
/push:
31+
environment:
32+
AGENT_SERVICE: PushAgent
33+
id: be2bbaa2-f97a-4ad9-bd03-2eb6a1dac0e5
34+
/pull:
35+
environment:
36+
AGENT_SERVICE: Agent
37+
id: 3b782552-e418-4b35-86c3-d346cb8b0442

container/functional/keylime_agent_container-basic-attestation/test.sh

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414

1515
[ -n "$REGISTRY" ] || REGISTRY=quay.io
1616

17+
TENANT_ARGS=""
18+
AGENT_CMD="keylime_agent"
19+
if [ "${AGENT_SERVICE}" == "PushAgent" ]; then
20+
TENANT_ARGS="--push-model"
21+
AGENT_CMD="keylime_push_model_agent"
22+
fi
23+
1724
rlJournalStart
1825

1926
rlPhaseStartSetup "Do the keylime setup"
@@ -35,6 +42,16 @@ rlJournalStart
3542
#verifier
3643
rlRun "limeUpdateConf verifier ip $SERVER_IP"
3744

45+
# configure push attestation
46+
if [ "${AGENT_SERVICE}" == "PushAgent" ]; then
47+
# Set the verifier to run in PUSH mode
48+
rlRun "limeUpdateConf verifier mode 'push'"
49+
rlRun "limeUpdateConf verifier challenge_lifetime 1800"
50+
rlRun "limeUpdateConf verifier quote_interval 10"
51+
rlRun "limeUpdateConf agent attestation_interval_seconds 10"
52+
rlRun "limeUpdateConf agent tls_accept_invalid_hostnames true"
53+
fi
54+
3855
# start tpm emulator
3956
rlRun "limeStartTPMEmulator"
4057
rlRun "limeWaitForTPMEmulator"
@@ -82,7 +99,7 @@ rlJournalStart
8299
rlRun "limeconPrepareAgentConfdir $AGENT_ID_FIRST $IP_AGENT_FIRST confdir_$CONT_AGENT_FIRST"
83100

84101
#run of first agent
85-
rlRun "limeconRunAgent $CONT_AGENT_FIRST $TAG_AGENT $IP_AGENT_FIRST $CONT_NETWORK_NAME $TESTDIR_FIRST keylime_agent $PWD/confdir_$CONT_AGENT_FIRST $PWD/cv_ca"
102+
rlRun "limeconRunAgent $CONT_AGENT_FIRST $TAG_AGENT $IP_AGENT_FIRST $CONT_NETWORK_NAME $TESTDIR_FIRST $AGENT_CMD $PWD/confdir_$CONT_AGENT_FIRST $PWD/cv_ca"
86103
rlRun "limeWaitForAgentRegistration ${AGENT_ID_FIRST}"
87104

88105
#setup of second agent
@@ -92,7 +109,7 @@ rlJournalStart
92109
rlRun "limeconPrepareAgentConfdir $AGENT_ID_SECOND $IP_AGENT_SECOND confdir_$CONT_AGENT_SECOND"
93110

94111
#run of second agent
95-
rlRun "limeTPMDevNo=1 limeconRunAgent $CONT_AGENT_SECOND $TAG_AGENT $IP_AGENT_SECOND $CONT_NETWORK_NAME $TESTDIR_SECOND keylime_agent $PWD/confdir_$CONT_AGENT_SECOND $PWD/cv_ca"
112+
rlRun "limeTPMDevNo=1 limeconRunAgent $CONT_AGENT_SECOND $TAG_AGENT $IP_AGENT_SECOND $CONT_NETWORK_NAME $TESTDIR_SECOND $AGENT_CMD $PWD/confdir_$CONT_AGENT_SECOND $PWD/cv_ca"
96113
rlRun "limeWaitForAgentRegistration ${AGENT_ID_SECOND}"
97114

98115
# create allowlist and excludelist for each agent
@@ -103,12 +120,12 @@ rlJournalStart
103120
rlPhaseEnd
104121

105122
rlPhaseStartTest "Add keylime agents"
106-
rlRun -s "keylime_tenant -v $SERVER_IP -t $IP_AGENT_FIRST -u $AGENT_ID_FIRST --runtime-policy policy1.json -f /etc/hosts -c add"
123+
rlRun -s "keylime_tenant -v $SERVER_IP -t $IP_AGENT_FIRST -u $AGENT_ID_FIRST --runtime-policy policy1.json -f /etc/hosts -c add ${TENANT_ARGS}"
107124
rlRun "limeWaitForAgentStatus $AGENT_ID_FIRST 'Get Quote'"
108125
rlRun -s "keylime_tenant -c cvlist"
109126
rlAssertGrep "{'code': 200, 'status': 'Success', 'results': {'uuids':.*'$AGENT_ID_FIRST'" $rlRun_LOG -E
110127
#check second agent
111-
rlRun -s "keylime_tenant -v $SERVER_IP -t $IP_AGENT_SECOND -u $AGENT_ID_SECOND --runtime-policy policy2.json -f /etc/hosts -c add"
128+
rlRun -s "keylime_tenant -v $SERVER_IP -t $IP_AGENT_SECOND -u $AGENT_ID_SECOND --runtime-policy policy2.json -f /etc/hosts -c add ${TENANT_ARGS}"
112129
rlRun "limeWaitForAgentStatus $AGENT_ID_SECOND 'Get Quote'"
113130
rlPhaseEnd
114131

@@ -124,7 +141,7 @@ rlJournalStart
124141
rlPhaseStartTest "Fail first keylime agent and check second"
125142
rlRun "echo -e '#!/bin/bash\necho boom' > $TESTDIR_FIRST/bad-script.sh && chmod a+x $TESTDIR_FIRST/bad-script.sh"
126143
rlRun "$TESTDIR_FIRST/bad-script.sh"
127-
rlRun "rlWaitForCmd 'tail \$(limeVerifierLogfile) | grep -q \"Agent $AGENT_ID_FIRST failed\"' -m 10 -d 1 -t 10"
144+
rlRun "rlWaitForCmd 'tail -30 \$(limeVerifierLogfile) | grep -q \"Agent $AGENT_ID_FIRST failed\"' -m 30 -d 2 -t 60"
128145
rlRun "limeWaitForAgentStatus $AGENT_ID_FIRST '(Failed|Invalid Quote)'"
129146
rlAssertGrep "WARNING - File not found in allowlist: $TESTDIR_FIRST/bad-script.sh" $(limeVerifierLogfile)
130147
rlAssertGrep "WARNING - Agent $AGENT_ID_FIRST failed, stopping polling" $(limeVerifierLogfile)
@@ -135,7 +152,7 @@ rlJournalStart
135152
rlPhaseStartTest "Fail second keylime agent"
136153
rlRun "echo -e '#!/bin/bash\necho boom' > $TESTDIR_SECOND/bad-script.sh && chmod a+x $TESTDIR_SECOND/bad-script.sh"
137154
rlRun "$TESTDIR_SECOND/bad-script.sh"
138-
rlRun "rlWaitForCmd 'tail \$(limeVerifierLogfile) | grep -q \"Agent $AGENT_ID_SECOND failed\"' -m 10 -d 1 -t 10"
155+
rlRun "rlWaitForCmd 'tail -30 \$(limeVerifierLogfile) | grep -q \"Agent $AGENT_ID_SECOND failed\"' -m 30 -d 2 -t 60"
139156
rlRun "limeWaitForAgentStatus $AGENT_ID_SECOND '(Failed|Invalid Quote)'"
140157
rlAssertGrep "WARNING - File not found in allowlist: $TESTDIR_SECOND/bad-script.sh" $(limeVerifierLogfile)
141158
rlAssertGrep "WARNING - Agent $AGENT_ID_SECOND failed, stopping polling" $(limeVerifierLogfile)

0 commit comments

Comments
 (0)