Я следовал этому руководству в Проекте Скалистой вершины.
Проблема, я не знаю, что сделать с iptables ruleset. Где я копирую его в? Я использовал сеть Tor уже много лет, но только на Хвостах. Я плохо знаком с изменением материала Скалистой вершины и с iptables.
iptables ruleset:
#!/bin/sh
### set variables
#destinations you don't want routed through Tor
_non_tor="192.168.1.0/24 192.168.0.0/24"
#the UID that Tor runs as (varies from system to system)
_tor_uid="109"
#Tor's TransPort
_trans_port="9040"
### flush iptables
iptables -F
iptables -t nat -F
### set iptables *nat
iptables -t nat -A OUTPUT -m owner --uid-owner $_tor_uid -j RETURN
iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 53
#allow clearnet access for hosts in $_non_tor
for _clearnet in $_non_tor 127.0.0.0/9 127.128.0.0/10; do
iptables -t nat -A OUTPUT -d $_clearnet -j RETURN
done
#redirect all other output to Tor's TransPort
iptables -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports $_trans_port
### set iptables *filter
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#allow clearnet access for hosts in $_non_tor
for _clearnet in $_non_tor 127.0.0.0/8; do
iptables -A OUTPUT -d $_clearnet -j ACCEPT
done
#allow only Tor output
iptables -A OUTPUT -m owner --uid-owner $_tor_uid -j ACCEPT
iptables -A OUTPUT -j REJECT
Править:
Я сделал некоторый поиск и читаю, что мог работать sudo iptables-save > iptables.conf
затем замените информацию в iptables.conf со Скалистой вершиной iptables ruleset затем выполненный iptables-restore < iptables.conf
но запрошенный с ошибкой при высказывании
iptables-восстановление: строка 5 перестала работать
Что мне делать?
Это - только один из многих возможных путей:
Помещенный тот файл сценария где угодно. Например, мой по телефону /home/doug/init/doug_firewall
.
, Удостоверяются, что полномочия корректны для выполнения. Например, мой:
$ ls -l /home/doug/init/doug_firewall
-rwxr-xr-x 1 doug doug 60254 Jul 3 09:52 /home/doug/init/doug_firewall
Затем редактируют /etc/network/intrefaces
файл для выполнения сценария во время запуска. Например, мой:
$ cat /etc/network/interfaces
# interfaces file for smythies.com 2016.01.30
# attempt to set local DNS herein, as the method
# used with the old 12.04 server no longer works.
#
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
pre-up /home/doug/init/doug_firewall
dns-nameservers 127.0.0.1
# The primary interface (d-link PCI card)
auto enp4s0
iface enp4s0 inet dhcp
# Local network interface (uses built in ethernet port)
auto enp2s0
iface enp2s0 inet static
address 192.168.111.1
network 192.168.111.0
netmask 255.255.255.0
broadcast 192.168.111.255