-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix assertion for test_katello_certs_check_output_invalid_input #17002
Fix assertion for test_katello_certs_check_output_invalid_input #17002
Conversation
trigger: test-robottelo |
This looks like a raw OpenSSL error. Did that change in both EL8 and EL9? |
Hmm, it's failing only for EL9 on 6.16 |
Then ACK on |
PRT Result
|
Can I just keep |
1d8f04b
to
0abe434
Compare
If the assertion can use a substring, sure |
0abe434
to
770e5bf
Compare
maybe let's not, kept the original message. Updating it based on rhel version. |
trigger: test-robottelo |
PRT Result
|
@@ -73,11 +73,12 @@ class TestKatelloCertsCheck: | |||
CA cert (a.k.a cacert.crt or rootCA.pem) can be used as bundle file. | |||
""" | |||
|
|||
error_message = f"error 26 at 0 depth lookup: {'unsupported' if settings.repos.rhel_major_version == '8' else 'unsuitable'} certificate purpose" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error surprises me a bit. If we don't assert the explicit message we emit ourselves:
https://github.com/theforeman/foreman-installer/blob/7c2b54267a933bcf0261396c0950d51c8d5bec5c/bin/katello-certs-check#L157-L169
Perhaps that's not needed and we can simply assert the right code path is used by checking for exit code 4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what I see in logs, no exit code 4
Checking CA bundle against the certificate file:
[FAIL]
The /root/cacert.crt does not verify the /root/certs/invalid.crt
CN=foreman.example.com
error 20 at 0 depth lookup: unable to get local issuer certificate
error /root/certs/invalid.crt: verification failed
Checking CA bundle size: 1
[OK]
Checking if CA bundle has trust rules: 0
[OK]
Checking Subject Alt Name on certificate
[FAIL]
The /root/certs/invalid.crt does not contain a Subject Alt Name. Common Name is deprecated, use Subject Alt Name instead. See: https://tools.ietf.org/html/rfc2818#section-3.1
Checking Key Usage extension on certificate for Key Encipherment
[OK]
Checking for use of shortname as CN
stderr:
status: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That signals something is broken. The error function sets the exit code:
https://github.com/theforeman/foreman-installer/blob/7c2b54267a933bcf0261396c0950d51c8d5bec5c/bin/katello-certs-check#L65-L70
Then It's also surprising the command exits unexpectedly, without showing [OK]
or [FAIL]
. That looks like check-shortname
isn't following an expected code path:
https://github.com/theforeman/foreman-installer/blob/7c2b54267a933bcf0261396c0950d51c8d5bec5c/bin/katello-certs-check#L229-L250
Given there was already a warning that it doesn't contain a SAN I think we can conclude it's missing an else
statement with success
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it's a bug😅. DO you want me to file an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have it covered in our tests: https://github.com/theforeman/foreman-installer/blob/develop/spec/katello_certs_check_spec.rb is what we use in CI.
Do I read it well that these certs are generated using tests/foreman/data/certs.sh
? In particular:
robottelo/tests/foreman/data/certs.sh
Lines 48 to 49 in fdad16a
# generate invalid certs with hostname as 'foreman.example.com' | |
generate_certs "invalid" "/CN=foreman.example.com" "client_extensions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
770e5bf
to
0ff783f
Compare
0ff783f
to
39f990b
Compare
(cherry picked from commit 2908992)
Problem Statement
test_katello_certs_check_output_invalid_input[error0-certs/invalid.crt-certs/invalid.key-certs/ca.crt]
is failing with AssertionError because the error message has changed.Solution
Related Issues