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

Linux服务器---DansGuardian的更多相关文章

  1. Linux服务器安全配置

    众所周知,网络安全是一个非常重要的课题,而服务器是网络安全中最关键的环节.Linux被认为是一个比较安全的Internet服务器,作为一种开放源代码操作系统,一旦Linux系统中发现有安全漏洞,Int ...

  2. .NET跨平台之旅:将QPS 100左右的ASP.NET Core站点部署到Linux服务器上

    今天下午我们将生产环境中一个单台服务器 QPS(每秒请求数)在100左右的 ASP.NET Core 站点部署到了 Linux 服务器上,这是我们解决了在 .NET Core 上使用 EnyimMem ...

  3. 如何使用Linux命令行查看Linux服务器内存使用情况?

    一个服务器,最重要的资源之一就是内存,内存够不够用,是直接关系到系统性能的关键所在. 本文介绍如何查看Linux服务器内存使用情况, 1.free命令 free -m [root@localhost ...

  4. 检查Linux服务器性能

    如果你的Linux服务器突然负载暴增,告警短信快发爆你的手机,如何在最短时间内找出Linux性能问题所在? 概述通过执行以下命令,可以在1分钟内对系统资源使用情况有个大致的了解. • uptime• ...

  5. linux下的ssh工具之,本地上传到linux服务器and Linux服务器文件另存为本地。非sftp工具。

    首先,当你只有一个ssh工具可以连接linux,但你有想把文件在 linux 和windows(本地)直接的切换.其实可以的: 本文参考 1.将本地的文件,放到ssh远程的linux服务器上: 首先要 ...

  6. CentOS Linux服务器安全设置

    转自:http://www.osyunwei.com/archives/754.html 引言: 我们必须明白:最小的权限+最少的服务=最大的安全 所以,无论是配置任何服务器,我们都必须把不用的服务关 ...

  7. 配置linux服务器的一些操作

    本次课程实验,我们选择的是ubuntu 14.04操作系统,不像使用RDP连接windows服务器那样可以直观的看到远程端的图形界面,只能通过Xshell以命令行进行操作,那么就来说说配置远程linu ...

  8. 用十条命令在一分钟内检查Linux服务器性能

    转自:http://www.infoq.com/cn/news/2015/12/linux-performance 如果你的Linux服务器突然负载暴增,告警短信快发爆你的手机,如何在最短时间内找出L ...

  9. Linux服务器宕机案例一则

    案例环境 操作系统 :Oracle Linux Server release 5.7 64bit 虚拟机 硬件配置 : 物理机型号为DELL R720 资源配置 :RAM 8G Intel(R) Xe ...

随机推荐

  1. 美团开源 SQL 优化工具 SQLAdvisor

    https://www.oschina.net/news/82725/sqladvisor-opensource https://github.com/Meituan-Dianping/SQLAdvi ...

  2. vs2010版本注释

    转:http://www.cnblogs.com/chaselwang/p/3580839.html 关于Visual Studio 20**自动添加头部注释信息 作为一个万年潜水党,不关这一篇文章技 ...

  3. vue--环境搭建(创建运行项目)

    如何搭建vue环境: 1.安装之前必须要安装 node.js 2.搭建Vue环境,安装vue的脚手架工具 npm install --global vue-cli / cnpm install --g ...

  4. 判断强联通图中每条边是否只在一个环上(hdu3594)

    hdu3594 Cactus Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) T ...

  5. Spring接受前台的数据超过256出现如下异常:

    转载自:http://blog.csdn.net/dracotianlong/article/details/47604723 Spring接受前台的数据超过256出现如下异常: org.spring ...

  6. Oracle卸载之Linux下卸载oracle11g的方法

    1.使用SQL*PLUS停止数据库  如果不能通过sysdba登陆可以用nolog用户登陆后切换至sysdba [oracle@OracleTest oracle]$ sqlplus /nolog S ...

  7. C#中DataSet、DataTable、DataReader的区别

    简单说就是:     DataSet:数据集.一般包含多个DataTable,用的时候,dataset["表名"]得到DataTable         DataTable:数据表 ...

  8. Rotate Image(二位数组顺时针旋转)

    问题描述: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockw ...

  9. cookie的封装写法

    设置cookie 三个参数分别代表:键,值,过期时间,这个封装方法可以完成cookie的储存   以及cookie的删除(过期时间设为赋值) function setCookie(cname,cval ...

  10. 异常处理:No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer

    No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no pro ...