-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[BUG] x509.certificate_managed rolls certificates every now and then #59315
Comments
Seems like #56556 still. |
@OrangeDog No, I don't think so. This is about comparing strings to bytes and random ordering because of unstable dicts prior Python 3.6. #56556 is about changed, but stable ordering. |
Can you try the latest version 3002.3? Do you still see the same behavior? |
@Ch3LL Thanks for your response. There is no 3002.3 right now. We are running on 3002.2, what is the latest release (as far as I could figure out). |
@stefan-as latest releases are here: https://github.com/saltstack/salt/releases or https://repo.saltproject.io/ but guessing you will still see this in 3002.6 or 3003, yes? |
can you see if #58296 fixes the issue for you |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@Ch3LL that change was in 3002.2 as far as I can tell, which is the version OP is reporting for. |
Description
Due to a combination of legacy Python2 Salt code and Python3.5 behavior on Debian Stretch, managed certificates are rolled every now and then.
Setup
Steps to Reproduce the behavior
salt-call state.apply
salt-call x509.read_certificate /etc/sensu/ssl/sensu.crt
Expected behavior
Idempotent behavior, no changes until the cert is out of date.
Screenshots
Certificate properties are different: Subject, Subject Hash
.Subject: commonName
andSubject: CN
by random.Versions Report
Additional context
The issue is caused by a combination of bugs. As far as I see, at least the first bug should be solved, since it concerns all versions of Python3.
salt/salt/states/x509.py
Line 436 in ea409f0
This way the code path always takes the long way into deep checking, although the involved hashes would be fine. Since there are no Python2 versions for Salt 3002, the compatibility code could be dropped and replaced by a clean check of the hashes.
salt/salt/modules/x509.py
Lines 333 to 335 in ea409f0
CN
andcommonName
uses the samenid_num
. This leads to situations where a subject rendered asCN
is compared to a subject containingcommonName
, they don't match and the cert is rolled over. This is the situation for at least Debian Stretch and could by solved by sortingsubject.nid.items()
before looping the nids.The text was updated successfully, but these errors were encountered: