hynek / prometheus-async

Async Python helpers for the official prometheus-client.

Home Page:https://prometheus-async.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SSL_ERROR_SYSCALL in connection to localhost

zidokobik opened this issue · comments

I have an async app and I want to expose the metrics with the asynchronous server, for security purposes I want to use SSL/TLS.

ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
metric_server = asyncio.create_task(start_http_server(addr='localhost', port=3011, ssl_ctx=ssl_context))

When testing the endpoint, I got the following:

$ curl -vk https://localhost:3011/metrics

*   Trying 127.0.0.1:3011...
* Connected to localhost (127.0.0.1) port 3011 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:3011 
* Closing connection 0
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:3011 

What am I doing wrong ?

Nevermind, I forgot to load the certificate