-
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
Rewrite x509.certificate_managed to be easier to use #52935
Conversation
One thing not fixed in this rewrite, the requirement of a dummy subjectAltName: #51869 (comment) That seems to be an issue with the x509 execution module. |
@glynnforrest thanks for this :) . I'm more than willing to help you get the tests running. If you haven't seen it already we have some test documentation here: https://docs.saltstack.com/en/latest/topics/tutorials/writing_tests.html Can you explain what you are attempting to run when you run into the issue when the salt-minion hangs? Also feel free to ping me in the community slack, my name is also ch3ll there and I can walk you through it. also @clinta can we get your review here? |
@Ch3LL I too fail to run the test suite: #52456 (comment) |
@alxwr i responded in the other issue |
@Ch3LL My first look at this and it looks good. I'll add another voice to the frustrations in running tests. I wanted to add a lot more x509 tests so that some of these bugs could be nailed down, but I've not been able to run them either. I think that posted documentation is out of date. See #51136. I also agree with the idea of deprecating |
@clinta thanks for the review and for bringing that issue to my attention. I went ahead and assigned myself, although I might not be able to get to it till next week. I do agree that we should definitely add some details about kitchen-salt as it makes things much easier, but a user can still run the test runner without using kitchen-salt. Can you elaborate on what your particular issues were when attempting to run the tests? In the meantime I'll try to find some time next week to push out more details about kitchen-salt so its easier to setup the tests and run them. |
Apologies for going off the grid. I'm still keen to get this tested well. @Ch3LL My approach so far is to try and get Run with python3 - test suite bootstraps OK, but both x509 tests are skipped because m2crypto isn't available. I can't figure out how to get it installed with pip3. It looks like python3 compatibility has been an issue in the past, here's an issue @thatch45 commented on: https://gitlab.com/m2crypto/m2crypto/issues/114 Run with python2 - test suite has errors at the bootstrap stage:
this repeats with various worker numbers ( Have you got a preferred way to update stale pull requests? Just merge develop? @clinta I appreciate you taking a look over this. Glad to hear you support the removal of |
@gyroplast Which version of m2crypto are you having issue with on Python 3 ?, have v0.31. and v0.33.on Python 3 running fine (RHEL 7). What is the the OS the problem is occurring on ? |
@dmurphy18 I don't really understand python packaging, so hopefully doing something wrong that can be fixed easily. Debian Stretch, I'm happy to get a VM or vagrant box going if that'll make things easier. |
@glynnforrest I cannot find openssl/err.h on Debian 9 either, not even with backports enabled, however it is there on my Ubutnu 18.04.2 openssl: Sorry I can only suggest Ubuntu instead of Debian for this test at the moment. Will look further in the morning |
With all the test work for 2019.2.1 it's probably worth trying to redo this on that branch? I'm also happy to test something manually. |
OK, I'd be happy to rebase on the 2019.2.1 branch.
Can you elaborate, are the tests going to be easier to run? Is there an issue I could take a look at? I did manage to get the suite running in an Ubuntu VM. Not giving up on this! |
@glynnforrest |
@glynnforrest due to this new salt enhancement proposal saltstack/salt-enhancement-proposals#20 we are merging everything into master. Do you mind migrating this PR over to the master branch? Also, we recently migrated to nox which should handle the requirements for you. To run the tests with nox, should be as easy as
|
Thanks @Ch3LL, I've been working on rebasing this branch onto master but it's a bit messy. There's some work on Looks like #49102 is ported to master in #54584. What would you like me to do? EDIT: sorry, ignore me, that option is for |
97d4eab
to
f0b0034
Compare
thanks for doing that i really appreciate it. let me know when its ready for review or if you have any other test questions. |
Any idea if this will make it in any time soon? |
looks like we are just waiting on some tests getting written. anything i can help with @glynnforrest |
f0b0034
to
c244713
Compare
Thanks for waiting, it's been hard to find the time to figure out how the tests work. I've written a couple of tests for a self signed cert, can you take a quick look @Ch3LL before I write any more? I'd like to test this pretty thoroughly but would like some initial feedback. |
yeah let me give it a review |
thanks for rebasing and posting that stacktrace. I created this issue #56603 so we can try to troubleshoot that there instead of adding noise to this PR. |
ping @waynew can we get your re-review here and this will be ready to go |
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.
🚀 Thanks for working through that, looks great!
@glynnforrest Should be OK, I think we've been merging when there aren't any merge conflicts, just due to the length of time the test runs take. We have some plans in place to reduce that here in the near future, but for now I don't think there's anything you need to do. |
I found a problem with this updated state. It does not check is any |
Thanks @hatifnatt, I'll get a fix for that written soon. |
Can you try #56788 @hatifnatt? |
@glynnforrest ok, I will try tomorrow. |
I need to correct my previous statement, changing key file paramaters are correctly generate changes after this PR, in my case state was not executed because I have |
This ensures that the certificate file has the intended file properties, even if the certificate contents themselves don't need to change. See saltstack#52935 (comment)
This ensures that the certificate file has the intended file properties, even if the certificate contents themselves don't need to change. See saltstack#52935 (comment)
This ensures that the certificate file has the intended file properties, even if the certificate contents themselves don't need to change. See #52935 (comment)
What does this PR do?
See #52167
After running into show-stopping bugs with
x509.certificate_managed
I decided to rewrite it. I have been running this function for the past 2 days with positive results.What issues does this PR fix or reference?
#52180, #39608, #41858 and others:
x509
module calls are written directly to the certificate file - fixed, the certificate file is only created when thex509
module calls succeed.EDIT: this does not attempt to correct #52167 - using a signing policy with
copypath
enabled. That is an issue with callingx509.create_certificate
withtestrun
set toTrue
. I will not be modifying the x509 execution module in this PR, just the state module.Other improvements:
test=True
append_certs
are checked to be valid certificates before appending themI decided to remove the
managed_private_key
option after reading this comment. Its removal significantly reduces the complexity of the function, and it can easily be replaced by an extrax509.private_key_managed
call.Screenshots! As well as showing the changes to the certificate information, it shows the reason the cert was updated.
test=True
:Tests written?
No
This is my first time writing code for salt and can't get the testsuite running (starting the salt-minion hangs). If I can get it working I'd be keen to add more tests covering this module.
Commits signed with GPG?
Yes