Privoxy (简体中文)

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
翻译状态:本文是 Privoxy翻译。上次翻译日期:2017-10-08。如果英文版本有所更改,则您可以帮助同步翻译。

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 .

广告屏蔽

警告: Blocking advertisements can reduce anonymity, since it creates a unique browser signature. This should not be done when using tor or another proxy for anonymity.

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:

  1. Run the script once to create /etc/conf.d/privoxy-blacklist
  2. Edit /etc/conf.d/privoxy-blacklist to uncomment the line PRIVOXY_USER= and the two lines below it.
  3. Run the script again to download and install the blocklists.
  4. 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"

参看Proxy settings

参阅