Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Add metrics certificate checks to the cluster suite #116

Closed
wants to merge 2 commits into from

Conversation

roosterfish
Copy link
Contributor

Related to canonical/lxd#13214.

This PR adds checks to validate if client and metrics certificates won't loose it's permission as defined before the cluster upgrade.

@@ -165,6 +165,14 @@ createPowerFlexPool() (
powerflex.user.password="${POWERFLEX_PASSWORD}"
)

# createCertificateAndKey: creates a new key pair.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like the gen_cert_and_key() from https://github.com/canonical/lxd/blob/main/test/includes/certificates.sh which is good but I'd also copy the other function to extract the fingerprint (cert_fingerprint()) as it seems like a useful helper. Maybe with the additional option of returning a partial fingerprint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I'll move it over too. Wasn't aware of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #128 (comment)

createCertificateAndKey "${tmp_cert_dir}/cert-restricted.key" "${tmp_cert_dir}/cert-restricted.crt" "cert-restricted.local"
lxc config trust add "${tmp_cert_dir}/cert.crt"
lxc config trust add "${tmp_cert_dir}/cert-restricted.crt" --restricted --projects default
unrestricted_fingerprint="$(openssl x509 -in "${tmp_cert_dir}/cert.crt" -outform der | sha256sum | head -c12)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move that to bin/helpers as suggested previously. TIL that head accepted -c, how handy, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #128 (comment)

@tomponline
Copy link
Member

@roosterfish is this ready for review?

@tomponline
Copy link
Member

I've opened #125 to get this merged before LXD 5.21.1 is released, but @roosterfish can open a follow up PR to fix @simondeziel suggestions later.

@tomponline tomponline closed this Apr 3, 2024
@roosterfish roosterfish deleted the cert_tests branch April 4, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants