HelloZeroNet / ZeroNet

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
https://zeronet.io
Other
18.34k stars 2.27k forks source link

Forbidden. Invalid host #1579

Closed BenMcLean closed 6 years ago

BenMcLean commented 6 years ago

Step 1: Please describe your environment

Step 2: Describe the problem:

I'm trying to set up a private ZeroNet proxy on an old laptop running Ubuntu in my apartment. But I keep getting this "Forbidden. Invalid host" message when I try to use it. It takes the password, then says that message after the password is accepted. I have a subdomain pointing at this computer and port forwarding set up.

Steps to reproduce:

I have a zeronet.conf which looks like this:

[global] fileserver_port = 25008 ui_password = password ui_ip = * ui_port = port ui_host = localIP:port subdomain.example.com:port 127.0.0.1:port localhost:port hostname:port

Obviously replacing the example statements with the specifics.

Observed Results:

I get "Forbidden. Invalid host" anywhere I try to use the proxy, even on the same machine.

If I remove the ui_host line, then I can use it from inside my LAN but I still get "Forbidden. Invalid host" when I try to access it from outside.

Expected Results:

I shouldn't be getting "Forbidden. Invalid host" anywhere.

HelloZeroNet commented 6 years ago

You have to add the hosts to separate lines in the config file, so:

[global]
fileserver_port = 25008
ui_ip = *
ui_port = port
ui_host = 
 localIP:port
 subdomain.example.com:port
 127.0.0.1:port
 localhost:port
 hostname:port
ui_password = password

Note: This limitation is required to avoid DNS rebinding attack that affected uTorrent / Roku / Google devices: https://medium.com/@brannondorsey/attacking-private-networks-from-the-internet-with-dns-rebinding-ea7098a2d325

BenMcLean commented 6 years ago

That was it! That was the problem. Thanks for the information on this, but wow, that really needs to be in the documentation! I had tried putting them on multiple lines before, but ZeroNet was treating each line as if it were a separate parameter. Turns out, you need spaces before the hostnames in the config file!