From bf755be6f70765fc37631ac097617a2383716ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Kon=C4=8Dit=C3=BD?= <44195706+Koncpa@users.noreply.github.com> Date: Mon, 14 Aug 2023 10:26:29 +0200 Subject: [PATCH] Set keylime_port_t label for random ports use in tests Apply condtionally for specific version of rhel and fedoras. --- .../main.fmf | 1 + .../basic-attestation-with-custom-certificates/test.sh | 5 +++++ functional/keylime-non-default-ports/main.fmf | 1 + functional/keylime-non-default-ports/test.sh | 10 ++++++++++ 4 files changed, 17 insertions(+) diff --git a/functional/basic-attestation-with-custom-certificates/main.fmf b/functional/basic-attestation-with-custom-certificates/main.fmf index 63280163..a8ae5653 100644 --- a/functional/basic-attestation-with-custom-certificates/main.fmf +++ b/functional/basic-attestation-with-custom-certificates/main.fmf @@ -22,6 +22,7 @@ require: - openssl - nmap-ncat - python3-toml +- policycoreutils-python-utils recommend: - keylime duration: 15m diff --git a/functional/basic-attestation-with-custom-certificates/test.sh b/functional/basic-attestation-with-custom-certificates/test.sh index c060e411..cd93d1f5 100755 --- a/functional/basic-attestation-with-custom-certificates/test.sh +++ b/functional/basic-attestation-with-custom-certificates/test.sh @@ -17,6 +17,11 @@ rlJournalStart rlRun 'rlImport "certgen/certgen"' || rlDie "cannot import openssl/certgen library" rlAssertRpm keylime + #seting keylime_port_t label for ssl port + if rlIsRHEL '>=9.3' || rlIsFedora '>=38' || rlIsCentOS '>=9';then + rlRun "semanage port -a -t keylime_port_t -p tcp $SSL_SERVER_PORT" + fi + # generate TLS certificates for all # we are going to use 4 certificates # verifier = webserver cert used for the verifier server diff --git a/functional/keylime-non-default-ports/main.fmf b/functional/keylime-non-default-ports/main.fmf index 17c85391..14becaf4 100644 --- a/functional/keylime-non-default-ports/main.fmf +++ b/functional/keylime-non-default-ports/main.fmf @@ -17,6 +17,7 @@ require: - yum - tpm2-tools - python3-toml + - policycoreutils-python-utils recommend: - keylime duration: 5m diff --git a/functional/keylime-non-default-ports/test.sh b/functional/keylime-non-default-ports/test.sh index bcab5bb9..e7b827e3 100755 --- a/functional/keylime-non-default-ports/test.sh +++ b/functional/keylime-non-default-ports/test.sh @@ -37,6 +37,16 @@ rlJournalStart rlRun "limeInstallIMAConfig" rlRun "limeStartIMAEmulator" fi + + #seting keylime_port_t label for non default ports + if rlIsRHEL '>=9.3' || rlIsFedora '>=38' || rlIsCentOS '>=9';then + rlRun "semanage port -a -t keylime_port_t -p tcp 19002" + rlRun "semanage port -a -t keylime_port_t -p tcp 18890" + rlRun "semanage port -a -t keylime_port_t -p tcp 18992" + rlRun "semanage port -a -t keylime_port_t -p tcp 18891" + rlRun "semanage port -a -t keylime_port_t -p tcp 18881" + fi + sleep 5 #set non default ports #default port 9002