Skip to content

Commit 6a1bbed

Browse files
mmartinvknecasov
authored andcommitted
fix(test): simplify device CA rendezvous trust test flow
Add wrong Device CA cert first (manufacturer cert), verify onboarding fails, delete it, then add the correct cert. This removes a redundant fail-delete-readd cycle while preserving the same trust verification coverage. Also removes unused certs_file variable. Signed-off-by: Miguel Martín <mmartinv@redhat.com> Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9767f2d commit 6a1bbed

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

test/ci/test-device-ca-rendezvous-trust.sh

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ set -euo pipefail
55
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/utils.sh"
66
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/../utils/mgmt-api-v1.sh"
77

8-
certs_file="${logs_dir}/certs.json"
9-
108
run_test() {
119

1210
log_info "Setting the error trap handler"
@@ -52,6 +50,9 @@ run_test() {
5250
log_info "Sending Ownership Voucher to the Owner"
5351
send_manufacturer_ov_to_owner "${manufacturer_url}" "${guid}" "${owner_url}"
5452

53+
log_info "Adding wrong Device CA certificate to rendezvous"
54+
add_device_ca_cert "${rendezvous_url}" "${manufacturer_crt}" | jq -r -M .
55+
5556
log_info "Running FIDO Device Onboard (expected to fail)"
5657
client_timeout=10s
5758
! run_fido_device_onboard "${guid}" --debug || log_error "Onboarding must fail!"
@@ -60,20 +61,13 @@ run_test() {
6061
# server logs are only saved to log files if the test fails.
6162
get_service_logs "rendezvous" | grep "cryptographic verification failed: x509: certificate signed by unknown authority" || log_error "Rendezvous didn't reject the ownership voucher!"
6263

63-
log_info "Adding Device CA certificate to rendezvous"
64-
add_device_ca_cert "${rendezvous_url}" "${device_ca_crt}" | jq -r -M .
65-
6664
log_info "Get the rendezvous Device CA certificates"
6765
fingerprint=$(get_device_ca_certs "${rendezvous_url}" | jq -r -M '.certs[0].fingerprint')
6866

6967
log_info "Deleting certificate with fingerprint '${fingerprint}'"
7068
delete_device_ca_cert "${rendezvous_url}" "${fingerprint}"
7169

72-
log_info "Running FIDO Device Onboard (expected to fail again)"
73-
! run_fido_device_onboard "${guid}" --debug || log_error "Onboarding must fail!"
74-
get_service_logs "rendezvous" | grep "cryptographic verification failed: x509: certificate signed by unknown authority" || log_error "Rendezvous didn't reject the ownership voucher!"
75-
76-
log_info "Adding Device CA certificate to rendezvous"
70+
log_info "Adding correct Device CA certificate to rendezvous"
7771
add_device_ca_cert "${rendezvous_url}" "${device_ca_crt}" | jq -r -M .
7872

7973
log_info "Running FIDO Device Onboard"

0 commit comments

Comments
 (0)