DansGuardian

DansGuardian可以限制客户端的访问,通过这个软件,我们可以限制哪些网站不可以访问、哪些内容不能下载。

1、下载DansGuardian,提供一个网址http://www.rpmfind.net/linux/RPM/dag/redhat/el5/i386/dansguardian-2.8.0.6-1.2.el5.rf.i386.html

2、安装

[root@localhost wj]# rpm -ivh dansguardian-2.8.0.6-1.2.el5.rf.i386.rpm 

warning: dansguardian-2.8.0.6-1.2.el5.rf.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY

Preparing...               ########################################### [100%]

   1:dansguardian          ########################################### [100%]

3、修改配置文件“/etc/dansguardian/dansguardian.conf”,搜索“filterport”将端口改为8088。默认是8080,和tomcat冲突。关于proxyport端口,使用的是proxy服务器端口,默认3128,如果你修改了proxy的端口,那么这里也要改成对应的端口。

[root@localhost wj]# gedit /etc/dansguardian/dansguardian.conf

# the port that DansGuardian listens to.

filterport = 8088

4、配置防火墙,打开tcp的8088端口

[root@localhost wj]# gedit /etc/sysconfig/iptables

 -A INPUT -m state --state NEW -m tcp -p tcp --dport 8088 -j ACCEPT

 

[root@localhost wj]# service iptables restart

iptables:将链设置为政策 ACCEPTfilter nat                [确定]

iptables:清除防火墙规则:                                 [确定]

iptables:正在卸载模块:                                   [确定]

iptables:应用防火墙规则:                                 [确定]

iptables:载入额外模块:nf_conntrack_ftp                   [确定]

5、启动服务

[root@localhost wj]# service dansguardian start

正在关闭 Web Content Filter (dansguardian)               [确定]

启动 Web Content Filter (dansguardian)                   [确定]

6、修改客户端的代理设置,将代理端口改成dansguardian的端口8088,然后去百度一些内容,不良的网站就被屏蔽了。注意,这里端口必须修改,不可以使用3128. 

7、增加过滤网址。

1)修改配置文件“/etc/dansguardian/bannedsitelist”,在后面追加要过滤的网址。重启服务

[root@localhost wj]# gedit /etc/dansguardian/bannedsitelist

# You will need to edit to add and remove categories you want

news.baidu.com

 

[root@localhost wj]# service dansguardian restart

正在关闭 Web Content Filter (dansguardian)               [确定]

启动 Web Content Filter (dansguardian)                   [确定]

2)客户端访问百度新闻

8、过滤关键字

1)修改配置文件“/etc/dansguardian/bannedphraselist”,在后面追加要过滤的网址。重启服务

[root@localhost wj]# gedit /etc/dansguardian/bannedphraselist

# To block any page with words that contain the string "sex". (ie. sexual)

<sex>

 

[root@localhost wj]# service dansguardian restart

正在关闭 Web Content Filter (dansguardian)               [确定]

启动 Web Content Filter (dansguardian)                   [确定]

2)使用客户端浏览器搜索sex,发现网页打不开

9、过滤下载内容

1)修改配置文件“/etc/dansguardian/bannedextentsionlist”,里面默认已经有很多被禁止下载的格式了,如果要去掉某个限制,在前面加#

[root@localhost wj]# gedit /etc/dansguardian/bannedextentsionlist

#Banned extension list

.ade  # Microsoft Access project extension

.adp  # Microsoft Access project

.asx  # Windows Media Audio / Video

.bas  # Microsoft Visual Basic class module

.bat  # Batch file

.cab  # Windows setup file

.chm  # Compiled HTML Help file

.cmd  # Microsoft Windows NT Command script

 

[root@localhost wj]# service dansguardian restart

正在关闭 Web Content Filter (dansguardian)               [确定]

启动 Web Content Filter (dansguardian)                   [确定]

2)使用客户端浏览器下载一个文件

10、查看日志。可以通过日志文件“/var/log/dansguardian/access.log”来分析当前哪些内容被拦截了。

[root@localhost wj]# gedit /var/log/dansguardian/access.log 

Sella&utm_term=wkjxxx0913 *DENIED* 禁止的文件扩展名: .exe GET 0

2018.8.15 16:29:07 - 192.168.0.112 http://xiazai.mindmanager.cc/favicon.ico  GET 345

2018.8.15 16:30:28 192.168.0.112 http://trackercdn.kugou.com/i/v2/?cmd=26&pid=4&authType=1&hash=1319C71BC5CBF32EF1495CECDA23AF24&key=b1e358948cb6ce56a6c37cc88f408419&behavior=play&

module=&appid=1155&mid=bc7ba9731b77d3e10d329f751e774f1c&userid=0&token=&version=2.6.4&vipType=0&album_id=517209  GET 318

最新文章

  1. git各种命令介绍以及碰到的各种坑
  2. 面向对象的JavaScript(3):私有成员和公开成员
  3. JS获取url参数及url编码、解码
  4. shell变量的使用
  5. HDU 4819 Mosaic(13年长春现场 二维线段树)
  6. Thu夏令营 总结
  7. hdu 4289 Control(最小割 + 拆点)
  8. iOS开发UI篇—实现一个私人通讯录小应用【转】
  9. 20175306 MyCP博客总结
  10. Spring Boot 设置静态资源访问
  11. 【JS小技巧】JavaScript 函数用作对象的隐藏问题(F.ui.name)
  12. PyTorch中的backward [转]
  13. Json 简记
  14. Windows激活客户端 已停止工作
  15. Dubbo 源码分析系列之一环境搭建
  16. Java中关于类型自动提升的两个注意点。
  17. vue打包报内存溢出
  18. PHP序列及反序列化安全漏洞
  19. unidbgrid列排序
  20. 对datagridview进行增删改(B)

热门文章

  1. Unity3D NGUI 二 NGUI Button怎样接受用户点击并调用函数,具体方法名称是什么
  2. node.js发送邮件email
  3. Fiddler 教程(转载,鉴于原作者关闭了访问fiddler系列文章)
  4. Elasticsearch 不同的搜索类型之间的区别
  5. CH0103最短Hamilton路径 &amp; poj2288 Islands and Brigdes【状压DP】
  6. 极大既然估计和高斯分布推导最小二乘、LASSO、Ridge回归
  7. HDU 3507 - Print Article - [斜率DP]
  8. remove unusable kernel in linux.
  9. webpack初入门
  10. Number Sequence--POJ1019