From 8e18d1486e1153eb62c03a0564c3457cd5988c3b Mon Sep 17 00:00:00 2001 From: Patrik Koncity Date: Mon, 24 Jul 2023 11:57:36 +0200 Subject: [PATCH] Add ssh keygen directly to the test https://github.com/RedHat-SP-Security/keylime-tests/pull/403 --- functional/basic-attestation-on-containers/test.sh | 6 ++++++ .../basic-attestation-with-custom-certificates/test.sh | 6 ++++++ functional/basic-attestation-with-postgresql-db/test.sh | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/functional/basic-attestation-on-containers/test.sh b/functional/basic-attestation-on-containers/test.sh index cb63643..d8a3f97 100755 --- a/functional/basic-attestation-on-containers/test.sh +++ b/functional/basic-attestation-on-containers/test.sh @@ -23,6 +23,11 @@ rlJournalStart #create network for containers rlRun "limeconCreateNetwork ${CONT_NETWORK_NAME} 172.18.0.0/16" + #preparation for ssh access + rlRun "rlFileBackup --clean ~/.ssh/" + rlRun 'ls /root/.ssh/id_*.pub &>/dev/null || ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa' + rlRun "cp /root/.ssh/id_*.pub ." + #build verifier container TAG_ATTESTATION_SERVER="keylime_server_image" rlRun "limeconPrepareImage ${limeLibraryDir}/${DOCKERFILE_SYSTEMD} ${TAG_ATTESTATION_SERVER}" @@ -90,6 +95,7 @@ EOF" limeSubmitCommonLogs limeClearData limeRestoreConfig + rlRun "rlFileRestore" rlPhaseEnd rlJournalEnd diff --git a/functional/basic-attestation-with-custom-certificates/test.sh b/functional/basic-attestation-with-custom-certificates/test.sh index 56f4313..1ea240b 100755 --- a/functional/basic-attestation-with-custom-certificates/test.sh +++ b/functional/basic-attestation-with-custom-certificates/test.sh @@ -61,6 +61,11 @@ rlJournalStart # assign cert ownership to keylime user if it exists id keylime && rlRun "chown -R keylime:keylime $CERTDIR" + rlRun "rlFileBackup --clean ~/.ssh/" + #preparation for ssh access + rlRun 'ls /root/.ssh/id_*.pub &>/dev/null || ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa' + rlRun "cp /root/.ssh/id_*.pub ." + #build verifier container TAG_ATTESTATION_SERVER="keylime_server_image" rlRun "limeconPrepareImage ${limeLibraryDir}/${DOCKERFILE_SYSTEMD} ${TAG_ATTESTATION_SERVER}" @@ -146,6 +151,7 @@ EOF" limeSubmitCommonLogs limeClearData limeRestoreConfig + rlRun "rlFileRestore" rlPhaseEnd rlJournalEnd diff --git a/functional/basic-attestation-with-postgresql-db/test.sh b/functional/basic-attestation-with-postgresql-db/test.sh index 2dbce30..feed5c6 100755 --- a/functional/basic-attestation-with-postgresql-db/test.sh +++ b/functional/basic-attestation-with-postgresql-db/test.sh @@ -36,6 +36,11 @@ rlJournalStart #create network for containers rlRun "limeconCreateNetwork ${CONT_NETWORK_NAME} 172.18.0.0/16" + rlRun "rlFileBackup --clean ~/.ssh/" + #preparation for ssh access + rlRun 'ls /root/.ssh/id_*.pub &>/dev/null || ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa' + rlRun "cp /root/.ssh/id_*.pub ." + #build verifier container TAG_ATTESTATION_SERVER="keylime_server_image" rlRun "limeconPrepareImage ${limeLibraryDir}/${DOCKERFILE_SYSTEMD} ${TAG_ATTESTATION_SERVER}" @@ -112,7 +117,7 @@ EOF" limeClearData limeRestoreConfig rlServiceStop postgresql - rlFileRestore + rlRun "rlFileRestore" rlServiceRestore postgresql rlPhaseEnd