less ./b00010111/blog

Arch Linux - Raspberry Pi => New Tor Relay

It seems my recent tor relay setup is broken, cause the corresponding tor package for wheezy keeps throwing sec faults.
My new setup is still with the Raspberry pi but I moved from wheezy to Arch Linux now.

The setup process is nearly the same as for the setup with wheezy:
Download the current version of Arch Linux for Raspberry Pi from the download page, extract the archive and copy it to your SD card.

1
2
3
4
5
6
unzip ArchLinuxARM-2014.01-rpi.img.zip
Archive:  ArchLinuxARM-2014.01-rpi.img.zip
  inflating: ArchLinuxARM-2014.01-rpi.img
.
.
sudo dd bs=1M if=ArchLinuxARM-2014.01-rpi.img of=/dev/sdb

Again you can use “df -h” before and after you connected you SD card to figure out which path you have to use for the “of” parameter of the “dd” command.
After copying is completed just insert the SD card into the Raspberry Pi, connect the network cable and power it up. Again you will be able to find out the IP address by looking at you DCHP server or you simply guess it based on your own IP address. We again assume the IP to be 192.168.1.139. connect to it and change the password.

1
2
3
4
5
6
7
ssh root@192.168.1.139
# default password: root
# accept the host key
.
.
passwd root
# follow on screen instructions.

Next steps on the way to a running tor relay are updating the system and installing tor.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pacman -Syu
# wait until command is finished and follow on screen instructions
.
.
pacman -S tor
# same deal as above... follow instructions and wait until finished
.
.
#adding user for tor
useradd arch-tor
#change password, use some random here, we don't need it.
passwd arch-tor
.
#restart the Pi
systemctl reboot

After reboot is finished and you have reconnected with your new root password it is time to edit the tor config file. Open the file “/etc/tor/torrc” with you favourite editor and configure at least these settings according to your needs:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
RunAsDaemon 1 #makes Tor run as a deamon
ORPort 443
DirPort 80
ExitPolicy reject *:* # to be a node only
Nickname XXX # choose something here
RelayBandwidthRate 100 KB # Throttle traffic to 100KB/s (800Kbps)
RelayBandwidthBurst 200 KB # But allow bursts up to 200KB/s (1600Kbps)
ContactInfo XXX # enter your contact infos here
User arch-tor
DataDirectory /var/lib/tor
Address XXX # enter the external IP or the domain for your tor relay here 
## Send all messages of level 'notice' or higher to /var/log/tor/notices.log
#Log notice file /torlog/notices.log
## Send every possible message to /var/log/tor/debug.log
#Log debug file /torlog/debug.log

I recommend to have the “notices.log” enabled until you have seen your tor relay has successfully start up. After you are sure your relay runs correctly I recommend to disable logging completely.

Now for the final step we want to make sure that tor restarts after a reboot automatically. Therefore we need to edit the file “/usr/lib/systemd/system/tor.service” and correct the settings:

1
2
3
[Service]
User=root
Type=forking

After saving the file you need to run the following command to start tor after a reboot:

1
systemctl enable tor

Finally create a directory for the log-file according to your config and make sure it is read- and writable by the user “arch-tor”.

1
2
mkdir /torlog
chown arch-tor /torlog/

To test your new setup restart again and check the tor notice log (/torlog/notices.log) for errors or success. If you see warnings according to your system-clock in the notices log ignore them; tor will start correctly after your clock got synced. If your tor relay started correctly don’t forget to edit the config and remove logging. Restart again and you are up and contributing.