-
Notifications
You must be signed in to change notification settings - Fork 89
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
openssl_csr does not support non-hostname CN values #105
Comments
According to the documentation, the common name is always added as a Subject Alternative Name if no Subject Alternative Names are specified (which is true in your case). This causes this error. Simply specify the module option (It definitely should not crash in this case. That's definitely a bug. I'll look at that probably tomorrow.) |
On that specific use case by the way: Kubernetes is now being built using golang 1.15, so you'll run into issues similar to golang/go#39568 if you use such a certificate in the future, just as a heads-up in general (see also https://golang.org/doc/go1.15#commonname). The general case of course should be still investigated and probably made possible. |
@felixfontein Aha! That did it. Thanks for such a quick reply. (Although I set the value to false rather than true) @MarkusTeufelberger That's really good to know; that's definitely going to cause issues for me with some other components. I don't think it should matter in this specific case though since the cert isn't being used to validate a hostname. |
@ben-turner haha, yes, sorry, it definitely should be |
I've created a PR which improves this error message (#106). Interestingly, it turns out that only some cryptography versions return this error (probably versions < 2.0, and some later ones only when @ben-turner could you check which version of cryptography you have installed on the remote machine (where the module is executed), and whether |
@felixfontein I'm not totally familiar with the ansible and python ecosystems yet so I don't know if this is the output you're looking for. I'm not using pip but I was able to get the following out of yum:
These are the default versions that were pre-installed on an EC2 instance running the latest Amazon Linux 2. |
@ben-turner assuming you are using Python 2 on the host, the module is probably using cryptography 1.7.2, which happens to be one of the versions we're also having in CI. So my fix should work for your system, i.e. produce a nicer error message hinting at |
Excellent! Thanks so much |
SUMMARY
PKI certs can be used for a variety of things beyond HTTPS servers. I need to be able to generate a certificate with
system:kube-controller-manager
as the common name. This is permitted by openssl, but blocked by this module. Since this is an inconsistency between openssl and this module, I'm calling it a bug.ISSUE TYPE
COMPONENT NAME
openssl_csr
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Amazon Linux 2
OpenSSL 1.0.2k-fips 26 Jan 2017
STEPS TO REPRODUCE
Try to generate a certificate that contains a non-hostname value as the common name.
EXPECTED RESULTS
A new cert is generated with
system:kube-controller-manager
as the common name.ACTUAL RESULTS
The task fails
The text was updated successfully, but these errors were encountered: