Skip to content

Tor null auth and listen fixes #2490

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

Merged

Conversation

aakselrod
Copy link
Contributor

@aakselrod aakselrod commented Jan 17, 2019

This PR should fix #2388 and #2176 in the following ways:

  • allowing NULL authentication when attempting to create a hidden service automatically
  • when automatic hidden service configuration is disabled, defaulting to listening on localhost and allowing manual override for manual or alternative hidden service configuration

This allows lnd to work better in environments where the Tor daemon lives on a different machine, such as Whonix or OnionPi, and where certain Tor control protocol requests and responses are filtered.

Fixes #2388
Fixes #2176

@aakselrod aakselrod requested a review from wpaulino January 17, 2019 05:26
@qubenix
Copy link

qubenix commented Jan 17, 2019

Awesome of you to work on this! I'm just testing this out on Whonix.

For me the null auth fix worked, but I'm still running into an issue listening on something other than localhost.

user@host:~$ lnd
lnd must *only* be listening on localhost when running with Tor inbound support enabled

I think it may have to do with these lines: https://github.com/lightningnetwork/lnd/blob/570b60e75b2822fc737b46a223c944ceadfedaab/config.go#L950-L962

@Roasbeef Roasbeef added enhancement Improvements to existing features / behaviour security General label for issues/PRs related to the security of the software tor bug fix P3 might get fixed, nice to have labels Jan 18, 2019
@Roasbeef Roasbeef added this to the 0.6 milestone Jan 18, 2019
@aakselrod
Copy link
Contributor Author

@qubenix, I think you might be correct. You can work around it by manually configuring the hidden service for now, and I'll fix the other issue momentarily.

This change allows the Tor controller to request hidden service
configuration over unauthenticated Tor control ports, such as used
in Whonix.
When Tor is enabled, this change allows manual hidden service
configuration by defaulting to listening for p2p connections on
the loopback address. It also allows overriding this manually
for situations where the Tor daemon is running on another machine,
such as when using Whonix or OnionPi-like systems.
@aakselrod aakselrod force-pushed the tor-null-auth-and-listen-fixes branch from 570b60e to 66a1502 Compare January 19, 2019 05:45
@aakselrod
Copy link
Contributor Author

I've made the fix and rebased. I tested this on my Whonix system with a brand new lnd installation and was able to successfully auto-create a v3 service (with a new onion-grater merge file for the lnd request) while listening on eth0.

@qubenix
Copy link

qubenix commented Jan 19, 2019

Tested ACK: 288870f 66a1502

@NicolasDorier
Copy link
Contributor

Concept ACK, I needed this.

if len(cfg.RawListeners) == 0 {
addr := fmt.Sprintf(":%d", defaultPeerPort)
if cfg.Tor.Active {
addr = fmt.Sprintf("localhost:%d", defaultPeerPort)
Copy link
Contributor

@NicolasDorier NicolasDorier Mar 14, 2019

Choose a reason for hiding this comment

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

I don't think it makes sense.

I want to use Tor with LND as an alternative way for people to connect to me, not as an exclusive way.

Copy link
Contributor

Choose a reason for hiding this comment

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

This will only happen if you don't explicitly set the listen flag. It can be overridden.

@tzarebczan
Copy link

I'm running into this same problem...anyone have a windows build to test this out?

Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

LGTM 🎲

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 💣

@Roasbeef Roasbeef merged commit b4a1024 into lightningnetwork:master Mar 15, 2019
@tzarebczan
Copy link

Awesome @Roasbeef, can't wait to try this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix enhancement Improvements to existing features / behaviour P3 might get fixed, nice to have security General label for issues/PRs related to the security of the software tor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support unauthenticated Tor control port Can't connect to onion nodes when using remote Tor
6 participants