1. Enable Automatic Software Updates

One of the most important things to keep your relay secure is to install security updates timely and ideally automatically so you can not forget about it. Follow the instructions to enable automatic software updates for your operating system.

2. Install Tor

# pkg_add tor

If you want to install a newer version of the tor package, you can use M:Tier's binary packages:

# ftp https://stable.mtier.org/openup

Right after fetching openup you can run it to sync M:Tier's repository and update your packages; it's an alternative to pkg_add -u.

Here is how you proceed with these steps:

# ./openup

3. Install obfs4proxy

# pkg_add obfs4proxy

4. Edit your Tor config file, usually located at /etc/tor/torrc and replace its content with:

RunAsDaemon 1
BridgeRelay 1

# Replace "TODO1" with a Tor port of your choice.  This port must be externally
# reachable.  Avoid port 9001 because it's commonly associated with Tor and
# censors may be scanning the Internet for this port.

ServerTransportPlugin obfs4 exec /usr/local/bin/obfs4proxy

# Replace "TODO2" with an obfs4 port of your choice.  This port must be
# externally reachable and must be different from the one specified for ORPort.
# Avoid port 9001 because it's commonly associated with
# Tor and censors may be scanning the Internet for this port.
ServerTransportListenAddr obfs4

# Local communication port between Tor and obfs4.  Always set this to "auto".
# "Ext" means "extended", not "external".  Don't try to set a specific port
# number, nor listen on
ExtORPort auto

# Replace "<address@email.com>" with your email address so we can contact you if
# there are problems with your bridge.  This is optional but encouraged.
ContactInfo <address@email.com>

# Pick a nickname that you like for your bridge.  This is optional.
Nickname PickANickname
DataDirectory /var/tor
User          _tor

Don't forget to change the ORPort, ServerTransportListenAddr, ContactInfo, and Nickname options.

  • Note that both Tor's OR port and its obfs4 port must be reachable. If your bridge is behind a firewall or NAT, make sure to open both ports. You can use our reachability test to see if your obfs4 port is reachable from the Internet.

5. Change openfiles-max and maxfiles

By default, OpenBSD maintains a rather low limit on the maximum number of open files for a process. For a daemon such as Tor's, that opens a connection to each and every other relay (currently around 7000 relays), these limits should be raised.

Append the following section to /etc/login.conf:


OpenBSD also stores a kernel-level file descriptor limit in the sysctl variable kern.maxfiles.

Increase it from the default of 7030 to 16000:

# echo "kern.maxfiles=16000" >> /etc/sysctl.conf
# sysctl kern.maxfiles=16000

6. Start Tor

# rcctl enable tor
# rcctl start tor

7. Monitor your logs (usually in your syslog)

To confirm your bridge is running with no issues, you should see something like this:

[notice] Your Tor server's identity key fingerprint is '<NICKNAME> <FINGERPRINT>'
[notice] Your Tor bridge's hashed identity key fingerprint is '<NICKNAME> <HASHED FINGERPRINT>'
[notice] Registered server transport 'obfs4' at '[::]:46396'
[notice] Tor has successfully opened a circuit. Looks like client functionality is working.
[notice] Bootstrapped 100%: Done
[notice] Now checking whether ORPort <redacted>:3818 is reachable... (this may take up to 20 minutes -- look for log messages indicating success)
[notice] Self-testing indicates your ORPort is reachable from the outside. Excellent. Publishing server descriptor.

8. Final Notes

If you are having trouble setting up your bridge, have a look at our help section. If your bridge is now running, check out the post-install notes.