2017年5月11日 星期四

使用 Privoxy 搭配 Tor 加強上網隱私及廣告過濾

環境參數:

  • OS:Windows 10 Home Edition
  • CPU:Intel(R) Core(TM)i7-6500U @ 2.50GHz 2.60GHz
  • RAM:16 GB

Privoxy 過濾

Privoxy:下載並安裝相關軟體

(Windows 版本)Pvivoxy

Privoxy v3_0_26 (Stable)
可選擇安裝版本或免安裝綠色版本
以port安裝

FreeBSD 10.3 安裝 Privoxy
# cd /usr/ports/www/privoxy
# make all install clean

或pkg安裝

# pkg install privoxy-3.0.26

Privoxy設定

(Win32)編輯 config.txt

(FreeBSD) # vi /usr/local/etc/privoxy/config

注意config及logdir的路徑設定在Win32及FreeBSD不一樣
開機自動啟用Privoxy

# vi /etc/rc.conf
privoxy_enable="YES"
trust-info-url  http://www.example.com/why_we_block.html
trust-info-url  http://www.example.com/what_we_allow.html

# FreeBSD
confdir /usr/local/etc/privoxy
logdir /var/log

#Win32
#confdir .
#logdir .
logfile privoxy.log # FreeBSD: /var/log/privoxy.log

# Action
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

# Filter
filterfile default.filter
filterfile user.filter      # User customizations

# Debug
debug     1 # Log the destination for each request Privoxy let through. See also debug 1024.
#debug  1024 # Actions that are applied to all sites and maybe overruled later on.
debug  4096 # Startup banner and warnings
debug  8192 # Non-fatal errors

listen-address  192.168.1.1:8118 # 換成自己的IP
toggle  1 # If set to 0, Privoxy will start in "toggled off" mod
enable-remote-toggle  1 # The web-based toggle
enable-remote-http-toggle  0 # Privoxy ignores special HTTP headers.
enable-edit-actions 1 # Whether or not the web-based actions file editor may be used
enforce-blocks 0  # Blocks are not enforced.
buffer-limit 4096 #Maximum size of the buffer for content filtering.

enable-proxy-authentication-forwarding 0
forward-socks4a / localhost:9050 .

forwarded-connect-retries  0 # How often Privoxy retries if a forwarded connection request fails.
accept-intercepted-requests 0 # Only proxy requests are accepted, intercepted requests are treated as invalid.
allow-cgi-request-crunching 0 # Privoxy ignores block and redirect actions for its CGI pages.
split-large-forms 0 #The CGI form generate long GET URLs.
keep-alive-timeout 5 #Number of seconds after which an open connection will no longer be reused.
tolerate-pipelining 1 #Whether or not pipelined requests should be served.
socket-timeout 300 #Number of seconds after which a socket times out if no data is received.

Privoxy 測試

設定proxy server為剛剛config設定的ip及port,然後瀏覽這個網址:
http://p.p/,如果成功啟用會看到以下畫面
enter image description here

Tor 隱身

Privoxy:下載並安裝相關軟體

(Windows 版本)Tor

下載:Expert Bundle
解壓縮後執行tor.exe成功會出現以下畫面
enter image description here
以port安裝

FreeBSD 10.3 安裝 Tor
# cd /usr/ports/security/tor
# make all install clean

或pkg安裝

# pkg install tor-0.2.9.10

開機自動啟用Tor

# vi /etc/rc.conf
tor_enable="YES"

檢查 Tor 是否安裝成功?

訪問 https://check.torproject.org/?lang=zh_TW,成功安裝則會看到這個畫面
enter image description here
[TOC]

活本來沒有什麼好與壞,只要你願意怎樣填滿它,它就隨同而行。


EmoticonEmoticon