Skip to content

Commit df77ee4

Browse files
committed
Use custom certificates for the agent too
Previously, the agent supported only RSA key/certificate as the mTLS key because it was also used to encrypt data in the secure payload mechanism. With keylime/rust-keylime#1129, the agent is now able to use different algorithms for mTLS. When testing PQC algorithms, set ECDSA keys for the agent due to https://issues.redhat.com/browse/RHEL-117439. Once this is fixed, the special treatment for the agent mTLS should be removed. Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
1 parent d32f9ac commit df77ee4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

functional/basic-attestation-with-custom-certificates/main.fmf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ extra-nitrate: TC#0611725
3939
/pqc_alg:
4040
environment:
4141
CRYPTO_ALG: mldsa65
42+
AGENT_CRYPTO_ALG: ecdsa
4243
continue: false
4344
adjust+:
4445
- enabled: false

functional/basic-attestation-with-custom-certificates/test.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ WEBHOOK_SERVER_PORT=8980
88
AGENT_ID="d432fbb3-d2f1-4a97-9ef7-75bd81c00000"
99
MY_IP=127.0.0.1
1010
HOSTNAME=$( hostname )
11+
# When testing PQC, set the agent algorithm with something else due to
12+
# https://issues.redhat.com/browse/RHEL-117439
13+
[ -n "{AGENT_CRYPTO_ALG}" ] || AGENT_CRYPTO_ALG="${CRYPTO_ALG}"
1114

1215
rlJournalStart
1316

@@ -28,6 +31,7 @@ rlJournalStart
2831
# registrar = webserver cert used for the registrar server
2932
# tenant = webclient cert used (twice) by the tenant, running on AGENT server
3033
# webhook = webserver cert used for the revocation notification webhook
34+
# agent = webserver cert used for mTLS connection
3135
# btw, we could live with just one key instead of generating multiple keys.. but that's just how openssl/certgen works
3236
rlRun "x509KeyGen -t ${CRYPTO_ALG} ca" 0 "Generating Root CA ${CRYPTO_ALG} key pair"
3337
rlRun "x509KeyGen -t ${CRYPTO_ALG} intermediate-ca" 0 "Generating Intermediate CA ${CRYPTO_ALG} key pair"
@@ -36,15 +40,15 @@ rlJournalStart
3640
rlRun "x509KeyGen -t ${CRYPTO_ALG} registrar" 0 "Generating registrar ${CRYPTO_ALG} key pair"
3741
rlRun "x509KeyGen -t ${CRYPTO_ALG} tenant" 0 "Generating tenant ${CRYPTO_ALG} key pair"
3842
rlRun "x509KeyGen -t ${CRYPTO_ALG} webhook" 0 "Generating webhook ${CRYPTO_ALG} key pair"
39-
#rlRun "x509KeyGen agent" 0 "Preparing RSA tenant certificate"
43+
rlRun "x509KeyGen -t ${AGENT_CRYPTO_ALG} agent" 0 "Generating agent ${AGENT_CRYPTO_ALG} key pair"
4044
rlRun "x509SelfSign ca" 0 "Selfsigning Root CA certificate"
4145
rlRun "x509CertSign --CA ca --DN 'CN = ${HOSTNAME}' -t CA --subjectAltName 'IP = ${MY_IP}' intermediate-ca" 0 "Signing intermediate CA certificate with our Root CA key"
4246
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webserver --subjectAltName 'IP = ${MY_IP}' verifier" 0 "Signing verifier certificate with intermediate CA key"
4347
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webclient --subjectAltName 'IP = ${MY_IP}' verifier-client" 0 "Signing verifier-client certificate with intermediate CA key"
4448
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webserver --subjectAltName 'IP = ${MY_IP}' registrar" 0 "Signing registrar certificate with intermediate CA key"
4549
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webclient --subjectAltName 'IP = ${MY_IP}' tenant" 0 "Signing tenant certificate with intermediate CA key"
4650
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webserver --subjectAltName 'IP = ${MY_IP}' webhook" 0 "Signing webhook certificate with intermediate CA key"
47-
#rlRun "x509SelfSign --DN 'CN = ${HOSTNAME}' -t webserver agent" 0 "Self-signing agent certificate"
51+
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webserver --subjectAltName 'IP = ${MY_IP}' agent" 0 "Signing agent certificate with intermediate CA key"
4852

4953
# copy verifier certificates to proper location
5054
CERTDIR=/var/lib/keylime/certs
@@ -61,8 +65,8 @@ rlJournalStart
6165
rlRun "cp $(x509Key tenant) $CERTDIR/tenant-key.pem"
6266
rlRun "cp $(x509Cert webhook) $CERTDIR/webhook-cert.pem"
6367
rlRun "cp $(x509Key webhook) $CERTDIR/webhook-key.pem"
64-
#rlRun "cp $(x509Cert agent) $CERTDIR/agent-cert.pem"
65-
#rlRun "cp $(x509Key agent) $CERTDIR/agent-key.pem"
68+
rlRun "cp $(x509Cert agent) $CERTDIR/agent-cert.pem"
69+
rlRun "cp $(x509Key agent) $CERTDIR/agent-key.pem"
6670
# assign cert ownership to keylime user if it exists
6771
id keylime && rlRun "chown -R keylime:keylime $CERTDIR"
6872

@@ -94,8 +98,8 @@ rlJournalStart
9498
rlRun "limeUpdateConf registrar server_key registrar-key.pem"
9599
# agent
96100
rlRun "limeUpdateConf agent trusted_client_ca '\"['${CERTDIR}/intermediate-cacert.pem', '${CERTDIR}/cacert.pem']\"'"
97-
rlRun "limeUpdateConf agent server_key '\"agent-key.pem\"'"
98-
rlRun "limeUpdateConf agent server_cert '\"agent-cert.pem\"'"
101+
rlRun "limeUpdateConf agent server_key '\"${CERTDIR}/agent-key.pem\"'"
102+
rlRun "limeUpdateConf agent server_cert '\"${CERTDIR}/agent-cert.pem\"'"
99103
if [ -n "$KEYLIME_TEST_DISABLE_REVOCATION" ]; then
100104
rlRun "limeUpdateConf revocations enabled_revocation_notifications '[]'"
101105
rlRun "limeUpdateConf agent enable_revocation_notifications false"

0 commit comments

Comments
 (0)