ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux中限制客户不能上指定的网站(转)

linux中限制客户不能上指定的网站(转)

原创 Linux操作系统 作者:post0 时间:2007-08-10 13:23:35 0 删除 编辑
linux中限制客户不能上指定的网站(转)[@more@]

首先参考proxy的架设把它run 起来 然后

一、把区网对外的联机都转到 proxy 3128 port

iptables -t nat -A PREROUTING -i eth0 -p tcp -s 192.168.1.0/24 --dport 80 -j REDIRECT --to-ports 3128

二、修改 /etc/squid/squid.conf

acl BadPagesURL urlpath_regex "/usr/local/squid/etc/badpages.txt"

#把要挡的网站写在上面的档案中

acl BadPagesTAG urlpath_regex "/usr/local/squid/etc/badKeyWord.txt"

#把要挡的关键词写在上面的档案中

http_access allow !BadPagesURL

http_access allow !BadPagesTAG

# 若打 all 就是开全部 , 惊叹号是代表相反的意思.有人用deny

deny_info ERR_BAD_CLIENT_DENIED BadPage

(一)以挡网站为例:在 squid.conf 中设定方式如下:

acl denydn dstdomain "/usr/local/squid/etc/denydn.txt"

http_access deny denydn

请注意:在 denyurl.txt 檔中,每个想要挡掉的网址,须一个项目写成一行。

(二)挡掉特定的网页,在 squid.conf 中设定方式如下:

acl denyurl url_regex "/usr/local/squid/etc/denyurl2.txt"

http_access deny denyurl

注意:在 denyurl2.txt 檔中,每个想要挡掉的网页项目,须一个项目写成一行。

(三)挡掉特定的网页,在 squid.conf 中设定方式如下:

acl denyurlpath urlpath_regex -i "/usr/local/squid/etc/denyurl3.txt"

http_access deny denyurlpath

同上:在 denyurl3.txt 檔中,每个想要挡掉的字词项目,须一个项目写成一

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8225414/viewspace-940799/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    2018
  • 访问量
    8224964