千家信息网

Linux服务器中DansGuardian的安装配置方法

发表于:2025-12-03 作者:千家信息网编辑
千家信息网最后更新 2025年12月03日,这篇文章主要介绍"Linux服务器中DansGuardian的安装配置方法",在日常操作中,相信很多人在Linux服务器中DansGuardian的安装配置方法问题上存在疑惑,小编查阅了各式资料,整理
千家信息网最后更新 2025年12月03日Linux服务器中DansGuardian的安装配置方法

这篇文章主要介绍"Linux服务器中DansGuardian的安装配置方法",在日常操作中,相信很多人在Linux服务器中DansGuardian的安装配置方法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"Linux服务器中DansGuardian的安装配置方法"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

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)

[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

到此,关于"Linux服务器中DansGuardian的安装配置方法"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!

0