Skip to content

added support for specifying Tor service host IP address #15

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

david-pettifor-nd
Copy link

Added optional parameter for specifying a host IP address, should the Tor service be running on a different host (defaults to 127.0.0.1). This IP address should not be a host name, as it is also used for the Controller class, which requires a valid IP address.

Added optional parameter for specifying a host IP address, should the Tor service be running on a different host (defaults to 127.0.0.1).  This IP address should not be a host name, as it is also used for the Controller class, which requires a valid IP address.
@HS-157
Copy link
Contributor

HS-157 commented Aug 20, 2023

You should change 127.0.0.1 to localhost in case the TOR service is running in IPv6.

@david-pettifor-nd
Copy link
Author

In testing, the TOR Controller library used in stem failed to recognize localhost as a valid IP address (see: https://github.com/torproject/stem/blob/master/stem/control.py#L1077C123-L1077C123) because the host address passed in apparently needs to be valid for both IPv4 and IPv6. I would also like to see the Controller accept hostnames rather than requiring IP addresses as this would make it easier for docker deployment.

@HS-157
Copy link
Contributor

HS-157 commented Aug 21, 2023

Oh ! I didn't see this problem with the method parameter.
There is a issue for this : torproject/stem#116
Thank you.

@deedy5
Copy link
Owner

deedy5 commented Aug 21, 2023

https://github.com/deedy5/requests_tor#advanced-usage
https://2019.www.torproject.org/docs/tor-manual.html.en#ControlPort
https://2019.www.torproject.org/docs/tor-manual.html.en#HashedControlPassword
If you need to connect to a remote ip, you must specify password for the new_id() function to work.

This password must be generated and added to the torrc file on the remote host to which you want to connect.

So we should also add a check that if tor_host != '127.0.0.1' then password cannot be None (and correct the Readme accordingly).

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.

3 participants