idbeta edited a comment on issue #2791:
URL: https://github.com/apache/apisix/issues/2791#issuecomment-730250211


   It’s difficult to use `curl` to send the certificate content here. I suggest 
you use python, like the following
   ```python
   pem = '''-----BEGIN CERTIFICATE-----
   ... ...
   -----END CERTIFICATE-----'''
   
   key = '''-----BEGIN RSA PRIVATE KEY-----
   ... ...
   -----END RSA PRIVATE KEY-----'''
   
   cdata = {
       "id": "1",
       "cert": pem,
       "key": key,
       "snis": ["xxxx.org"]
   }
   
   headers = {
       "X-API-KEY": "edd1c9f034335f136f87ad84b625c8f1"
   }
   
   r = requests.put("http://127.0.0.1:9080/apisix/admin/ssl/1",json = 
cdata,headers=headers)
   print(r.text)
   ```
   
   **BTW: why don't you add a title for your issue?**
   
   my env is master branch, it was working well
   ```
   $ curl https://shaoyaoju.org:9443 -v
   * Rebuilt URL to: https://shaoyaoju.org: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 shaoyaoju.org:9443
   > CONNECT shaoyaoju.org:9443 HTTP/1.1
   > Host: shaoyaoju.org: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
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to