Skip to content

Commit

Permalink
fix tor and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sepehrdaddev committed Oct 12, 2020
1 parent 9da7951 commit c718d9e
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions torctl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
################################################################################

# torctl.sh version
VERSION="torctl.sh v0.5.5"
VERSION="torctl.sh v0.5.6"

# exclude locals
TOR_EXCLUDE="192.168.0.0/16 172.16.0.0/12 10.0.0.0/8"
Expand Down Expand Up @@ -152,7 +152,7 @@ wipe() {
}

get_ip() {
RADDR=$(wget -qO- http://ipecho.net/plain)
RADDR=$(curl -s https://ipinfo.io/ip)
msg "remote ip: $RADDR"
}

Expand Down Expand Up @@ -236,6 +236,7 @@ gen_torrc() {
warn "configuring tor"
cat >"${TORRC}" <<EOF
# generated by torctl
User $TOR_UID
DataDirectory /var/lib/tor
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsOnResolve 1
Expand All @@ -245,6 +246,7 @@ SocksPort 127.0.0.1:9050 IsolateClientAddr IsolateSOCKSAuth IsolateClientProtoco
ControlPort 9051
HashedControlPassword 16:FDE8ED505C45C8BA602385E2CA5B3250ED00AC0920FEC1230813A1F86F
DNSPort 127.0.0.1:$TOR_DNS
Sandbox 1
HardwareAccel 1
TestSocks 1
AllowNonRFC953Hostnames 0
Expand Down Expand Up @@ -297,14 +299,6 @@ apply_iptables_rules() {
apply_sysctl_rules() {
info "applying sysctl rules"

# Swappiness
sysctl -w vm.dirty_ratio=10 &>"/dev/null"
sysctl -w vm.dirty_background_ratio=5 &>"/dev/null"
sysctl -w vm.dirty_expire_centisecs=2000 &>"/dev/null"
sysctl -w vm.dirty_writeback_centisecs=1000 &>"/dev/null"
sysctl -w vm.swappiness=10 &>"/dev/null"
sysctl -w vm.vfs_cache_pressure=70 &>"/dev/null"

# Disable Explicit Congestion Notification in TCP
sysctl -w net.ipv4.tcp_ecn=0 &>"/dev/null"

Expand Down Expand Up @@ -448,8 +442,7 @@ start() {
# generate new resolv.conf
gen_resolv_conf

# start needed services
start_service iptables
# start tor service
start_service tor

# apply new iptables rules
Expand Down

0 comments on commit c718d9e

Please sign in to comment.