Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
obfs4 网桥设置:debian
#1
本指南将帮助您设置 obfs4 网桥,以帮助受审查的用户连接到 Tor 网络。要求是:

  1. 24/7 互联网连接
  2. 能够向 Internet 公开 TCP 端口(确保 NAT 不会妨碍)

注 1:如果您运行的平台未在此页面列出,您可以从源代码编译 obfs4。
注 2:如果您计划将现有的非桥接中继转变为桥接中继,建议更改 IP 地址、名称和指纹,以避免容易被 ISP 或政府发现和列入黑名单。

1.启用自动软件更新

确保中继安全的最重要的事情之一是及时安装安全更新,最好是自动安装,这样您就不会忘记它。按照说明为您的操作系统启用自动软件更新。

2.配置Tor项目的存储库

建议为 Debian/Ubuntu 配置 Tor 项目的软件包存储库,并在支持门户上进行记录。请先按照这些说明进行操作,然后再继续。

注意:Ubuntu 用户需要从 Tor 项目的存储库获取 Tor。

3.安装Tor

确保在安装包之前更新包数据库,然后调用apt安装它:

Code:
# apt update # apt install tor

4.安装obfs4proxy

在Debian上,最新版本的obfs4proxy软件包可在 stable-backports 中找到。默认情况下,不会安装反向移植软件包,因此要安装最新版本,obfs4proxy您需要使用以下命令sudo apt install -t bullseye-backports obfs4proxy或使用与您将放置在/etc/apt/preferences.d/obfs4proxy.pref.

Code:
Explanation: tor meta, always run latest version of obfs4proxy Package: obfs4proxy Pin: release a=bullseye-backports Pin-Priority: 500

在Ubuntu上,bionic、cosmic、disco、eoan 和 focus 都有该软件包。如果您正在运行其中任何一个,sudo apt-get install obfs4proxy应该可以工作。

如果没有,您可以从源代码构建它。

5. 编辑您的 Tor 配置文件(通常位于)/etc/tor/torrc并将其内容替换为:

Code:
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/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

不要忘记更改ORPort、ServerTransportListenAddr、ContactInfo和Nickname选项。

如果您决定使用小于 1024 的固定 obfs4 端口(例如 80 或 443),则需要为 obfs4 提供将CAP_NET_BIND_SERVICE端口与非 root 用户绑定的功能:

Code:
sudo setcap cap_net_bind_service=+ep /usr/bin/obfs4proxy

要解决 systemd 强化问题,您还需要NoNewPrivileges=no设置/lib/systemd/system/tor@default.service然后/lib/systemd/system/tor@.service运行systemctl daemon-reload。更多详情请参见票证18356。

请注意,Tor 的 OR 端口及其 obfs4 端口都必须可达。如果您的网桥位于防火墙或 NAT 后面,请确保打开这两个端口。您可以使用我们的可达性测试来查看您的 obfs4 端口是否可以从 Internet 访问。

6. 重新启动 Tor

启用并启动tor:

Code:
# systemctl enable --now tor.service

或者如果它已经在运行,请重新启动它,以便配置生效:

Code:
# systemctl restart tor.service

7.监控你的日志

要确认您的网桥正在正常运行,您应该看到类似这样的内容(通常在/var/log/syslog或 run中# journalctl -e -u tor@default):

Code:
[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.
默认联系方式为telegram,需要微信号请留言。
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  为什么以及如何在 Debian 中启用 Tor 软件包存储库? netflix 0 367 08-04-2023, 01:43 PM
Last Post: netflix
  Debian 和 Tor 服务可作为洋葱服务使用 netflix 0 440 08-04-2023, 12:57 PM
Last Post: netflix
  有目的地构建:Debian 中的 Puppet netflix 0 386 08-04-2023, 12:52 PM
Last Post: netflix

Forum Jump:


Users browsing this thread: 1 Guest(s)