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

Add verbose HTTPS proxy message for fail on CURLE_SSL_CACERT #1258

Closed
jay opened this issue Feb 11, 2017 · 2 comments
Closed

Add verbose HTTPS proxy message for fail on CURLE_SSL_CACERT #1258

jay opened this issue Feb 11, 2017 · 2 comments

Comments

@jay
Copy link
Member

jay commented Feb 11, 2017

I think we should add some message to the tool's verbose text if an HTTPS proxy is in use and CURLE_SSL_CACERT. For example append a line mentioning --proxy-insecure and --proxy-cacert if the user specified an HTTPS proxy:

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
HTTPS proxy has similar options --proxy-cacert and --proxy-insecure.

and in code:

diff --git a/src/tool_operate.c b/src/tool_operate.c
index 94ae74d..8f89f04 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1681,8 +1681,13 @@ static CURLcode operate_do(struct GlobalConfig *global,
           fprintf(global->errors, "curl: (%d) %s\n", result, (errorbuffer[0]) ?
                   errorbuffer : curl_easy_strerror(result));
           if(result == CURLE_SSL_CACERT)
-            fprintf(global->errors, "%s%s",
-                    CURL_CA_CERT_ERRORMSG1, CURL_CA_CERT_ERRORMSG2);
+            fprintf(global->errors, "%s%s%s",
+                    CURL_CA_CERT_ERRORMSG1, CURL_CA_CERT_ERRORMSG2,
+                    ((config->proxy &&
+                      curl_strnequal(config->proxy, "https://", 8)) ?
+                     "HTTPS proxy has similar options --proxy-cacert "
+                     "and --proxy-insecure.\n" :
+                     ""));
         }
 
         /* Fall through comment to 'quit_urls' label */

/cc @rousskov

@rousskov
Copy link
Contributor

@jay, you should not ask me but IMHO, ideally, curl should detect/relay which certificate (origin or proxy) failed verification and adjust the error message accordingly. Reaching that ideal is probably difficult, and your change is probably sufficient to help most users.

@bagder
Copy link
Member

bagder commented Feb 11, 2017

Right, we don't return enough accuracy in the return code for a user to tell if it was a server or proxy that failed the certificate verification - that might be a subject for a separate issue. So until we have that, I'm 👍 on this suggestion.

@jay jay closed this as completed in e1187c4 Feb 11, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants