User Tools

Site Tools


Sidebar

Translations of this page:

en:vps-scripts

Scripts for Installing Tor bridges/relays in BSD VPSes

We will collect scripts here that might be useful as examples for those wishing to run Tor relays or bridges in BSD-based VPS setups.

OpenBSD

We have tried these scripts at Vultr, which supports OpenBSD as an option in their platform.

As of 2018-02-20 we have tried these on OpenBSD 6.2 running on the cheapest possible VPS setup in Vultr.

Bridge
  #!/bin/sh
  
  # Configure a Tor bridge under OpenBSD 6.2+
  
  # we pick a random nickname with a prefix of our choosing
  # for this example, it will be TORBSDbridgexxxx where the xxxx
  # will be four random letters
  
  # change this to suit your situation
  nickname="TORBSDbridge$(jot -r -c 40 a z | rs -g0 0 4 | head -1)"
  
  # install tor
  pkg_add tor
  
  # this will be a pure bridge: no SocksPort
  cat > /etc/tor/torrc <<__TORRC__
  SocksPort 0
  ORPort 9001
  Log notice syslog
  RunAsDaemon 1
  DataDirectory /var/tor
  ContactInfo torista <some.contact@email.address>
  Nickname ${nickname}
  User _tor
  ExitPolicy reject *:* # no exits allowed
  BridgeRelay 1
  PublishServerDescriptor 1
  __TORRC__
  
  # enable tor in the startup sequence - only need be done once
  rcctl enable tor
  
  # start the tor daemon - doesn't need to be done by hand again,
  # the rcctl enable tor command ensures it will happen at boot
  rcctl start tor
  
  echo Bridge ${nickname} is running
Relay
  #!/bin/sh
  
  # Configure a Tor relay under OpenBSD 6.2+
  
  # we pick a random nickname with a prefix of our choosing
  # for this example, it will be TORBSDrelayxxxx where the xxxx
  # will be four random letters
  
  # change this to suit your situation
  nickname="TORBSDrelay$(jot -r -c 40 a z | rs -g0 0 4 | head -1)"
  
  # install tor and obfs4proxy so our bridge can be used via
  # PluggableTransports as well as directly:
  pkg_add tor obfs4proxy
  
  # configure a pure relay - no SocksPort, non-exit
  cat > /etc/tor/torrc <<__TORRC__
  SocksPort 0
  ORPort 9001
  Log notice syslog
  RunAsDaemon 1
  DataDirectory /var/tor
  ContactInfo torista <some.contact@email.address>
  ServerTransportPlugin obfs4 exec /usr/local/bin/obfs4proxy
  Nickname ${nickname}
  User _tor
  ExitPolicy reject *:* # no exits allowed
  __TORRC__
  
  # enable tor in the startup sequence - only need be done once
  rcctl enable tor
  
  # start the tor daemon - doesn't need to be done by hand again,
  # the rcctl enable tor command ensures it will happen at boot
  rcctl start tor
  
  echo Relay ${nickname} is running
en/vps-scripts.txt · Last modified: 2018/02/20 17:12 by attila