(#15595) Offer better errors for certificate validation errors#953
(#15595) Offer better errors for certificate validation errors#953djmitche wants to merge 3 commits intopuppetlabs:2.7.xfrom
Conversation
The verify_callback callback gets an OpenSSL::SSL::SSLContext for each certificate in the chain that's verified. If the verification failed, then SSL provides a nice error to the callback, but that error doesn't appear in the subsequent OpenSSL::SSL::SSLError. This patch uses a technique similar to that used for peer_certs to collect those errors and then add them to the Puppet::Error message later. Remove the guess at the error (time sync).
lib/puppet/indirector/rest.rb
Outdated
There was a problem hiding this comment.
I don't think there is any reason for the unless on this line. The join will just return an empty string if verify_errors are empty. The only thing this saves is that we won't end up with an extra space character. I think this could be dealt with by just formatting the error message a little differently.
Maybe change the list of stringified verify_errors to be displayed as a list in square brackets. So that it appears as '... [verify error 1; verify error 2]' Then in the case were there are no errors it would be '.... []'.
* combine conditionals in verify_callback * change formatting of verify errors
|
updated! |
|
After looking into this more, I've found that the Unfortunately there isn't much documentation about what is available in ruby's OpenSSL bindings, and the best way of figuring this out seems to be inspecting the objects in irb. |
|
Hmm, when I hacked this in trying to track down verification numbers, |
|
Interesting, what version of ruby were you using? I've just tried it out on 1.8.7 and 1.9.3 and got the following: |
|
OK, I'll switch it, then. |
|
Well, I made the switch. I strongly suspect the tests won't pass anymore, but I just switched to doing development on my laptop, which means a new Ruby environment, and now I can't get the tests to run at all. So, in the interests of expediency, do you mind running them and making the necessary updates (which are, I'm sure, |
|
I've opened up another pull request (#972) with the changes that I made. Closing this out in favor of the new one. |
This is an update of #917 against the 2.7.x branch, as requested by @hkenney. It's also squashed and the bug number added to the commit branch.