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

default to /var/run/tor/control and /var/run/tor/control.authcookie #11

Closed
adrelanos opened this issue Jul 3, 2016 · 7 comments
Closed

default to /var/run/tor/control and /var/run/tor/control.authcookie #11

adrelanos opened this issue Jul 3, 2016 · 7 comments

Comments

Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
@adrelanos
Copy link
Contributor

@adrelanos adrelanos commented Jul 3, 2016

How does corridor-data open a Tor control connection?

If $TOR_CONTROL_SOCKET is nonempty (e.g. /var/run/tor/control), use it. Otherwise, connect to $TOR_CONTROL_HOST (defaults to localhost) on port $TOR_CONTROL_PORT (defaults to 9051).

If $TOR_CONTROL_COOKIE_AUTH_FILE is nonempty (e.g. /var/run/tor/control.authcookie), use it. Otherwise, pass $TOR_CONTROL_PASSWD (defaults to an empty password).

Defaulting to localhost:9051 with an empty Tor control password is not great. I doubt any distribution / user has such settings set.

I guess defaulting to /var/run/tor/control and /var/run/tor/control.authcookie has a higher chance of working for a bigger amount of people out of the box. By now, all distributions should have updated to providing Tor control cookies authentication by default?

Implementing this ticket would ease Debian packaging. (#10) Otherwise the Debian packaging would have to add a patch to add a "debian specific" configuration file /etc/corridor.conf/50-debian.conf.

TOR_CONTROL_SOCKET=/var/run/tor/control
TOR_CONTROL_COOKIE_AUTH_FILE=/var/run/tor/control.authcookie
@rustybird
Copy link
Owner

@rustybird rustybird commented Jul 4, 2016

Defaulting to localhost:9051 with an empty Tor control password is not great.

Agreed. I wanted to use cookie authentication from the beginning, but the lack of standardized paths is off-putting. For example, using the Debian specific /var/run/tor/control.authcookie instead of tor's (sort of) default /var/lib/tor/control_auth_cookie doesn't seem right. It's true, the /var/run tmpfs is a more appropriate place for ephemeral files, but this should be fixed upstream maybe?

@adrelanos
Copy link
Contributor Author

@adrelanos adrelanos commented Jul 4, 2016

Rusty Bird:

Defaulting to localhost:9051 with an empty Tor control password is
not great.

Agreed. I wanted to use cookie authentication from the beginning, but
the lack of standardized paths is off-putting. For example, using the
Debian specific /var/run/tor/control.authcookie instead of tor's
(sort of) default /var/lib/tor/control_auth_cookie doesn't seem
right. It's true, the /var/run tmpfs is a more appropriate place
for ephemeral files, but this should be fixed upstream maybe?

It surely should be fixed upstream if it was an upstream issue. I was
going to create a ticket, but no need. I doubt Tor is using
"/var/lib/tor/control" by The Tor Project default. The following search
query rarely shows any results:
site:torproject.org "/var/lib/tor/control"

@rustybird
Copy link
Owner

@rustybird rustybird commented Jul 5, 2016

I doubt Tor is using "/var/lib/tor/control" by The Tor Project default

It's only ControlAuthCookie, which effectively defaults to <tor data directory>/control_auth_cookie:

https://gitweb.torproject.org/tor.git/tree/src/or/control.c?id=8917c4f19fccbe26ccea78b7fdb6d4730ef017c4#n6344

Then it can be enabled using CookieAuthentication 1. (It seems unfortunate that ControlSocket doesn't use the same logic; here there's no default, and setting the path is the same as enabling it. But the exact mechanism is less important than somehow establishing a convention of where the file is supposed to go.)

@adrelanos
Copy link
Contributor Author

@adrelanos adrelanos commented Jul 5, 2016

The Tor Project upstream bug report:
set Tor Control Authcookie default file location from /var/lib/tor/control.authcookie to /var/run/tor/control.authcookie
https://trac.torproject.org/projects/tor/ticket/19572

@adrelanos
Copy link
Contributor Author

@adrelanos adrelanos commented Jul 5, 2016

Can you implement this ticket please? Or do you wish to wait until this gets fixed upstream?

Or should I send a pull request for a Debian specific configuration snippet?

(Untested for now.)

if test -f /etc/os-release ; then
   . /etc/os-release
   if [ "$ID" = "debian" ]; then
      TOR_CONTROL_SOCKET=/var/run/tor/control
      TOR_CONTROL_COOKIE_AUTH_FILE=/var/run/tor/control.authcookie
   fi
fi

@rustybird
Copy link
Owner

@rustybird rustybird commented Jul 5, 2016

Otherwise the Debian packaging would have to add a patch to add a "debian specific" configuration file /etc/corridor.conf/50-debian.conf.

Can you do it this way for now? I'd like to at least wait for a response from upstream (though not necessarily until they implement it).

adrelanos added a commit to adrelanos/corridor that referenced this issue Jul 5, 2016
@adrelanos
Copy link
Contributor Author

@adrelanos adrelanos commented Jul 5, 2016

Yes. Done.

@rustybird rustybird closed this in c8bc843 Jul 13, 2016
adrelanos added a commit to adrelanos/corridor that referenced this issue Jul 18, 2016
since rustybird#11 was fixed upstream in corridor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment