We assume you read through the relay guide and technical considerations already. This subpage is for operators that want to turn on exiting on their relay.

Bạn nên thiết lập các rơ-le ngõ ra exit trên các máy chủ chuyên dụng cho mục đích này. Không nên cài đặt các rơ-le ngõ ra exit Tor trên các máy chủ mà bạn cũng cần cho các dịch vụ khác. Không mix trộn lẫn lưu lượng truy cập của riêng bạn với lưu lượng rơ-le chuyển tiếp ngõ ra exit của bạn.

Đảo ngược bản ghi DNS và WHOIS

Before turning your non-exit relay into an exit relay, ensure that you have set a reverse DNS record (PTR) to make it more obvious that this is a tor exit relay. Something like "tor-exit" in its name is a good start.

If your provider offers it, make sure your WHOIS record contains clear indications that this is a Tor exit relay.

Hãy sử dụng một tên miền domain mà bạn sở hữu. Hãy chắc chắn là không sử dụng torproject.org làm tên miền domain cho DNS đảo ngược (reverse DNS) của bạn.

Trang Thông báo ngõ ra Exit HTML

Để rõ ràng hơn rằng đây là một rơ-le chuyển tiếp ngõ ra Tor, bạn nên cung cấp một trang HTML thông báo ngõ ra Tor. Tor can do that for you: if your DirPort is on TCP port 80, you can make use of tor's DirPortFrontPage feature to display an HTML file on that port. File tệp tin này sẽ được hiển thị cho bất kỳ ai điều hướng trình duyệt của họ đến địa chỉ IP rơ-le chuyển tiếp ngõ ra Tor của bạn.

Nếu như bạn chưa thiết lập điều này trước đây, các dòng cấu hình sau đây phải được áp dụng cho torrc của bạn:

DirPort 80
DirPortFrontPage /path/to/html/file

We offer a sample Tor exit notice HTML file, but you might want to adjust it to your needs.

We also have a great blog post with some more tips for running an exit relay.

Note: DirPort is deprecated since Tor 0.4.6.5, and self-tests are no longe being showed on tor's logs. Để biết thêm thông tin, hãy đọc các ghi chú phát hànhphiếu ticket #40282.

Điều khoản ngõ ra Exit

Việc định nghĩa chính sách ngõ ra exit policy là một trong những phần quan trọng nhất của cấu hình rơ-le chuyển tiếp ngõ ra. The exit policy defines which destination ports you are willing to forward. This has an impact on the amount of abuse emails you will get (less ports means less abuse emails, but an exit relay allowing only few ports is also less useful). Nếu như bạn muốn trở thành một rơ-le chuyển tiếp ngõ ra hữu ích, bạn phải ít nhất cho phép các cổng Port điểm đích 80 và 443.

As a new exit relay - especially if you are new to your hoster - it is good to start with a reduced exit policy (to reduce the amount of abuse emails) and further open it up as you become more experienced. The reduced exit policy can be found on the Reduced Exit Policy wiki page.

Để trở thành một rơ-le chuyển tiếp ngõ ra, hãy thay đổi ExitRelay từ 0 thành 1 trong file tệp tin cấu hình torrc của bạn và khởi động lại daemon tor.

ExitRelay 1

DNS trên các Rơ-le chuyển tiếp ngõ ra Exit

Không giống như các kiểu loại rơ-le chuyển tiếp khác, các rơ-le ngõ ra exit cũng thực hiện phân giải DNS resolution cho các máy/ứng dụng khách Tor. Phân giải DNS trên các rơ-le ngõ ra exit là rất quan trọng đối với máy/ứng dụng khách Tor và nó phải đáng tin cậy và nhanh chóng thông qua việc sử dụng bộ nhớ đệm Caching.

  • DNS resolution can have a significant impact on the performance and reliability that your exit relay provides.
  • Don't use any of the big DNS resolvers (Google, OpenDNS, Quad9, Cloudflare, 4.2.2.1-6) as your primary or fallback DNS resolver to avoid centralization.
  • We recommend running a local caching and DNSSEC-validating resolver without using any forwarders (specific instructions follow below, for various operating systems).
    • If you want to add a second DNS resolver as a fallback to your /etc/resolv.conf configuration, choose a resolver within your autonomous system and make sure that it is not your first entry in that file (the first entry should be your local resolver).
    • If a local resolver like unbound is not an option for you, use a resolver that your provider runs in the same autonomous system (to find out if an IP address is in the same AS as your relay, you can look it up using bgp.he.net).
  • Avoid adding more than two resolvers to your /etc/resolv.conf file to limit AS-level exposure of DNS queries.
  • Ensure your local resolver does not use any outbound source IP address that is used by any Tor exit or non-exits, because it is not uncommon that Tor IPs are (temporarily) blocked and a blocked DNS resolver source IP address can have a broad impact. Đối với chương trình Unbound, bạn có thể sử dụng tùy chọn outgoing-interface để chỉ định các địa chỉ IP nguồn để liên hệ với các máy chủ DNS khác.
  • Large exit operators (>=100 Mbit/s) should make an effort to monitor and optimize Tor's DNS resolution timeout rate. Điều này có thể đạt được thông qua trình xuất exporter Prometheus của Tor (MetricsPort). The following metric can be used to monitor the timeout rate as seen by Tor:
tor_relay_exit_dns_error_total{reason="timeout"} 0

Có nhiều các tùy chọn cho phần mềm máy chủ DNS. Unbound đã trở thành a popular one but feel free to use any other software that you are comfortable with. When choosing your DNS resolver software, make sure that it supports DNSSEC validation and QNAME minimization (RFC7816). Cài đặt phần mềm trình phân giải resolver trên trình quản lý gói package của hệ điều hành của bạn, để đảm bảo rằng nó được cập nhật một cách tự động.

Bằng cách sử dụng trình phân giải DNS resolver của riêng bạn, bạn sẽ ít bị công kích hơn trước sự kiểm duyệt dựa trên DNS mà trình phân giải ngược dòng (upstream resolver) của bạn có thể áp đặt.

Below are instructions on how to install and configure Unbound - a DNSSEC-validating and caching resolver - on your exit relay. Unbound has many configuration and tuning knobs, but we keep these instructions simple and short; the basic setup will do just fine for most operators.

After switching to Unbound, verify that it works as expected by resolving a valid hostname. If it does not work, you can restore your old /etc/resolv.conf file.

Hệ điều hành Debian/Ubuntu

The following commands install unbound, backup your DNS configuration, and tell the system to use the local resolver:

# apt install unbound
# cp /etc/resolv.conf /etc/resolv.conf.backup
# echo nameserver 127.0.0.1 > /etc/resolv.conf

Để phòng tránh các thay đổi cấu hình không mong muốn (ví dụ, các thay đổi bởi máy/ứng dụng khách DHCP):

# chattr +i /etc/resolv.conf

The Debian configuration ships with QNAME minimization (RFC7816) enabled by default, so you don't need to enable it explicitly. Trình phân giải Unbound resolver mà bạn vừa cài đặt cũng thực hiện việc xác thực DNSSEC.

If you are running systemd-resolved with its stub listener, you may need to do a bit more than just that. Please refer to the resolved.conf manpage.

Hệ điều hành CentOS/RHEL

Cài đặt gói package unbound:

# yum install unbound

Nếu như bạn đang sử dụng một phiên bản CentOS/RHEL gần đây, vui lòng sử dụng dnf thay vì yum.

Trong /etc/unbound/unbound.conf thay thế dòng:

  qname-minimisation: no

với

  qname-minimisation: yes

Bật kích hoạt và khởi động unbound:

# systemctl enable --now unbound

Yêu cầu hệ thống sử dụng trình phân giải cục bộ local resolver:

# cp /etc/resolv.conf /etc/resolv.conf.backup
# echo nameserver 127.0.0.1 > /etc/resolv.conf

Để phòng tránh các thay đổi cấu hình không mong muốn (ví dụ, các thay đổi bởi máy/ứng dụng khách DHCP):

# chattr +i /etc/resolv.conf

If you are running systemd-resolved with its stub listener, you may need to do a bit more than just that. Please refer to the resolved.conf manpage.

Hệ điều hành FreeBSD

FreeBSD ships unbound in the base system but the one in ports is usually following upstream more closely, so we install the unbound package:

# pkg install unbound

Thay thế nội dung trong /usr/local/etc/unbound/unbound.conf bằng các dòng line sau đây:

server:
    verbosity: 1
    qname-minimisation: yes

Bật kích hoạt và khởi động dịch vụ unbound:

# sysrc unbound_enable=YES
# service unbound start

Yêu cầu hệ thống sử dụng trình phân giải cục bộ local resolver:

# cp /etc/resolv.conf /etc/resolv.conf.backup
# echo nameserver 127.0.0.1 > /etc/resolv.conf

Để phòng tránh các thay đổi cấu hình không mong muốn (ví dụ, các thay đổi bởi máy/ứng dụng khách DHCP):

# chflags schg /etc/resolv.conf