Skip to content

Commit 6fa5851

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. Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
1 parent 1912e19 commit 6fa5851

File tree

1 file changed

+7
-6
lines changed
  • functional/basic-attestation-with-custom-certificates

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ rlJournalStart
2828
# registrar = webserver cert used for the registrar server
2929
# tenant = webclient cert used (twice) by the tenant, running on AGENT server
3030
# webhook = webserver cert used for the revocation notification webhook
31+
# agent = webserver cert used for mTLS connection
3132
# btw, we could live with just one key instead of generating multiple keys.. but that's just how openssl/certgen works
3233
rlRun "x509KeyGen -t ${CRYPTO_ALG} ca" 0 "Generating Root CA ${CRYPTO_ALG} key pair"
3334
rlRun "x509KeyGen -t ${CRYPTO_ALG} intermediate-ca" 0 "Generating Intermediate CA ${CRYPTO_ALG} key pair"
@@ -36,15 +37,15 @@ rlJournalStart
3637
rlRun "x509KeyGen -t ${CRYPTO_ALG} registrar" 0 "Generating registrar ${CRYPTO_ALG} key pair"
3738
rlRun "x509KeyGen -t ${CRYPTO_ALG} tenant" 0 "Generating tenant ${CRYPTO_ALG} key pair"
3839
rlRun "x509KeyGen -t ${CRYPTO_ALG} webhook" 0 "Generating webhook ${CRYPTO_ALG} key pair"
39-
#rlRun "x509KeyGen agent" 0 "Preparing RSA tenant certificate"
40+
rlRun "x509KeyGen -t ${CRYPTO_ALG} agent" 0 "Generating agent ${CRYPTO_ALG} key pair"
4041
rlRun "x509SelfSign ca" 0 "Selfsigning Root CA certificate"
4142
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"
4243
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webserver --subjectAltName 'IP = ${MY_IP}' verifier" 0 "Signing verifier certificate with intermediate CA key"
4344
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"
4445
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webserver --subjectAltName 'IP = ${MY_IP}' registrar" 0 "Signing registrar certificate with intermediate CA key"
4546
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webclient --subjectAltName 'IP = ${MY_IP}' tenant" 0 "Signing tenant certificate with intermediate CA key"
4647
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"
48+
rlRun "x509CertSign --CA intermediate-ca --DN 'CN = ${HOSTNAME}' -t webserver --subjectAltName 'IP = ${MY_IP}' agent" 0 "Signing agent certificate with intermediate CA key"
4849

4950
# copy verifier certificates to proper location
5051
CERTDIR=/var/lib/keylime/certs
@@ -61,8 +62,8 @@ rlJournalStart
6162
rlRun "cp $(x509Key tenant) $CERTDIR/tenant-key.pem"
6263
rlRun "cp $(x509Cert webhook) $CERTDIR/webhook-cert.pem"
6364
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"
65+
rlRun "cp $(x509Cert agent) $CERTDIR/agent-cert.pem"
66+
rlRun "cp $(x509Key agent) $CERTDIR/agent-key.pem"
6667
# assign cert ownership to keylime user if it exists
6768
id keylime && rlRun "chown -R keylime:keylime $CERTDIR"
6869

@@ -94,8 +95,8 @@ rlJournalStart
9495
rlRun "limeUpdateConf registrar server_key registrar-key.pem"
9596
# agent
9697
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\"'"
98+
rlRun "limeUpdateConf agent server_key '\"${CERTDIR}/agent-key.pem\"'"
99+
rlRun "limeUpdateConf agent server_cert '\"${CERTDIR}/agent-cert.pem\"'"
99100
if [ -n "$KEYLIME_TEST_DISABLE_REVOCATION" ]; then
100101
rlRun "limeUpdateConf revocations enabled_revocation_notifications '[]'"
101102
rlRun "limeUpdateConf agent enable_revocation_notifications false"

0 commit comments

Comments
 (0)