Fix error message when trying to use a self-signed HTTPS-proxy · Issue #1331 · curl/curl · GitHub
Skip to content You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert Fix error message when trying to use a self-signed HTTPS-proxy #1331 New issue Copy link New issue Copy link Closed Closed Fix error message when trying to use a self-signed HTTPS-proxy #1331 Copy link Labels TLS cmdline tool connecting & proxies Description nehaljwani opened on Mar 16, 2017 Issue body actions Use curl to fetch google.com via https-proxy To setup https-proxy, I configured squid with the option: https_port 3127 cert=/etc/squid/ssl_cert/myCA.pem Now, I try to send a request, and it tells me that it is a self-signed certificate, which is expected.
There is a hint in the output, which suggests that I should use --cacert to point to the CA certificate , or use -k to override this and go ahead with an insecure connection, all of this is expected. /t/curl-curl-7_53_1 ❯❯❯ https_proxy=https://proxy.mydomain.com:3127 ./src/curl -vvvv https://google.com * Rebuilt URL to: https://google.com/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to proxy.mydomain.com (127.0.0.1) port 3127 ( # 0) * ALPN, offering http/1.1 * Cipher selection: ALL: !
EXPORT: ! EXPORT40: ! EXPORT56: ! aNULL: ! LOW: ! RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * TLSv1.2 (OUT), TLS header, Certificate Status (22): * TLSv1.2 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (OUT), TLS alert, Server hello (2): * SSL certificate problem: self signed certificate * Closing connection 0 * TLSv1.2 (OUT), TLS alert, Client hello (1): curl: (60) SSL certificate problem: self signed certificate More details here: https://curl.haxx.se/docs/sslcerts.html 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.
I follow by the book, and provide the path to cacert using the flag and curl still throws the same error at me: /t/curl-curl-7_53_1 ❯❯❯ https_proxy=https://proxy.mydomain.com:3127 ./src/curl --cacert /tmp/myCA.pem -vvvv https://google.com * Rebuilt URL to: https://google.com/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to proxy.mydomain.com (127.0.0.1) port 3127 ( # 0) * ALPN, offering http/1.1 * Cipher selection: ALL: !
EXPORT: ! EXPORT40: ! EXPORT56: ! aNULL: ! LOW: ! RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * TLSv1.2 (OUT), TLS header, Certificate Status (22): * TLSv1.2 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (OUT), TLS alert, Server hello (2): * SSL certificate problem: self signed certificate * Closing connection 0 * TLSv1.2 (OUT), TLS alert, Client hello (1): curl: (60) SSL certificate problem: self signed certificate More details here: https://curl.haxx.se/docs/sslcerts.html 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.
Then, I try to pass the --insecure flag to override the self-signed warning, but curl is still not happy and throws the same message at me: /t/curl-curl-7_53_1 ❯❯❯ https_proxy=https://proxy.mydomain.com:3127 ./src/curl --insecure -vvvv https://google.com * Rebuilt URL to: https://google.com/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to proxy.mydomain.com (127.0.0.1) port 3127 ( # 0) * ALPN, offering http/1.1 * Cipher selection: ALL: !
EXPORT: ! EXPORT40: ! EXPORT56: ! aNULL: ! LOW: ! RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * TLSv1.2 (OUT), TLS header, Certificate Status (22): * TLSv1.2 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (OUT), TLS alert, Server hello (2): * SSL certificate problem: self signed certificate * Closing connection 0 * TLSv1.2 (OUT), TLS alert, Client hello (1): curl: (60) SSL certificate problem: self signed certificate More details here: https://curl.haxx.se/docs/sslcerts.html 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.
I give up, and add the self-signed certificate to the trust store: /e/s/ssl_cert ❯❯❯ sudo cp /etc/squid/ssl_cert/myCA.pem /etc/pki/ca-trust/source/anchors/mySquidCA.pem /e/s/ssl_cert ❯❯❯ sudo update-ca-trust And now curl is happy: /t/curl-curl-7_53_1 ❯❯❯ https_proxy=https://proxy.mydomain.com:3127 ./src/curl --insecure -vvvv https://google.com * Rebuilt URL to: https://google.com/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to proxy.mydomain.com (127.0.0.1) port 3127 ( # 0) * ALPN, offering http/1.1 * Cipher selection: ALL: !
EXPORT: ! EXPORT40: ! EXPORT56: ! aNULL: ! LOW: ! RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * TLSv1.2 (OUT), TLS header, Certificate Status (22): * TLSv1.2 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS handshake, Server finished (14): * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): * TLSv1.2 (OUT), TLS change cipher, Client hello (1): * TLSv1.2 (OUT), TLS handshake, Finished (20): * TLSv1.2 (IN), TLS change cipher, Client hello (1): * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / AES256-GCM-SHA384 * ALPN, server did not agree to a protocol * Proxy certificate: * subject: C=IN ; ST=Haryana ; L=Gurugram ; O=Default Company Ltd ; CN=proxy.mydomain.com ; emailAddress=no-reply@gmail.com * start date: Mar 16 06:43:35 2017 GMT * expire date: Mar 16 06:43:35 2018 GMT * common name: proxy.mydomain.com (matched) * issuer: C=IN ; ST=Haryana ; L=Gurugram ; O=Default Company Ltd ; CN=proxy.mydomain.com ; emailAddress=no-reply@gmail.com * SSL certificate verify ok. * Establish HTTP proxy tunnel to google.com:443 > CONNECT google.com:443 HTTP/1.1 > Host: google.com:443 > User-Agent: curl/7.53.1-DEV > Proxy-Connection: Keep-Alive > < HTTP/1.1 200 Connection established < * Proxy replied OK to CONNECT request * ALPN, offering http/1.1 * Cipher selection: ALL: !
EXPORT:
The rest of this page is on the live site.