Skip to content
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

Catch SSLError too when adding a provider #972

Merged

Conversation

cben
Copy link
Contributor

@cben cben commented Apr 9, 2017

Expands #314.
KubeException already covers the common "certificate verify failed" SSL errors but not rarer ones like "does not match the server certificate".
This might be resolved in Kubeclient or RestClient one day (ManageIQ/kubeclient#240) but it's blocked on backward compatibility concerns so let's catch it here for now.

So currently some SSL errors can crash get_hostname_from_routes leading to no indication except stacktrace in log:
sslerror-crash
This has also been observed as a "Unexpected error encountered" screen which does show the error but makes it hard to proceed.
https://bugzilla.redhat.com/show_bug.cgi?id=1436221

Any SSL error will probably fail both get_hostname_from_routes and the main validation code.
With this fix, the error from validation will then be displayed in a red flash:
sslerror

@miq-bot add-label compute/containers, bug, blocker, fine/yes
(per flags on https://bugzilla.redhat.com/show_bug.cgi?id=1436221)

@moolitayer @h-kataria Please review.

P.S. @h-kataria I think ems_common controller used to be more robust, with errors showing in UI, and at some point became more fragile due to JS/JSON response mismatch.

Expands ManageIQ#314.
KubeException already covers the common "certificate verify failed" SSL
errors but not rarer ones like "does not match the server certificate".
This might be resolved in Kubeclient or RestClient one day
(ManageIQ/kubeclient#240) but it's blocked
on backward compatibility concerns so let's catch it here for now.

get_hostname_from_routes is best-effort, should never crash UI.
Any SSL error will probably fail both get_hostname_from_routes and the
main validation code; the error from validation will then be displayed
in a red flash.
https://bugzilla.redhat.com/show_bug.cgi?id=1436221
@miq-bot
Copy link
Member

miq-bot commented Apr 9, 2017

Checked commit cben@7e2bc52 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks good. 🍰

Copy link

@moolitayer moolitayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion in kubeclient I think this is the correct solution long term (depends if/how rest-client/rest-client#168 will be resolved)

@martinpovolny martinpovolny merged commit bc446e5 into ManageIQ:master Apr 9, 2017
@martinpovolny martinpovolny added this to the Sprint 58 Ending Apr 10, 2017 milestone Apr 9, 2017
@martinpovolny martinpovolny self-assigned this Apr 9, 2017
simaishi pushed a commit that referenced this pull request Apr 11, 2017
Catch SSLError too when adding a provider
(cherry picked from commit bc446e5)
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit 03de454b980063ff78a28a3e0bd799da54d01a2a
Author: Martin Povolny <mpovolny@redhat.com>
Date:   Sun Apr 9 20:12:01 2017 +0200

    Merge pull request #972 from cben/get_hostname_from_routes-sslerror
    
    Catch SSLError too when adding a provider
    (cherry picked from commit bc446e54ba10dc0ca0a940abcd73f7e33d70c699)

cben added a commit to cben/manageiq-ui-classic that referenced this pull request Apr 23, 2017
ManageIQ#972 was not enough, e.g. OpenSSL::X509::CertificateError parsing
errors still spill through.  turns out OpenSSL::SSL::SSLError is not
the parent of all openssl errors, that would be OpenSSL::OpenSSLError.

But I won't repeating the mistake a third time, let's catch everything.
This function is a best-effort guess anyway.

https://bugzilla.redhat.com/show_bug.cgi?id=1436221
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants