-
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
x509.pem_managed, two failure modes: "TypeError" and "PEM text not valid" #50637
Comments
hmm it looks like it should be handling byte type objects in teh first if statement in states/file.py. ping @terminalmage any ideas here? |
I'm following 'latest', not sure how to proceed here. |
Note that the x509 states don't accept the |
Thanks very much! I'm looking forward to this feature, I don't see a workaround in the other bug. I'm not sure what the release cadence is, although the gap between 3.3.2 and 3.3.3 appears to be about 16 weeks. |
Dup of #39608? |
thanks for tying the issues @sathieu :) I will close this issue and mention in the other |
Description of Issue/Question
Using the certificate authority based on the Salt mine described in:
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.x509.html
I would expect simple Jinja expansion to be correctly processed as input to pem_managed, but I receive a "TypeError: a bytes-like object is required, not 'str'" error.
To work around this, I tried converting that input into ascii with encode(), but that causes x509.get_pem_entry to fail the certificate because it doesn't pass a regex check for the certificate formatting (I'm hypothesizing that the expanded string includes the u' type prefix?)
Setup
The salt mine is working correctly, and entries can be retrieved, I can even cut + paste that certificate and use openssl to validate it.
I'm using this formula to fetch the certificate from the Salt mine and install it in my /etc/ssl/certs directory:
Steps to Reproduce Issue
Okay, reading the other bug reports concerning typed strings and unicode/ascii, that's probably related to the changes required to accommodate Python 3. I used the encode() function to reformat my text:
And changed my formula kwarg for 'text' to pull that instead:
But instead of success, I found another issue:
Versions Report
The text was updated successfully, but these errors were encountered: