Zeronet: Unable to Make personal Clearnet Relay

Created on 5 Nov 2019  路  13Comments  路  Source: HelloZeroNet/ZeroNet

Step 1: Please describe your environment

  • ZeroNet version: 0.71, r4206
  • Operating system: Archlinux
  • Web browser: Chrome/Firefox
  • Tor status: irellavent
  • Opened port: yes
  • Special configuration: Reverse proxy

Step 2: Describe the problem:

http://127.0.0.1:43110/Talk.ZeroNetwork.bit/?Topic:1572919722_14g2gXnsZdEPShFJkGdh5W3eGXmKzqW6F8

Steps to reproduce:

http://127.0.0.1:43110/Talk.ZeroNetwork.bit/?Topic:1572919722_14g2gXnsZdEPShFJkGdh5W3eGXmKzqW6F8

Observed Results:

debug.log

Expected Results:

It to just work as it used to work prior

Most helpful comment

alright, let me try it in a few hours (because i goofed this morning and didnt realize it so i cant work in it at the moment)

All 13 comments

Add zero.example.com to config to ui_host, like this:

[global] 
... 
ui_host =
 zero.example.com

@imachug

[zeronet@archlinux ZeroNet]$ ./ZeroNet.sh
- Starting ZeroNet...
[07:40:56] - Libsecpk256k1 loaded: CompiledLib in 0.040s
[07:40:56] - Version: 0.7.1 r4206, Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0], Gevent: 1.4.0
[07:40:56] - Creating FileServer....
[07:40:56] - Creating UiServer....
[07:40:56] - Removing old SSL certs...
[07:40:56] - Starting servers....
[07:40:56] Ui.UiServer --------------------------------------
[07:40:56] Ui.UiServer Web interface: http://192.168.0.115:43110/
[07:40:56] Ui.UiServer --------------------------------------
[07:40:56] TorManager Disabling Tor, because error while accessing Tor proxy at port 127.0.0.1:9050: No connection
[07:40:57] PeerPortchecker Checking port 12521 (ipv4) using checkPortchecker result: {'ip': <my ip>', 'opened': False} in 0.580s
[07:40:57] PeerPortchecker Trying to open port using UpnpPunch...
[07:40:57] PeerPortchecker Checking port 12521 (ipv6) using checkMyaddr result: {'ip': <my ip>', 'opened': False} in 0.905s
[07:40:58] PeerPortchecker Checking port 12521 (ipv4) using checkPortchecker result: {'ip': <my ip>', 'opened': False} in 0.469s
[07:40:58] ConnServer Server port opened ipv4: False, ipv6: False
[07:41:10] Ui.UiServer Added 192.168.0.115:43110 as allowed host
[07:41:11] Ui.UiServer Error 403: Invalid origin: https://zero.example.com 
[07:41:22] Ui.UiServer Error 403: Invalid origin: https://zero.example.com
^C[07:41:24] - Shutting down (reason: Keyboard interrupt)...
[07:41:24] ConnServer Closed port via upnp.
[07:41:24] - All server stopped
[global]
fileserver_port = 12521
ui_ip = 192.168.0.115
ui_host =
 zero.example.com

Still fails to work

I think that the check for origin happens here. Maybe the problem could be that proxy is accessed from port 80, but ZeroNet expects the different port so origins are not the same.

@imachug What do you think? What should be the value of HTTP_HOST env var and self.server.allowed_ws_origins?

@Merith-TK Can you (temporary) add few lines after this line to your ZeroNet source code that prints content of variabled origin_host, origin, host and self.server.allowed_ws_origins? That part should then look something like this:

            if origin:
                origin_host = origin.split("://", 1)[-1]
                if origin_host != host and origin_host not in self.server.allowed_ws_origins:
                    print("Origin host:", origin_host)
                    print("Origin:", origin)
                    print("Host:", host)
                    print("Allowed WS origins:", self.server.allowed_ws_origins)

                    ws.send(json.dumps({"error": "Invalid origin: %s" % origin}))
                    return self.error403("Invalid origin: %s" % origin)

Then paste log output here. This lines should be only for troubleshooting and you can remove them later.

My best guess is that ZeroNet doesn't like port change, hostname change and (possibly) protocol change happening at the same time. I would make CaddyServer set Host and Origin headers to http://127.0.0.1:43110.

that could be it, but i dont know how to modify headers in caddy yet, you got any ideas @imachug ?

They say proxy_header Origin "127.0.0.1:43110" (and the same for Host as well) would work.

alright, let me try it in a few hours (because i goofed this morning and didnt realize it so i cant work in it at the moment)

@imachug setting headers myself, failed (probably did it wrong)

@filips123

Origin host: zero.example.com
Origin: https://zero.example.com
Host: 192.168.0.115:43110
Allowed WS origins: set()
[16:07:33] Ui.UiServer Error 403: Invalid origin: https://zero.example.com

if you want the actual URL, zmail me @ [email protected] with proof of github ID

Can you show me your config please? I haven't worked with caddyserver before but I can help you to google, lol.

A)i think we have a reaction spammer

B)
```
zero.example.com { # set url, and then auto obtain tls cert

    basicauth / user pass # applies a auth popup to / with user and pass

    proxy / 192.168.0.115:43110 { # proxies that ip to /
            websocket # proxies websockets
    }
    log /opt/caddy/log/zero.log

}```

i think we have a reaction spammer

We know... at least he doesn't spam with comments.

B)

Have you tried adding proxy_header Origin "127.0.0.1:43110" after proxy line? Also add the same with Host instead of Origin.

@imachug that is not a valid config for Caddy and therefore caddy errs out and crashes

but that was not a bad idea and i got it to work!
https://caddyserver.com/v1/docs/proxy

i looked in the proxy setting docs, and found header_upstream name value

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DaniellMesquita picture DaniellMesquita  路  3Comments

iShift picture iShift  路  3Comments

jerry-wolf picture jerry-wolf  路  4Comments

yurivict picture yurivict  路  4Comments

blurHY picture blurHY  路  3Comments