proxy.py: `FileNotFoundError` while using TLS Interception
Describe the bug Got this error when using TLS interception:
handler.handle_readables:234 - Exception when receiving from client connection#24 with reason FileNotFoundError(2, 'No such file or directory')
To Reproduce
With ca files generated by make ca-certificates and signed by make sign-https-certificates, I got three files:
https-cert.pemhttps-key.pemhttps-csr.pem
then using nested python code to start proxy.py:
main(
hostname=hostname,
ca_cert_file="/Users/doge/desktop/https-cert.pem",
ca_key_file="/Users/doge/desktop/https-key.pem",
ca_signing_key_file="/Users/doge/desktop/https-csr.pem",
plugins=[ModifyLBXLocationPlugin],
local_executor=False,
)
I’m pretty sure these CA files are exists, but got the exception above and no connection could pass proxy. Using relative path not helps.
Version information
- OS: macOS 12.2.1
- proxy.py Version: 2.4.0
Additional context Thanks for your working 😃!
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 15 (5 by maintainers)
Same issue here: When I do
curl -v --cacert ca-cert.pem -x 127.0.0.1:8899 https://httpbin.org/get, first I seeProxy CONNECT aborted. I didpip install certifiin the container, the error changed toOpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to httpbin.org:443. In the container log there are exceptions that saysFileNotFoundError: [Errno 2] No such file or directory: 'openssl'. Then I findopenssldoesn’t seem to be installed at all in the container:sh: openssl: not found. According to the doc it looks like theabhinavsingh/proxy.py:latestshould come withopenssl… And I don’t know how to install it withoutaptin the container… Did I miss something?I somehow worked around this issue by explicitly passing in
--ca-file /etc/ssl/certs/ca-certificates.crt. Seems like the default path doesn’t exist and causes an error. I’m running the proxy.py on raspberry pi os (buster) btw.On Raspberry PI, I set --ca-file /etc/ssl/certs/ca-certificates.crt to point to the exiting trusted certificate store. This seems to help with this. proxy.py’s default does not cut it it seems on this platform.
With the curl example, make sure to point to a valid certificate (or pass -k to go untrusted ok mode)
Hi @abhinavsingh, @guiqiqi
I was facing the same issues until realized from @abhinavsingh’s comment that certifi wasn’t installed in my virtualenv (I’m running Python 3.9.12). Installed with:
After installing
certifiI got it working without explicitly setting--ca-fileparameter.