博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux服务器---DansGuardian
阅读量:7058 次
发布时间:2019-06-28

本文共 3240 字,大约阅读时间需要 10 分钟。

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:将链设置为政策 ACCEPT:filter 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.  

      
072302m4bgg4g1xn2wwn1w.png

      
072302u4i8x68a6w864i8r.png



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)客户端访问百度新闻

      
072303wc41441e4gchoehh.png



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,发现网页打不开

      
072304lj1z4mws7ezm4jtq.png

      
072304lxxsqln5hlq5iubz.png



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)使用客户端浏览器下载一个文件

      
072305um9zftiftifi3ifx.png



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

转载地址:http://jqgol.baihongyu.com/

你可能感兴趣的文章
我的友情链接
查看>>
对于Mysql大量数据查询速度慢的问题
查看>>
tomcat中的server.xml
查看>>
我的友情链接
查看>>
Error After switch Domain
查看>>
Prepare NetApp iSCSI LUN for Xen or VMware
查看>>
so wie ich 像我这样的人
查看>>
Excel小例子--找到小组内完成专利的情况
查看>>
windows 下php5 开启 mcrypt
查看>>
MongoDB数据同步工具之 MongoShake
查看>>
rhel5 搭建KVM
查看>>
iOS中Json解析的四种方法
查看>>
购物车--low版
查看>>
linux
查看>>
Windows Server 2012 R2 VDI系列(七)—发布RemoteApp
查看>>
PHP中的替换strtr
查看>>
Apache和nginx 301重定向
查看>>
LINQ分页和排序,skip和Take 用法
查看>>
Activiti 查找流程状态(流程下一步)
查看>>
深度优先和广度优先
查看>>