概要
- Install Tor | Onion Pi のまま
-
wlan0
のTCP通信が、Port9040に渡される(?) - Raspberry Pi自体は Tor経由にはならない。(
% curl ifconfig.me
でGlobal IP)
環境
- Raspberry Pi 3
-
[メモ] Raspberry Pi 3で、Wi-Fi アクセスポイントルータ を設定しておく
(# Jessie-lite :2016-05-27-raspbian-jessie-lite.img
)
手順
-
sudo apt-get install -y tor
-
sudo vi /etc/tor/torrc
/etc/tor/torrc
...
Tor will look for this file in various places based on your platform:
https://www.torproject.org/docs/faq#torrc
以下を追記する Log ~ DNSListenAddress のとこまで
Log notice file /var/log/tor/notices.log
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort 9040
TransListenAddress 192.168.42.1
DNSPort 53
DNSListenAddress 192.168.42.1
ここまで.
Tor opens a socks proxy on port 9050 by default -- even if you don't
configure one below. Set "SocksPort 0" if you plan to run Tor only
...
3. `sudo vi /etc/hostapd/hostapd.conf`
```txt:/etc/hostapd/hostapd.conf
...
# これは、飛ばしてもいいよな...
ssid=Onion Pi
...
-
iptables
コマンドラインへこぴぺ
現在の設定を消す
sudo iptables -F
sudo iptables -t nat -F
wlan0: ssh(TCP22)
sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 22 -j REDIRECT --to-ports 22
wlan0: DNS (UDP53)
sudo iptables -t nat -A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53
wlan0: その他TCPパケットを9040ポートへ。
sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040
設定確認.
sudo iptables -t nat -L
設定保存
sudo sh -c "mv /etc/iptables.ipv4.nat /etc/iptables.ipv4.nat.bak"
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Log file関連.
sudo touch /var/log/tor/notices.log
sudo chown debian-tor /var/log/tor/notices.log
sudo chmod 644 /var/log/tor/notices.log
サービス開始、自動起動設定.
sudo service tor start
sudo service tor status
sudo update-rc.d tor enable
4. `sudo vi /etc/init.d/tor`
- <font color='red'>(!!要確認!!) - アドバイスおねがいします</font>
```txt:/etc/init.d/tor
...
else
AA_EXEC=""
AA_EXEC_ARGS=""
fi
#
sleep 9 # 起動時にこけるのでWaitをいれる.
#
if start-stop-daemon --start --quiet \
--pidfile $TORPID \
$NICE \
$AA_EXEC \
--exec $DAEMON -- $AA_EXEC_ARGS $DEFAULT_ARGS $ARGS
...
sudo reboot
- テスト
- Windowsとかから、らずぱいのAPに接続
- ブラウザのシークレットモード(Firefox:CTRL+Shift+P, Chrome:Ctrl+Shift+N)起動(気分的に)
- グローバルIPを確認