Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5708093
  • 博文数量: 675
  • 博客积分: 20301
  • 博客等级: 上将
  • 技术积分: 7671
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-31 16:15
文章分类

全部博文(675)

文章存档

2012年(1)

2011年(20)

2010年(14)

2009年(63)

2008年(118)

2007年(141)

2006年(318)

分类: LINUX

2008-04-22 15:24:55

想对代理的目标访问机器做一些限制,限制其只能够访问限定的主机。本来想修改tinyproxy的代码,一直找借口拖延,今天亮亮找我下载论文的时候,我想起这件事来。

拿出tinyproxy的代码,发现有个filter_init还有filter_url等函数,猜想tinyproxy已经有了filter功能了。

查看/etc/tinyproxy/tinyproxy.conf中:
#
# The location of the filter file.
#
#Filter "/etc/tinyproxy/filter"

#
# Filter based on URLs rather than domains.
#
#FilterURLs On

#
# Use POSIX Extended regular expressions rather than basic.
#
#FilterExtended On

#
# Use case sensitive regular expressions.
#                                                                        
#FilterCaseSensitive On    

#
# Change the default policy of the filtering system.  If this directive is
# commented out, or is set to "No" then the default policy is to allow
# everything which is not specifically denied by the filter file.
#
# However, by setting this directive to "Yes" the default policy becomes to
# deny everything which is _not_ specifically allowed by the filter file.
#
#FilterDefaultDeny Yes

我们可以直接设置filter来实现:只对限定站点的代理,其他的不代理。

我们修改配置文件为:
Filter "/etc/tinyproxy/filter"
FilterURLs On
FilterDefaultDeny Yes


这样tinyproxy只能够代理filter文件中指定的URL,我们在filter文件中添写上我们的目标代理主机就可以了:
hit.edu.cn



阅读(3538) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~