PDA

View Full Version : Installiamo TOR su NEXX wt3020 e navighiamo in ANONIMATO


spider81man
05-04-2018, 10:56
Ciao a tutti,
riposto questa PICCOLA GUIDA solo perchè quelle in precedenza non sono più funzionanti per vari motivi.
Prima di cominciare ATTENZIONE: Il rischio di brickare (rendere inutilizzabile il router) è alto non mi prendo responsabilità.

Installazione di OpenWRT

Quello scritto in neretto, sono i comandi da digitare mentre il sottolineato sono le risposte che darà il ROUTER:

$ telnet 192.168.8.1

Trying 192.168.8.1…
Connected to 192.168.8.1.
Escape character is ‘^]’.

login: nexxadmin
Password: y1n2inc.com0755

(SONO LE CREDENZIALI DI DEFAULT, SE LE AVETE CAMBIATE USATE LE NUOVE)

BusyBox v1.12.1 (2015-02-05 18:04:51 HKT) built-in shell (ash)
Enter ‘help’ for a list of built-in commands.

# cd /tmp

# wget http://downloads.openwrt.org/releases/18.06.2/targets/ramips/mt7620/openwrt-18.06.2-ramips-mt7620-wt3020-8M-squashfs-sysupgrade.bin (ANDIAMO A SCARICARE OPENWRT)


Connecting to downloads.openwrt.org.it (78.24.191.177:80)
openwrt-18.06.2-ramips 100% |*******************************| 3670k 00:00:00 ETA

# mtd_write -r write openwrt-18.06.2-ramips-mt7620-wt3020-8M-squashfs-sysupgrade.bin mtd3 (ANDIAMO A SCRIVERE OPENWRT SUL ROUTER)

Unlocking mtd3 …
Writing from openwrt-18.06.2-ramips-mt7620-wt3020-8M-squashfs-sysupgrade.bin to mtd3 … [e]


Attenzione: Il dispositivo a questo punto potrebbe autonomamente chiudere il telnet. Non farti prendere dal panico.

A questo punto, dovresti eseguire il software OpenWRT.
OpenWRT assegna l’indirizzo IP 192.168.1.1 alla porta LAN del router, per ora la WiFi è disabilitata quindi connettiti via cavo. Se sei ancora in grado di connettersi a 192.168.8.1, qualcosa è andato storto: ripeti il procedimento.

Installiamo OnionWRT

Collegati in Telnet al router e cambia la password di root:

$ telnet 192.168.1.1

Trying 192.168.1.1…
Connected to openwrt.lan.
Escape character is ‘^]’.

——————————————
BusyBox v1.23.2 (2015-07-25 03:03:02 CEST) built-in shell (ash)
—————————————————–
CHAOS CALMER (15.05, r46767)
—————————————————–
* 1 1/2 oz Gin Shake with a glassful
* 1/4 oz Triple Sec of broken ice and pour
* 3/4 oz Lime Juice unstrained into a goblet.
* 1 1/2 oz Orange Juice
* 1 tsp. Grenadine Syrup
————————————————–

root@OpenWrt:/# passwd

Changing password for root
New password:
Retype password:
Password for root changed by root
root@OpenWrt:/#

A questo punto OpenWRT blocca il telnet e devi per forza collegarti in SSH tramite Putty o qualsiasi altro software. L’interfaccia Web LuCI è abilitata.
Configura ora la tua connessione internet tramite Web.
Collegati in SSH

root@OpenWrt:/#opkg update
root@OpenWrt:/#opkg install wget

root@OpenWrt:/#opkg install openssl-util

root@OpenWrt:/# wget http://www.gieri.it/tor/install-tor.txt

root@OpenWrt:/# mv install-tor.txt install-tor.sh (RINOMINIAMO il file da .txt a .sh in modo da essere eseguibile)

IN ALTERNATIVA, in caso non vi faccia scaricare niente dal sito poichè magari nel frattempo ha cambiato dominio o è stato chiuso, potete fare così:

root@OpenWrt:/#opkg install nano
root@OpenWrt:/#nano install-tor.sh

A questo punto si aprirà un file di testo voi copiate ed incollate, selezionando tutto con il mouse poi tasto Destro COPIA ed mouse tasto destro INCOLLA, quanto messo sotto:

#!/bin/sh
############################################################################################
# Configure OnionWRT #
# Reused from: #
# 1) http://onionwrt.us.to/install #
# 2) https://byteseclabs.com/some-work-mostly-fun/2016/11/14/make-a-cheap-tor-anonymizer #
############################################################################################

LAN_IP=$(uci get network.lan.ipaddr)
opkg update 2>&1 >/dev/null

# Install Tor
( opkg list-installed |grep -q tor ) || opkg install tor
( opkg list-installed |grep -q tor ) || { echo "Error: Tor is not installed."; exit; }

# Configure Tor
# Create User and Group
( cat /etc/passwd |grep -q ^tor ) || echo "tor:*:52:52:tor:/var/run/tor:/bin/false" >> /etc/passwd
( cat /etc/shadow |grep -q ^tor ) || echo "tor:*:0:0:99999:7:::" >> /etc/shadow
( cat /etc/group |grep -q ^tor ) || echo "tor:x:52:" >> /etc/group

# House Keeping
killall -9 tor
rm -rf /etc/tor
rm -rf /var/lib/tor
rm -f /var/run/tor.pid

# Create Tor Configuration
mkdir -p /etc/tor

cat > /etc/tor/torrc << EOF
# Tor configuration auto-generated by onionwrt script
User tor
RunAsDaemon 1
PidFile /var/run/tor.pid
DataDirectory /var/lib/tor
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort 9040
TransListenAddress 127.0.0.1
TransListenAddress ${LAN_IP}
DNSPort 9053
DNSListenAddress 127.0.0.1
DNSListenAddress 0.0.0.0:5300
DNSListenAddress ${LAN_IP}
ControlPort 9051
EOF

mkdir -p /var/lib/tor
chown tor /var/lib/tor
mkdir -p /var/run
touch /var/run/tor.pid
chown tor /var/run/tor.pid

# Configure transparent proxy
sed -i -e '/# DNT/d' /etc/firewall.user

cat >> /etc/firewall.user << EOF
iptables -t nat -A PREROUTING -i br-lan -s $(uci get network.lan.ipaddr)/$(ipcalc.sh $(uci get network.lan.ipaddr) $(uci get network.lan.netmask)|grep PREFIX|cut -d "=" -f 2) -d $(uci get network.lan.ipaddr) -j RETURN # DNT
iptables -t nat -A PREROUTING -i br-lan -p udp --dport 53 -j REDIRECT --to-ports 9053 # DNT
iptables -t nat -A PREROUTING -i br-lan -p tcp --syn -j REDIRECT --to-ports 9040 # DNT
# Drop ICMP # DNT
iptables -A INPUT -p icmp --icmp-type 8 -j DROP # DNT
# security rules from https://lists.torproject.org/pipermail/tor-talk/2014-March/032507.html # DNT
iptables -A OUTPUT -m conntrack --ctstate INVALID -j DROP # DNT
iptables -A OUTPUT -m state --state INVALID -j DROP # DNT
# security rules to prevent kernel leaks from link above # DNT
iptables -A OUTPUT ! -o lo ! -d 127.0.0.1 ! -s 127.0.0.1 -p tcp -m tcp --tcp-flags ACK,FIN ACK,FIN -j DROP # DNT
iptables -A OUTPUT ! -o lo ! -d 127.0.0.1 ! -s 127.0.0.1 -p tcp -m tcp --tcp-flags ACK,RST ACK,RST -j DROP # DNT
# disable chrome and firefox udp leaks # DNT
iptables -t nat -A PREROUTING -p udp -m multiport --dport 3478,19302 -j REDIRECT --to-ports 9999 # DNT
iptables -t nat -A PREROUTING -p udp -m multiport --sport 3478,19302 -j REDIRECT --to-ports 9999 # DNT
EOF

# Configure WiFi.
[ -z "$SSID" ] && SSID=OnionWRT
[ -z "$KEY" ] && KEY=t0rmenta

# Check key
if [ ! -z "$KEY" ]
then
[ $(echo -n $KEY| wc -c) -lt 7 ] && { echo "KEY is too short."; exit; }
[ $(echo -n $KEY| wc -c) -gt 62 ] && { echo "KEY is too long."; exit; }
( opkg list-installed |grep -q wpad-mini ) || opkg install wpad-mini
fi

mv /etc/config/wireless /etc/config/wireless.bak
wifi detect |grep -v disabled|grep -v REMOVE > /etc/config/wireless

# Configure all "lan" wifis.
for radio in $(uci show wireless|grep lan|cut -d "." -f 2)
do
uci set wireless.${radio}.ssid=${SSID}
[ ! -z "$KEY" ] && { uci set wireless.${radio}.encryption=psk;uci set wireless.${radio}.key=${KEY}; } || uci set wireless.${radio}.encryption=none
done

uci commit

# WiFi up
wifi
/etc/init.d/tor enable
/etc/init.d/tor start
/etc/init.d/firewall stop
/etc/init.d/firewall start

Appena incollato digitiamo CTRL+X e salviamo premendo 2 volte ENTER.

Se digitate il comando

root@OpenWrt:/#ls –l

vi comparirà il file appena scaricato/creato cioè install-to.sh. In caso non lo troviate non l’avete scaricato o salvato quindi ripetete il passaggio.

Successivamente

root@OpenWrt:/# sh ./install-tor.sh (ANDIAMO QUINDI A METTERE IL ROUTER SULLA RETE TOR)

Il Sistema farà tutto questo:

Installing tor (0.2.5.12-1) to root…
Downloading http://downloads.openwrt.org/chaos_calmer/……………………….
Installing libevent2 (2.0.22-1) to root…
Downloading http://downloads.openwrt.org/chaos_calmer/………………………..
Installing libopenssl (1.0.2e-1) to root…
Downloading http://downloads.openwrt.org/chaos_calmer/………………………….
Installing zlib (1.2.8-1) to root…
Downloading http://downloads.openwrt.org/chaos_calmer/………………………….
Installing libpthread (0.9.33.2-1) to root…
Downloading http://downloads.openwrt.org/chaos_calmer/………………………….
Installing librt (0.9.33.2-1) to root…
Downloading http://downloads.openwrt.org/chaos_calmer/………………………….
Configuring libpthread.
Configuring libevent2.
Configuring librt.
Configuring zlib.
Configuring libopenssl.
Configuring tor.
Warning: Unable to locate ipset utility, disabling ipset support
* Flushing IPv4 filter table
* Flushing IPv4 nat table
* Flushing IPv4 mangle table
* Flushing IPv4 raw table
* Flushing IPv6 filter table
* Flushing IPv6 mangle table
* Flushing IPv6 raw table
* Flushing conntrack table …
Warning: Unable to locate ipset utility, disabling ipset support
* Populating IPv4 filter table
* Zone ‘lan’
* Zone ‘wan’
* Rule ‘Allow-DHCP-Renew’
* Rule ‘Allow-Ping’
* Rule ‘Allow-IGMP’
* Rule #7
* Rule #8
* Forward ‘lan’ -> ‘wan’
* Populating IPv4 nat table
* Zone ‘lan’
* Zone ‘wan’
* Populating IPv4 mangle table
* Zone ‘lan’
* Zone ‘wan’
* Populating IPv4 raw table
* Zone ‘lan’
* Zone ‘wan’
* Populating IPv6 filter table
* Zone ‘lan’
* Zone ‘wan’
* Rule ‘Allow-DHCPv6’
* Rule ‘Allow-MLD’
* Rule ‘Allow-ICMPv6-Input’
* Rule ‘Allow-ICMPv6-Forward’
* Rule #7
* Rule #8
* Forward ‘lan’ -> ‘wan’
* Populating IPv6 mangle table
* Zone ‘lan’
* Zone ‘wan’
* Populating IPv6 raw table
* Zone ‘lan’
* Zone ‘wan’
* Flushing conntrack table …
* Set tcp_ecn to off
* Set tcp_syncookies to on
* Set tcp_window_scaling to on
* Running script ‘/etc/firewall.user’

Quando ha finito digitiamo

root@OpenWrt:/# reboot (ANDIAMO A RIAVVIARE IL ROUTER)

Hai finito, il router si riavvierà. Se tutto è andato correttamente, vai su questa pagina e controlla che sei sotto rete TOR: https://check.torproject.org/


Spero la cosa vi sia utile, la presente guida è stata scritta solo a fini ludici scopiazzando di qua e di la da internet altri articoli e testata da me.
E' stata in parte presa anche dal sito http://www.gieri.it/trasformare-il-router-nexx-wt3020-in-un-tor-router/, se ci passate cliccate qualche link pubblicitario SOLO per fargli guadagnare due lire :P
Ciao a tutti e fatemi sapere
spider81man

spider81man
03-07-2019, 11:31
Buongiorno,
guida MODIFICATA con il link al nuovo OpenWRT.
Ciao
spider81man