Privoxy
Privoxy 是一個 HTTP 協議過濾代理,常結合 Tor 使用。Privoxy 是有著先進的過濾能力和保護隱私的代理工具,它可以過濾網頁內容,管理cookies,控制訪問,除廣告、橫幅、彈出窗口等等,它同時支持單系統和多用戶網絡。
當用戶直接使用 SOCKS 代理訪問網絡時,瀏覽器會洩漏 DNS 請求,降低匿名性,這時應該使用 Privoxy。
安裝[編輯 | 編輯原始碼]
安裝 privoxy包。
配置[編輯 | 編輯原始碼]
使用Privoxy必須指定轉發規則,Privoxy的主配置文件在/etc/privoxy/config
。
監聽地址[編輯 | 編輯原始碼]
Privoxy默認只提供給本機使用(即localhost或者127.0.0.1),如果需要將Privoxy提供給網絡中的其他計算機使用,需要/etc/privoxy/config
在添加監聽信息,格式:
listen-address [SERVER-IP]:[PORT]
例如提供給192.168.1.1的8118埠使用:
listen-address 192.168.1.1:8118
轉發協議[編輯 | 編輯原始碼]
編輯 /etc/privoxy/config
文件添加相關轉發規則:
- 轉發socks5
示例(注意9050後面有一個空格和點號):
forward-socks5 / localhost:9050 .
- 轉發.i2p
通過I2P路由轉發.i2p,示例:
forward .i2p localhost:4444
- 轉發onion
示例(注意9050後面有一個空格和點號):
forward-socks4a .onion localhost:9050 .
廣告屏蔽[編輯 | 編輯原始碼]
Using an ad blocking extension in a web browser can increase page load time. Additionally, extensions like AdBlock Plus are not supported by all browsers. A useful alternative is to install system-wide ad blocking by setting a proxy address in your preferred browser.
You can use adblock plus filters. The privoxy blocklist script automatically downloads adblock plus filters, converts them to a privoxy friendly format, and edits privoxy's config file to include those filters:
- Run the script once to create
/etc/conf.d/privoxy-blacklist
- Edit
/etc/conf.d/privoxy-blacklist
to uncomment the linePRIVOXY_USER=
and the two lines below it. - Run the script again to download and install the blocklists.
- Restart privoxy.
To block tracking via embedded Facebook "Like" button, Twitter "follow", and Google Plus "+1", edit /etc/privoxy/user.action
and add these lines to the end:
{+block-as-image{Facebook "like" and similar tracking URLs.}} www.facebook.com/(extern|plugins)/(login_status|like(box)?|activity|fan)\.php platform.twitter.com/widgets/follow_button? plusone.google.com
使用[編輯 | 編輯原始碼]
使用Systemd (簡體中文) 啟用privoxy服務。
對程序進行代理設置,默認的地址是:
localhost:8118
Firefox瀏覽器:進入 首選項 > 高級 > 網絡 > 設置,添加http代理。
Chromium
$ chromium --proxy-server="localhost:8118"
你也可以添加http_proxy
環境變量,例如添加到~/.bashrc
中:
http_proxy="http://localhost:8118"