cculianu / Fulcrum

A fast & nimble SPV Server for BCH, BTC, and LTC
Other
331 stars 77 forks source link

Cannot connect to Fulcrum via Tor #118

Closed DanielPX1 closed 2 years ago

DanielPX1 commented 2 years ago

Hello,

I have successfully synced Fulcrum on raspberry pi 4 and trying to set up Tor hidden service to use for remote connections. Fulcrum works connecting on my local network specifing device IP and Port. However I am unable to connect via Tor, I don't know how working config looks like, since it is very different from electrum config file I was using before.

I have set up following in my torrc config:

Torrc

HiddenServiceDir /var/lib/tor/hidden_service_fulcrum/
HiddenServiceVersion 3
HiddenServicePort 50002 127.0.0.1:50002

and then printed my hostname using: 'sudo cat /var/lib/tor/hidden_service_fulcrum/hostname' xyz.onion

My config file for fulcrum is set up like this:

Fulcrum config

datadir = /path/to/db/
bitcoind = 127.0.0.1:8332
rpcuser = username
rpcpassword = password
cert = /path/
key = /path/
peering = false
ssl = 0.0.0.0:50002
tor_hostname=xyz.onion (copied from hostname)
tor_tcp_port = 50001
tor_ssl_port = 50002

NGINX

upstream fulcrum {
  server 127.0.0.1:50001;
}

server {
  listen 50002 ssl;
  proxy_pass fulcrum;
}

Trying to connect with my wallet for both:

xyz.onion:50001
-//- :50002

Wallet is confirmed to work with Tor since I used it for a long time with electrum. Am I missing something in my config files?

cculianu commented 2 years ago

I am not sure at all how to use nginx, since I never use it. I just use iptables and/or a traditional firewall on my router. So.. I wouldn't be the best help as far as nginx goes. I say this because I suspect the nginx setup is interfering in some way, since everything else that I do understand in what you pasted looks good.

I do think that SSL over Tor might be a problem. TCP over Tor is the way I have always done it. Wouldn't you need a separate cert for your tor hostname if using SSL over Tor .onion?

Maybe you should modify the nginx setup to forward the TCP port 50001, not 50002 (SSL)?

Just a thought...

Something like this (note I don't know if this actually works since I never use NGINX:

upstream fulcrum {
 server 127.0.0.1:50001;
}

server {
 listen 50001;
 proxy_pass fulcrum;
}
DanielPX1 commented 2 years ago

Thank you for answer. Already fixed:) Also thank you for great work. I see a lot of soul put there

cculianu commented 2 years ago

It was a passion project for me. I was convinced I could run a decent Electrum Wallet server off modest hardware and still get great performance..!