ImageVerifierCode 换一换
格式:DOC , 页数:7 ,大小:120.50KB ,
资源ID:6964692      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-6964692.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(使用fail2ban+iptables防范VOIP攻击.doc)为本站会员(hyngb9260)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

使用fail2ban+iptables防范VOIP攻击.doc

1、FreeSWITCH VOIP 攻击防范说明1. 总体说明使用 fail2ban+iptables 相结合,防范 VOIP 攻击。2. Fail2ban 安装与配置2.1 安装 Fail2banA、 安装 yum。(略)B、 安装 EPEL 源#rpm -ivh http:/ fail2ban#yum install fail2ban2.2 配置 Fail2ban2.2.1 配置日志级别及路径文件:/etc/fail2ban/fail2ban.conf默认 fail2ban.conf 里面就三个参数,而且都有注释。#默认日志的级别loglevel = 3#日志的存放路径logtarget =

2、/var/log/fail2ban.log#socket 的位置socket = /tmp/fail2ban.sock我们主要修改日志的存放路径,修改为/var/log/fail2ban.log2.2.2 Fail2ban 全局配置文件:/etc/fail2ban/jail.conf# vi /etc/fail2ban/jail.conf#忽略 IP 的范围 如果有二组以上用空白做为间隔ignoreip = 127.0.0.1# 设定 IP 被封锁的时间( 秒),如果值为 -1,代表永远封锁bantime = 600# 设定在多少时间内达到 maxretry 的次数就封锁findtime =

3、600# 设定在多少时间内达到 maxretry 的次数就封锁maxretry = 3# 允许尝试的次数上面设置的意思是如果在 findtime 内达到 maxretry,则进行封锁,封锁时间是 bantime。即十分钟内重试 3 天都失败的话,客户端所在的 IP 会被封锁 10 分钟。3. FreeSWITCH 配置使用 fail2ban 时,需要开启 freeswitch 的注册错误日志,以便进行跟踪:文件:/usr/local/uswitch/conf/sip_profiles/internal.xml将下面的属性设置为 true,如下所示:4. 防火墙 iptables 配置4.1 开

4、启防火墙使用以下命令开启防火墙:# chkconfig iptables on注:如果需要关闭防火墙的话,使用命令 chkconfig iptables off 即可。4.2 开放 SIP 相关端口A、 修改防火墙配置文件: /etc/sysconfig/iptables-config将下面两个圈出来的属性修改为 yes,如下所示:B、 重启防火墙#service iptables restart C、 增加开放的 SIP 端口文件:/etc/sysconfig/iptables在 iptables 中添加如下的语句:#FreeSwith-A RH-Firewall-1-INPUT -m ud

5、p -p udp -dport 1719 -j ACCEPT-A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 1720 -j ACCEPT-A RH-Firewall-1-INPUT -m udp -p udp -dport 3478 -j ACCEPT-A RH-Firewall-1-INPUT -m udp -p udp -dport 3479 -j ACCEPT-A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 5002 -j ACCE

6、PT-A RH-Firewall-1-INPUT -m udp -p udp -dport 5003 -j ACCEPT-A RH-Firewall-1-INPUT -m udp -p udp -dport 5060 -j ACCEPT-A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 5060 -j ACCEPT-A RH-Firewall-1-INPUT -m udp -p udp -dport 5070 -j ACCEPT-A RH-Firewall-1-INPUT -m state -state NEW -m

7、tcp -p tcp -dport 5070 -j ACCEPT-A RH-Firewall-1-INPUT -m udp -p udp -dport 5080 -j ACCEPT-A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 5080 -j ACCEPT-A RH-Firewall-1-INPUT -m udp -p udp -m multiport -dports 16384:32768 -j ACCEPT#end of FreeSwitch注:上面的规则在防火墙中添加了 SIP 和 RTP 端口。D、 重启防

8、火墙需要重启防火墙,使上面的配置生效:#service iptables restart5. Fail2ban 防范攻击配置5.1 防范 SIP 注册失败攻击该攻击是由攻击方短时间内大量发起 SIP 注册消息,导致服务器瘫痪。5.1.1 增加规则匹配文件#vi /etc/fail2ban/filter.d/freeswitch.conf在/etc/fail2ban/filter.d 下新建 freeswitch.conf 文件,内容如下:# Fail2Ban configuration file# Author: Rupa SChomaker#Definition# Option: failr

9、egex# Notes.: regex to match the password failures messages in the logfile. The# host must be matched by a group named “host“. The tag “ can# be used for standard IP/hostname matching and is only an alias for# (?:f4,6:)?(?Pw-._+)# Values: TEXT#failregex = WARNING sofia_reg.c:d+ SIP auth failure (REG

10、ISTER) on sofia profile w+ for .* from ip WARNING sofia_reg.c:d+ SIP auth failure (INVITE) on sofia profile w+ for .* from ip # Option: ignoreregex# Notes.: regex to ignore. If this regex matches, the line is ignored.# Values: TEXT#ignoreregex =5.1.2 修改 jail.conf 文件#vi /etc/fail2ban/jail.conf在文件的最后添

11、加上如下的内容:freeswitch-tcpenabled = trueport = 5060,5061,5080,5081protocol = tcpfilter = freeswitchlogpath = /usr/local/freeswitch/log/freeswitch.logaction = iptables-allportsname=freeswitch-tcp, protocol=allsendmail-whoisname=FreeSwitch, dest=root, sender=fail2banexample.orgfreeswitch-udpenabled = true

12、port = 5060,5061,5080,5081protocol = udpfilter = freeswitchlogpath = /usr/local/freeswitch/log/freeswitch.logaction = iptables-allportsname=freeswitch-udp, protocol=allsendmail-whoisname=FreeSwitch, dest=root, sender=fail2banexample.org5.1.3 重启 fail2ban#/etc/init.d/fail2ban restart5.1.4 检查规则是否被加载进 i

13、ptables 中#iptables -L fail2ban-freeswitch-udp#iptables -L fail2ban-freeswitch-tcp如果出现如下结果,则证明配置正确:5.1.5 测试是否有效使用 easytalk,连续多次用错误的密码进行登录。超过三次后就会提示服务器无法连接,说明该 IP 已被服务器封锁。5.2 防范 SIP DOS 攻击当 freeswitch 的日志中连续大量出现相同号码的日志信息时,说明已被 DOS 攻击:在这种情况下,需要在 fail2ban 中增加新的规则,以避免该攻击:5.2.1 增加规则匹配文件#vi /etc/fail2ban/f

14、ilter.d/freeswitch-dos.conf在/etc/fail2ban/filter.d 下新建 freeswitch-dos.conf 文件,内容如下:# Fail2Ban configuration file# Author: soapee01#Definition# Option: failregex# Notes.: regex to match the password failures messages in the logfile. The# host must be matched by a group named “host“. The tag “ can# be

15、 used for standard IP/hostname matching and is only an alias for# (?:f4,6:)?(?Pw-._+)# Values: TEXT#failregex = WARNING sofia_reg.c:d+ SIP auth challenge (REGISTER) on sofia profile w+ for .* from ip # Option: ignoreregex# Notes.: regex to ignore. If this regex matches, the line is ignored.# Values:

16、 TEXT#ignoreregex =5.2.2 修改 jail.conf 文件#vi /etc/fail2ban/jail.conf在文件的最后添加上如下的内容:freeswitch-dosenabled = trueport = 5060,5061,5080,5081protocol = udpfilter = freeswitch-doslogpath = /usr/local/freeswitch/log/freeswitch.logaction = iptables-allportsname=freeswitch-dos, protocol=allmaxretry = 50findtime = 30bantime = 60005.2.3 重启 fail2ban#/etc/init.d/fail2ban restart6. 开机自启动使用下面的命令实现 fail2ban 的开机自启动:#chkconfig -level 345 fail2ban on#service fail2ban start7. 注意事项1)在重启 iptables 后,一定要记得重启 fail2ban。

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报