hynek / prometheus-async

Async Python helpers for the official prometheus-client.
https://prometheus-async.readthedocs.io/
Apache License 2.0
159 stars 15 forks source link

SSL_ERROR_SYSCALL in connection to localhost #44

Closed zidokobik closed 1 year ago

zidokobik commented 1 year ago

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 ?

zidokobik commented 1 year ago

Nevermind, I forgot to load the certificate