firefart / zwiebelproxy

web based tor proxy
GNU General Public License v3.0
10 stars 3 forks source link

invalid domain #7

Closed lorelolorelo closed 1 year ago

lorelolorelo commented 1 year ago

Hey @firefart i wonder if you can help me with this issue.

zwiebelproxy# ./zwiebelproxy 
DEBU[0000] DEBUG mode enabled                           
INFO[0000] Starting server on 0.0.0.0:8089              
ERRO[0004] invalid domain cebolla.lol                   
2022/12/19 21:14:36 [es1629372395/BVN3bpsysf-000001] "GET http://cebolla.lol/favicon.ico HTTP/1.1" from  - 400 12B in 122.175µs

On the webside i got this other: Bad Request Thanks!

firefart commented 1 year ago

https://github.com/firefart/zwiebelproxy/blob/563eb904adab0a9a5f67c5d6ca6bc2d20d12d624/main.go#L142

the domain you call needs to end in the configured domain.

so if your domain is test.com and you want to surf to test.onion you need to surf to test.onion.test.com

lorelolorelo commented 1 year ago

Thank you very much for the answer, I think I'm going a little crazy and I apologize in advance.

Basically what I did is configure an nginx as you describe with the example adjusting it to my domain.

then I download the code with git clone blah blah blah...

and I generate an .env file with the following content:

ZWIEBEL_DEBUG=true
ZWIEBEL_DOMAIN=onion.lol
ZWIEBEL_HOST=0.0.0.0:8000
ZWIEBEL_TOR=socks5://127.0.0.1:9050

I compile and run zwiebelproxy, this doesn't generate any error. And when I access via chrome to onion.lol I see the following in the console:

DEBU[0000] DEBUG mode enabled
INFO[0000] Starting server on 0.0.0.0:8000
ERROR[0005] invalid domain onion.lol
2022/12/21 12:02:41 [tov/NW91KW3wym-000001] "GET http://cebolla.lol/ HTTP/1.0" from 0.0.0.0 - 400 12B in 74.436µs
ERROR[0005] invalid domain onion.lol
2022/12/21 12:02:41 [tov/NW91KW3wym-000002] "GET http://cebolla.lol/favicon.ico HTTP/1.0" from 0.0.0.0 - 400 12B in 96.795µs

And in the browser the message: bad request.

Now if I try to accesshttps://protonmailrmez3lotccipshtkleegetolb73fuirgj7r4o4vfu7ozyd.cebolla.lol/

Nothing happens, neither in the browser nor in the console.

I've also tried docker-compose deploying, but it doesn't seem to like the host_ip option.

docker compose up
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.tor.ports contains unsupported option: 'host_ip'

My apologies for reopening the issue.

firefart commented 1 year ago

Hi, I've added a template to be more precise about the errors. When you call the main ZIEBEL_DOMAIN in your browser it failed because the main domain was not handled in the code, I now display the default template.

The protonmail link currently times out, that's why you don't see any content. With the new version the error is displayed in the browser. On the CLI you should at least see the incoming request. If you don't see it there your DNS might be not configured correctly.

lorelolorelo commented 1 year ago

Awesome thanks! @firefart going to check your last commit!