1. 啟用軟體自動更新

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. 設定 pkg_add

目前版本的 NetBSD 作業系統可以設定為使用pkgin,這是一款致力在像aptyum一樣用於管理 pkgsrc 二進位套件的軟體。我們不會在這裡討論它的設置,而是選擇使用預設的pkg_add

# echo "PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/$(uname -r)/All" > /etc/pkg_install.conf

3. 安裝 Tor

# pkg_add tor

4. 安裝 obfs4proxy

# pkg_add install obfs4proxy

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

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.
ORPort TODO1

ServerTransportPlugin obfs4 exec /usr/pkg/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 0.0.0.0:TODO2

# 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 0.0.0.0.
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

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

  • 請注意,Tor 的 OR 端口及其 obfs4 端口都必須可通。 如果您的橋接位於防火牆或 NAT 之後,請確保打開這兩個端口。可利用可達性測試 來查看從網際網路可否訪問您的 obfs4 端口。

6. 啟用 Tor

# ln -sf /usr/pkg/share/examples/rc.d/tor /etc/rc.d/tor
# echo "tor=YES" >> /etc/rc.conf
# /etc/rc.d/tor start

7. 監看歷程記錄

To confirm your bridge is running with no issues, you should see something like this (usually in /var/log/tor/log or /var/log/syslog):

[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. 最後備註

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.