Skip to content

Commit b5e8c55

Browse files
committed
Tune tor
1 parent 25c69ec commit b5e8c55

3 files changed

Lines changed: 42 additions & 6 deletions

File tree

alpine/alpine-root/etc/coredns/Corefile

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
onion {
2+
loop
3+
4+
bind 127.0.0.1 ::1
5+
6+
#log
7+
#errors
8+
9+
forward onion dns://127.0.0.1:9053 {
10+
prefer_udp
11+
policy sequential
12+
health_check 1s
13+
failfast_all_unhealthy_upstreams
14+
failover SERVFAIL REFUSED
15+
}
16+
}
17+
118
. {
219
loop
320

@@ -9,18 +26,29 @@
926
cache {
1027
prefetch 4096 20s
1128
serve_stale 48h
29+
servfail 1s
1230
}
1331

32+
# disable ipv6
33+
#template IN AAAA {
34+
# rcode NOERROR
35+
#}
36+
1437
forward . dns://127.0.0.1:5350 {
1538
force_tcp
1639
policy sequential
17-
health_check 10s
40+
health_check 1s
1841
failfast_all_unhealthy_upstreams
42+
failover SERVFAIL REFUSED
1943
}
2044

45+
# unbound
2146
#forward . dns://127.0.0.1:5353 {
2247
# prefer_udp
2348
# policy sequential
49+
# health_check 1s
50+
# failfast_all_unhealthy_upstreams
51+
# failover SERVFAIL REFUSED
2452
#}
2553

2654
#forward . tls://9.9.9.11 {

alpine/alpine-root/etc/local.d/02-iptables.start

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
done
2121
}
2222

23+
[ -f /usr/bin/tor ] && {
24+
iptables -t nat -A OUTPUT -p tcp -d $(grep VirtualAddrNetworkIPv4 /etc/tor/torrc | awk '{print $2}') -j REDIRECT --to-ports 9052
25+
ip6tables -t nat -A OUTPUT -p tcp -d $(grep VirtualAddrNetworkIPv6 /etc/tor/torrc | awk '{print $2}' | sed 's!\[!!;s!\]!!') -j REDIRECT --to-ports 9052
26+
}
27+
2328
# for ISPs that block traffic to standard DNS port
2429
for i in 9.9.9.9 149.112.112.112 9.9.9.11 149.112.112.11 9.9.9.10 149.112.112.10 ; do
2530
iptables -t nat -A OUTPUT -p tcp -d "$i" --dport 53 -j DNAT --to-destination "$i:9953"

alpine/alpine-root/etc/tor/torrc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ Sandbox 1
1212

1313
LongLivedPorts 21,22,53,80,706,1863,5050,5190,5222,5223,6523,6667,6697,8300
1414

15-
SocksPort 127.0.0.1:9050 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth NoDNSRequest OnionTrafficOnly
16-
SocksPort 127.0.0.1:9051 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth NoDNSRequest
17-
TransPort 127.0.0.1:9052 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth
18-
TransPort [::1]:9052 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth
19-
DNSPort 127.0.0.1:9053 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth NoIPv4Traffic NoIPv6Traffic
15+
HTTPTunnelPort 127.0.0.1:8050 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth OnionTrafficOnly
16+
SocksPort 127.0.0.1:9050 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth OnionTrafficOnly
17+
18+
HTTPTunnelPort 127.0.0.1:8051 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth
19+
SocksPort 127.0.0.1:9051 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth
2020

21+
TransPort 127.0.0.1:9052 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth OnionTrafficOnly
22+
TransPort [::1]:9052 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth OnionTrafficOnly
23+
DNSPort 127.0.0.1:9053 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtocol IsolateDestAddr KeepAliveIsolateSOCKSAuth NoIPv4Traffic NoIPv6Traffic
2124
VirtualAddrNetworkIPv4 127.192.0.0/16
2225
VirtualAddrNetworkIPv6 [FE80::]/16
2326
AutomapHostsOnResolve 1

0 commit comments

Comments
 (0)