Skip to content
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

Fixes tor proxy redirection #146

Merged
merged 1 commit into from
Nov 12, 2022

Conversation

sr-gi
Copy link
Member

@sr-gi sr-gi commented Nov 11, 2022

Traffic routed trough Tor was being redirected to localhost indistinguishably of whether the public http API was being offered there or not. This made the tower unavailable (trough Tor) when it was being offered both in clearnet and Tor.

@mariocynicys
Copy link
Collaborator

Well, it makes sense to use the bind address + port of the public API.
But in what case did something like this (tower unavailable through tor) happen? It's always the case that the tor interface is running in the same machine as the public API (or you tried redirect tor traffic to another tower?).

@sr-gi
Copy link
Member Author

sr-gi commented Nov 12, 2022

Well, it makes sense to use the bind address + port of the public API. But in what case did something like this (tower unavailable through tor) happen? It's always the case that the tor interface is running in the same machine as the public API (or you tried redirect tor traffic to another tower?).

This relates to how the Tor node tries to redirect the Tor traffic to the tower backend. Prior to this, our code was assuming that, if --torsupport was enabled, the clearnet API was offered in localhost, which is not true (notice the hardcoded 127.0.0.1 in the diff for where the http_api_endpoint is hosted). What tor.rs was doing was, basically, analogous to this (source):

HiddenServicePort 80 127.0.0.1:80

The HiddenServicePort line specifies a virtual port (that is, the port that people visiting your Onion Service will be using), and in the above case it says that any traffic incoming to port 80 of your Onion Service should be redirected to 127.0.0.1:80 (which is where the web server from step 1 is listening).

But, as stated, the HTTP API was not being offered there.

Copy link
Collaborator

@mariocynicys mariocynicys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Traffic routed trough Tor was being redirected to localhost indistinguishably of whether
the public http API was being offered there or not. This made the tower unavailable
(trough Tor) when it was being offered both in clearnet and Tor.
@sr-gi sr-gi force-pushed the fix-end-proxy-redirection branch from 7987c44 to ecaba32 Compare November 12, 2022 14:33
@sr-gi sr-gi merged commit eef55ad into talaia-labs:master Nov 12, 2022
@sr-gi
Copy link
Member Author

sr-gi commented Nov 12, 2022

@tee8z you may be interested in this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants