privoxy為HTTP代理軟件,tor為socket代理軟件,且tor可以防止跟蹤和竊聽,如果可用的話 可以FQ,訪問國外網站。
最近要將tor和privoxy移植到mipsel平臺,移植完成后在此整理一下,僅供愛好者參考。
編譯tor需要以下依賴包:
openssl-1.0.0k.tar.gz
zlib-1.2.8.tar.gz
libevent-2.0.20-stable.tar.gz
tor/privoxy軟件如下:
privoxy-3.0.21-stable-src.tar.gz
tor-0.2.4.20
注:tor網站為www.torproject.org,在國內貌似被封了,需要走VPN從國外下載。
以下為編譯步驟: ############# openssl
chmod +x config
./config --prefix=/home/aaron/router-tor/install/openssl-1.0.0k os/compiler:mipsel-linux-linux26-gcc
#vi Makefile
AR=mipsel-linux-linux26-ar
make make install
############# zlib
chmod +x
config ./configure --prefix=/home/aaron/router-tor/install/zlib-1.2.8
#vi Makefile
CC=mipsel-linux-linux26-gcc LDSHARED=mipsel-linux-linux26-ld
make
make install
############# libevent
chmod +x configure
./configure --prefix=/home/aaron/router-tor/install/libevent-2.0.20 CC=mipsel-linux-linux26-gcc AR=mipsel-linux-linux26-ar --host=mipsel-linux
make
make install
############# tor
chmod +x configure
./configure --prefix=/tmp/tor CC=mipsel-linux-linux26-gcc AR=mipsel-linux-linux26-ar --host=mipsel-linux --enable-static-libevent --with-libevent-dir=/home/aaron/router-tor/install/libevent-2.0.20 --enable-static-openssl --with-openssl-dir=/home/aaron/router-tor/install/openssl-1.0.0k --enable-static-zlib --with-zlib-dir=/home/aaron/router-tor/install/zlib-1.2.8 --disable-asciidoc
make
make install
############# privoxy
autoheader && autoconf
chmod +x configure
./configure --prefix=/tmp/privoxy CC=mipsel-linux-linux26-gcc AR=mipsel-linux-linux26-ar --host=mipsel-linux
make
make install
編譯完成后需要放到mipsel平臺進行測試
################################# 測試privoxy如下 #################################
在mipsel平臺建立如下文件:
/tmp/privoxy/default.action
/tmp/privoxy/default.filter
/tmp/privoxy/match-all.action
/tmp/privoxy/trust
/tmp/privoxy/user.action
/tmp/privoxy/user.filter
/tmp/privoxy/templates
/tmp/privoxy/config
/tmp/privoxy/templates/*
config為配置文件,內容如下:
#user-manual /usr/local/share/doc/privoxy/user-manual/
confdir /tmp/privoxy
#logdir /var/log/privoxy
actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.
actionsfile default.action # Main actions file
actionsfile user.action # User customizations
filterfile default.filter
filterfile user.filter # User customizations
logfile logfile
listen-address 192.168.150.1:8118 #其實是mipsel平臺IP地址,privoxy監聽端口
toggle 1
enable-remote-toggle 0
enable-remote-http-toggle 0
enable-edit-actions 0
enforce-blocks 0
buffer-limit 4096
enable-proxy-authentication-forwarding 0
forwarded-connect-retries 0
accept-intercepted-requests 0
allow-cgi-request-crunching 0
split-large-forms 0
keep-alive-timeout 5
tolerate-pipelining 1
socket-timeout 300 forward-socks4a / 192.168.150.1:9050 . #其實是mipsel平臺IP地址,tor監聽端口,不要忘記最后的點
以上所有文件內容為/tmp/privoxy/etc下的所有內容
然后執行 chmod 666 -R /tmp/privoxy
./privoxy /tmp/privoxy/config --user nobody.nobody --no-daemon
切記user不要是root
執行完成后netstat -na | grep 8118 會看到監聽端口
################################# 測試tor如下 #################################
在mipsel平臺建立如下文件:
/tmp/tor/share/tor/geoip
/tmp/tor/share/tor/geoip6
以上文件為/tmp/tor/share/tor文件夾下內容
/tmp/tor/cached-certs
/tmp/tor/cached-microdesc-consensus
/tmp/tor/cached-microdescs
/tmp/tor/cached-microdescs.new
以上文件為/root/.tor文件夾下內容 如找不到,請用find命令查找
配置文件為torrc.conf,內容如下:
SocksPort 192.168.150.1:9050 #tor監聽端口 Log notice stderr
#RunAsDaemon 1
DataDirectory /tmp/tor
#以下為橋配置/國內屏蔽tor,不用橋該軟件不能工作
bridge obfs2 91.11.17.184:443 e55095f89f8f7be4c3e209c5f5a91cabba474c40
bridge obfs2 54.224.204.122:443 49d5cc0e690fd0321e749291f0eb98168e3c238b
bridge obfs2 1.122.59.44:443 e24b6446ad4223d27ab075661962fc5d465d30ef
查找橋方法: 給bridges@bridges.torproject.org發送郵件,內容為get bridges,然后可能會受到回復。
注:必須用google的Gmail郵箱或者yahoo郵箱,我第一次給它發郵件,它給我回復了,第二天再給 它發就沒有回復了,
因此獲得橋信息比較麻煩。每次獲得的橋信息一般一天就失效了,因為別人的機器 作為橋后,人家一旦關閉你就不能用了,
我得到的橋信息第二天只有一條是有用的。
我收到的信息為
91.11.17.184:443 e55095f89f8f7be4c3e209c5f5a91cabba474c40
54.224.204.122:443 49d5cc0e690fd0321e749291f0eb98168e3c238b
1.122.59.44:443 e24b6446ad4223d27ab075661962fc5d465d30ef
配置完成后運行 ./tor -f torrc.conf
執行完成后netstat -na | grep 9050 會看到監聽端口
################################# 測試是否可用 #################################
在本機瀏覽器里設置代理為 192.168.150.1 端口為8118,然后在瀏覽器欄里輸入 https://check.torproject.org/
頁面會顯示
Congratulations. This browser is configured to use Tor. Your IP address appears to be: 96.44.189.102
到此配置完成。
新聞熱點
疑難解答