Skip to content

Conversation

@3nprob
Copy link

@3nprob 3nprob commented Sep 24, 2025

  • add configuration for tor_control_password for onion services
    • if this is configured, it will use HashedControlPassword instead of CookieAuthentication for the tor control port.

Resolves:

Copy link
Contributor

@roshii roshii left a comment

Choose a reason for hiding this comment

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

Suggesting a few changes before merging. New functionality should be covered by unit tests too.

@3nprob 3nprob force-pushed the tor-control-pwauth branch 2 times, most recently from b7dd40e to b320752 Compare October 28, 2025 20:08
Comment on lines +188 to +191
if self.tor_control_password is None:
d = txtorcon.connect(reactor, control_endpoint)
else:
d = txtorcon.connect(reactor, control_endpoint, password_function=lambda : self.tor_control_password)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if self.tor_control_password is None:
d = txtorcon.connect(reactor, control_endpoint)
else:
d = txtorcon.connect(reactor, control_endpoint, password_function=lambda : self.tor_control_password)
password_function = lambda : self.tor_control_password if self.tor_control_password else None
d = txtorcon.connect(reactor, control_endpoint, password_function=password_function)

Copy link
Author

Choose a reason for hiding this comment

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

I find the former more readable. If maintainer prefer we can go with suggestion.

@3nprob 3nprob force-pushed the tor-control-pwauth branch from 3c21795 to 6a8db20 Compare November 1, 2025 02:21
3np and others added 4 commits November 1, 2025 02:29
- add configuration for tor_control_password for onion services
Co-authored-by: roshii <6266997+roshii@users.noreply.github.com>
Co-authored-by: roshii <6266997+roshii@users.noreply.github.com>
@3nprob 3nprob force-pushed the tor-control-pwauth branch from 6a8db20 to 408124a Compare November 1, 2025 02:30
@3nprob 3nprob requested a review from roshii November 1, 2025 03:35
@3nprob 3nprob mentioned this pull request Nov 1, 2025
Copy link
Contributor

@roshii roshii left a comment

Choose a reason for hiding this comment

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

this looks overall ok, but needs to be covered by unit tests. we want to assess whether it behaves as intended: authenticating via password when provided in config, and via cookie when not.

@3nprob
Copy link
Author

3nprob commented Nov 1, 2025

this looks overall ok, but needs to be covered by unit tests. we want to assess whether it behaves as intended: authenticating via password when provided in config, and via cookie when not.

That sounds more like an integration test than a unit test?

Currently AFAICT no part of the tor configuration (including host and port) are currently tested this way and while I agree testing for all of them would be good, it requires significant new testing setup that IMO should be done separately and hopefully not be a blocker for supporting remote tor node.

@roshii
Copy link
Contributor

roshii commented Nov 2, 2025

That sounds more like an integration test than a unit test?

should be unit tests.

  1. making sure config reads and loads password when set (may already be covered somehow)
  2. making sure service calls tor with intended config -- tor should be mocked here, we just it to assessed it'd called as expected

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