3

I recently decided to run an exit node on a VPS running the standard build of OpenBSD 5.5. Tor, which had no missing dependencies, was the first program I installed. I did so by simply downloading the source and following the build instructions. The only other program installed is a simple SSH login protector. However, when I run Tor using sudo tor --hush, the process remains a root process. This is despite the fact that the SSH login user non-root with sudo access through the wheel group.

Here's an example output of the start-up, which makes it explicit that it successfully binds to the desired ports:

$ sudo tor
Aug 19 07:29:43.103 [notice] Tor v0.2.4.23 (git-598c61362f1b3d3e) running on OpenBSD with Libevent 1.4.14b-stable and OpenSSL 1.0.1c.
Aug 19 07:29:43.105 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Aug 19 07:29:43.105 [notice] Read configuration file "/usr/local/etc/tor/torrc".
Aug 19 07:29:43.115 [notice] Opening Control listener on 127.0.0.1:9052
Aug 19 07:29:43.116 [notice] Opening OR listener on 0.0.0.0:443
Aug 19 07:29:43.116 [notice] Opening Directory listener on 0.0.0.0:80

I'm not sure if this is relevant, but the data directory being created is /home/my_user/.tor.

Is this a known issue? It's odd, considering that (if I recall correctly) OpenBSD introduced privilege separation to the Unix community. Regardless, I took the server down, and won't restart it until I solve this issue.

Anecdotally, I'm also trying to figure out where the log files are, as /var/log/tor doesn't exist. That's an easier issue, though.

1 Answer 1

2

If you run it with sudo, of course it will be run as root. It also makes sense that it uses your HOME directory. Doing a sudo echo $HOME explains why. So this doesn't appear to be wrong, but expected behavior.

What you probably want to do is have a torrc and set things like logging using the Log option and User <username>, so privileges are dropped to the specified user.

OpenBSD appears to patch the torrc sample config in a way that logs are handled via syslog.

4
  • I got it working by explicitly creating a openbsd-tor user (to complement Debian's debian-tor) and setting User openbsd-tor in the config file. It's odd, though, that privilege separation comes default in Debian but not in OpenBSD. That seems like something that should eventually be fixed.
    – Mike
    Aug 26, 2014 at 16:56
  • 1
    It is fixed, and has been for a while, as far as I can tell. The OpenBSD pkg for Tor runs it as User _tor
    – rdump
    Aug 29, 2014 at 17:49
  • @rdump - That wasn't my experience. It stayed as root for me. Do you have a link to a bug ticket or a developer discussion about this? I built mine from source, which may have caused the difference.
    – Mike
    Sep 16, 2014 at 14:10
  • See the patch in /usr/ports/net/tor/patches/patch-src_config_torrc_sample_in It enables: Log notice syslog RunAsDaemon 1 DataDirectory /var/tor User _tor See also /usr/ports/net/tor/Makefile It specifies: CONFIGURE_ARGS= --with-ssl-dir=/usr \ --disable-gcc-hardening among other things You should be able to apply those changes in a manual build, create the pseudouser _tor, and get the same effects.
    – rdump
    Sep 16, 2014 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .