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

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博客 ” ,链接:http://blog.itpub.net/8225414/viewspace-940799/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8225414/viewspace-940799/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值