As the currently available OpenSolaris packages of TOR are outdated, I compiled the sources and documented what to do.
First we need to install some packages which are required to download and compile TOR:
root@test:~# pkg install wget gcc-43 system/library/math/header-math libevent Packages to install: 18 Create boot environment: No DOWNLOAD PKGS FILES XFER (MB) Completed 18/18 3066/3066 70.7/70.7 PHASE ACTIONS Install Phase 4013/4013 PHASE ITEMS Package State Update Phase 18/18 Image State Update Phase 2/2 root@test:~# PATH=$PATH:/usr/gcc/4.3/bin
The next step is to create a user for TOR (we don’t want to run it as root).
root@test:~# mkdir -p /export/home root@test:~# useradd -d /export/home/tor -s /usr/bin/false -m tor
Then we need to download and unpack the current TOR version from https://www.torproject.org/download/download.html.en.
root@test:~# wget https://www.torproject.org/dist/tor-0.2.2.35.tar.gz --2012-02-06 00:46:36-- https://www.torproject.org/dist/tor-0.2.2.35.tar.gz Resolving www.torproject.org (www.torproject.org)... 184.108.40.206, 220.127.116.11, 18.104.22.168 Connecting to www.torproject.org (www.torproject.org)|22.214.171.124|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2787536 (2.7M) [application/x-gzip] Saving to: `tor-0.2.2.35.tar.gz' 100%[==============================================>] 2,787,536 2.20M/s in 1.2s 2012-02-06 00:46:56 (224 KB/s) - `tor-0.2.2.35.tar.gz' saved [2787536/2787536] root@test:~# tar xf tor-0.2.2.35.tar.gz root@test:~# cd tor-0.2.2.35 root@test:~/tor-0.2.2.35#
Now we can configure and build tor.
root@test:~/tor-0.2.2.35# ./configure --prefix=/opt/tor checking for a BSD-compatible install... ./install-sh -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... ./install-sh -c -d checking for gawk... no ... root@test:~/tor-0.2.2.35# make make all-recursive make: Entering directory `/root/tor-0.2.2.35' Making all in src make: Entering directory `/root/tor-0.2.2.35/src' ... root@test:~/tor-0.2.2.35# make install Making install in src make: Entering directory `/root/tor-0.2.2.35/src' Making install in common make: Entering directory `/root/tor-0.2.2.35/src/common' make: Entering directory `/root/tor-0.2.2.35/src/common' ... root@test:~/tor-0.2.2.35# cd /opt/tor/ root@test:/opt/tor#
There is a sample configuration available which can be used as a base for further modification.
oot@test233:/opt/tor# cd etc/tor root@test:/opt/tor/etc/tor# cp torrc.sample torrc
Have a look at the manual for further information.
Finally we have to create the data and log directory which are configured in the config.
Create data-directory root@test:/opt/tor# mkdir -p /opt/tor/var/tor root@test:/opt/tor# chown tor /opt/tor/var/tor Create log-directory root@test:~# mkdir /var/log/tor root@test:~# chmod 777 /var/log/tor
TOR as Solaris Service
The final step is to integrate TOR into Solaris’ Service Management Facility (smf). This requires a XML config file which describes the TOR-service.
The required file can be found here:
root@test:/opt/tor# cd /tmp/ root@test:/tmp# wget http://www.dev-eth0.de/wp-content/uploads/2012/02/tor.xml root@test:/tmp# svccfg import -V tor.xml
Now we have installed TOR as a Solaris Service and can start and stop it with the svcadm command and check it’s status with svcs.
svcadm enable tor svcadm disable tor
The following commands will start tor and check if everything is ok and running.
root@test:/tmp# svcadm enable tor root@test:~# svcs -x tor svc:/network/tor:default (Tor Relay Daemon) State: online since Mon Feb 6 01:29:18 2012 See: tor(1M) See: /var/svc/log/network-tor:default.log Impact: None.
Finally you can check the tor logfile which should contain a line similar to
Feb 06 02:00:44.494 [notice] Self-testing indicates your ORPort is reachable from the outside. Excellent. Publishing server descriptor.