-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nginx HTTPS reverse proxy causes the client to fail to connect to server in unintuitive way #5203
Comments
Confirm i am affected by this issue on Windows with 3.3.4 |
You don't need a letsencrypt cert. Electrum Client saves the first certificate it downloads from the server, and just requires that it match in the future. If you changed certs, it'll be different and invalid. You can fix it by going into your electrum directory and deleting your previous server certificate. |
Is that server online now? I would like to try to connect. |
To be clear, trust on first use only applies to self-signed certificates. For more details, see #1782 (comment) |
Hi, thanks for the tips. So I deleted ~/.electrum/certs/electrum.kexkey.com and it doesn't connect ( @SomberNight did you try the server? Did it work? Out of curiosity, do you know why Electrum Wallet doesn't just simply use the CA signed cert if available, behaving like a browser dealing with a cert? I noticed some more Thanks for your support. |
I've tried connecting to electrum.kexkey.com:50001 using TCP, there I get: I've also tried electrum.kexkey.com:50002 using SSL, there I get: I've assumed you turned off the server.
It does that! Electrum is very flexible here, as explained in my link above, it accepts both CA signed certs and self-signed certs.
You shouldn't fiddle too much with the stuff in the certs dir (for the client); apart from maybe deleting files already there, for debugging purposes. |
I exposed port 50001 just for the time I needed to test it. It worked. Now I am exposing port 50002 and 443, both with SSL (with the above errors), and also as a Tor service (it works, I'm currently using it). I'll try with a self-signed cert (instead of letsencrypt) to see if I get the same results. In the meantime, if you have more ideas for me to try, I'm all ears. :) Oh by the way, I think there was a "SSL" checkbox in the network dialog before. Why did it get removed? It would be nice to be able to switch to an onion server via the GUI. When I tried, it was trying to connect to the onion address with :s SSL. I had to exit and launch the wallet with the args on the command-line. ( I'll let you know if there's something new. Thanks again! |
It was removed to simplify the GUI a bit, and because there is no reason for ordinary end users to disable SSL. It's true that in the case of .onion servers, it might make sense to use TCP as they are already encrypted/authenticated. You can still use .onion servers through SSL though, and the majority of operators of .onion servers expose SSL ports. Also, if you have your own server, or you want TCP for debugging reasons (which is why it was kept at all), then you can do via the CLI option you wrote. |
What server software are you running? Is it recent ElectrumX? It seems as soon as the client sends Btw, how come that you originally said you are getting |
Electrs: https://github.com/romanz/electrs
When the file Note: it works well without SSL as well as through Tor (tcp). |
Your port 50002 points to an nginx HTTP webserver. Of course Electrum cannot connect.... Compare electrum.qtornado.com:50002:s
with electrum.kexkey.com:50002:s
|
Yes, I am using an nginx instance in front of the server to deal with the certificate creation/renewal. So you are telling me that I can't use an nginx server to proxy the requests to the electrum server? It only acts as a reverse proxy. |
The electrum protocol is not HTTP based, so I don't understand what an HTTP proxy in the middle of a connection can do. "tcp" in electrum means: "ssl" in electrum means: |
Hello @SomberNight! Good catch, the problem was my nginx proxy config locked to HTTP. I reconfigured it so it serves TCP requests (as well as takes care of the letsencrypt certs) and now it works. The error message about the SSL certificate not being verified (or anything related to SSL) was very misleading. The error was actually receiving a 400 Bad Request is not an expected or valid response for Electrum Wallet. Thank you very much for your help and patience. Hopefully this issue helps other people in the same situation. |
@Kexkey mind sharing that nginx config? |
I'm sure there are better ways to do it, but you can have a look at my repo here: https://github.com/SatoshiPortal/electrs-deploy
Follow the README file and adapt the whole thing to your needs. See Good luck! |
@Kexkey thank you 👍 |
I'm having the exact same problem with a very similar setup. 10T030550.625154Z | INFO | interface.[thoth:50002] | disconnecting due to: ConnectError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),) I'm also running Electrum Rust Server and NGINX as reverse proxy on a Linux server, except my nginx.conf is already the same as @Kexkey 's and yet it does not work.
Over plain HTTP it works fine but over SSL the wallet drops the connection. Any ideas? |
Hi,
Electrum Wallet 3.3.4 on OSX, same problem on Windows.
I'm testing an instance of electrum server. Everything works well when using it in clear (http port 50001) as well as through Tor, but when I use it with TLS (I installed a letsencrypt TLS certificate), Electrum wallet always gives me this error:
Used
-s electrum.kexkey.com:50002:s
when starting up.Are you aware of any recent TLS problems with python or electrum wallet? When I hit https://electrum.kexkey.com on port 443 or 50002, the browser tells me the certificate is valid.
Thanks!
The text was updated successfully, but these errors were encountered: