apisix icon indicating copy to clipboard operation
apisix copied to clipboard

https plugins:curl: (60) Peer's certificate issuer has been marked as not trusted by the user.

Open lilihongjava opened this issue 6 years ago • 6 comments

Issue description

Operation steps:

  1. openssl genrsa -out private.pem 2048
  2. openssl req -new -x509 -key private.pem -out cacert.pem -days 1095
  3. cat /home/cert/cacert.pem >> /etc/pki/tls/certs/ca-bundle.crt
  4. curl http://127.0.0.1:9080/apisix/admin/ssl/1 -H 'X-API-KEY: XXX' -X PUT -d '{XXX}‘

error image:

image

Environment

  • apisix version 1.5:
  • OS:CentOS Linux release 7.4.1708 (Core)

lilihongjava avatar Nov 18 '20 07:11 lilihongjava

@lilihongjava My environment is correct, but mine is the master branch, cc @spacewander

$ curl --resolve 'das.com:9443:127.0.0.1' https://das.com:9443 -v
* Added das.com:9443:127.0.0.1 to DNS cache
* Rebuilt URL to: https://das.com:9443/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 7890 (#0)
* Establish HTTP proxy tunnel to das.com:9443
> CONNECT das.com:9443 HTTP/1.1
> Host: das.com:9443
> User-Agent: curl/7.54.0
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* 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
* stopped the pause stream!
* Closing connection 0
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

idbeta avatar Nov 18 '20 08:11 idbeta

@lilihongjava How you sign the test.com's certificate?

spacewander avatar Nov 18 '20 09:11 spacewander

@lilihongjava How you sign the test.com's certificate?

ZW{9NEQ(2UGWMTG(ADC`WZP

lilihongjava avatar Nov 18 '20 10:11 lilihongjava

I think you confuse CA certificate and normal certificate. Please take a look at https://support.itrsgroup.com/hc/en-us/articles/360020251493-Create-a-self-signed-CA-client-certificate-with-OpenSSL about how to sign a normal certificate.

spacewander avatar Nov 18 '20 11:11 spacewander

@lilihongjava My environment is correct, but mine is the master branch, cc @spacewander

$ curl --resolve 'das.com:9443:127.0.0.1' https://das.com:9443 -v
* Added das.com:9443:127.0.0.1 to DNS cache
* Rebuilt URL to: https://das.com:9443/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 7890 (#0)
* Establish HTTP proxy tunnel to das.com:9443
> CONNECT das.com:9443 HTTP/1.1
> Host: das.com:9443
> User-Agent: curl/7.54.0
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* 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
* stopped the pause stream!
* Closing connection 0
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

Can you provide the whole operation steps and execution commands, I refer to it, thank you very much

lilihongjava avatar Nov 19 '20 01:11 lilihongjava

@lilihongjava My environment is correct, but mine is the master branch, cc @spacewander

$ curl --resolve 'das.com:9443:127.0.0.1' https://das.com:9443 -v
* Added das.com:9443:127.0.0.1 to DNS cache
* Rebuilt URL to: https://das.com:9443/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 7890 (#0)
* Establish HTTP proxy tunnel to das.com:9443
> CONNECT das.com:9443 HTTP/1.1
> Host: das.com:9443
> User-Agent: curl/7.54.0
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* 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
* stopped the pause stream!
* Closing connection 0
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

Can you provide the whole operation steps and execution commands, I refer to it, thank you very much

Please refer to:

I think you confuse CA certificate and normal certificate. Please take a look at https://support.itrsgroup.com/hc/en-us/articles/360020251493-Create-a-self-signed-CA-client-certificate-with-OpenSSL about how to sign a normal certificate.

spacewander avatar Nov 19 '20 02:11 spacewander