当前位置:网站首页>如何关闭一个开放的DNS解析器
如何关闭一个开放的DNS解析器
2022-06-30 23:19:00 【星哥玩云】
我们在之前的教程中创建的DNS服务器是一个开放DNS解析器。开放解析器不会过滤任何来源请求,并会接受来自所有IP的查询。
--------------------------------------分割线 --------------------------------------
推荐阅读:
使用BIND配置DNS服务器---初级篇 http://www.linuxidc.com/Linux/2013-05/84920.htm
BIND+DLZ+MySQL智能DNS的正向解析和反向解析实现方法 http://www.linuxidc.com/Linux/2013-04/82527.htm
域名服务BIND构建与应用配置 http://www.linuxidc.com/Linux/2013-04/82111.htm
Ubuntu BIND9泛域名解析配置 http://www.linuxidc.com/Linux/2013-03/81928.htm
CentOS 5.2下安装BIND9.6 http://www.linuxidc.com/Linux/2013-02/79889.htm
--------------------------------------分割线 --------------------------------------
不幸的是,开放解析器很容易成为一个攻击目标。比如,攻击者可以对开放DNS服务器发起一个拒绝服务攻击(DoS)或者更糟的分布式拒绝服务攻击(DDoS)。这些也可与IP欺骗结合,将应答包指向受害者被欺骗的IP地址。在另外的场合下称作DNS放大攻击,开放的DNS服务器很容易就会成为攻击的对象。
根据openresolverproject.org,除非有必要,运行一个开放解析器是不明智的。大多数公司要让它们的DNS服务器仅对他们的客户开放。本篇教程会只要集中于如何配置一个DNS服务器来使它停止开放解析且仅对有效的客户响应。
调整防火墙
由于DNS运行在UDP的53端口上,系统管理可能试图仅允许来自53端口的客户端IP地址,并阻止剩余的因特网端口。虽然这可以工作,但是也会有一些问题。既然根服务器与DNS服务器的通信也用53端口,我们不得不在防火墙内也确保UDP 53端口被允许。
一个防火墙示例如下所示。对于生产服务器,确保你的规则匹配你的要求并遵守与公司安全制度。
- # vim firewall-script
- ## existing rules are flushed to start with a new set of rules ##
- iptables -F
- iptables -A INPUT -s A.A.A.A/X -p udp --dport 53-j ACCEPT
- iptables -A INPUT -s B.B.B.B/Y -p udp --dport 53-j ACCEPT
- iptables -A INPUT -s C.C.C.C/Z -p udp --dport 53-j ACCEPT
- iptables -A INPUT -p udp --dport 53-j DROP
- ## making the rules persistent ##
- service iptables save
让脚本可执行并运行它。
- # chmod +x firewall-script
- # ./firewall-script
阻止递归查询
DNS查询主要可以分为递归查询和迭代查询。对于递归查询,服务器会响应客户端应答或者错误信息。如果应答不在服务器的缓存中,服务器会与根服务器通信并获得授权域名服务器。服务器会不停查询知道获得结果,或者请求超时。对于迭代查询,另一个方面讲,服务器会将客户端指向另外一个可能可以处理的服务器上,那么就会减少服务器自身的处理。
我们可以控制运行递归查询的IP地址。我们修改位于/etc/named.conf的配置文件并增加/修改下面的参数。
- # vim /etc/named.conf
- ## we define ACLs to specify the source address/es ##
- acl customer-a{ A.A.A.A/X;};
- acl customer-b { B.B.B.B/Y; C.C.C.C/Z;};
- ## we call the ACLs under options directive ##
- options {
- directory "/var/named";
- allow-recursion { customer-a; customer-b;};
- };
调整用于开放解析器的防火墙
如果你必须运行一个开放解析器,建议你适当调节一下你的服务器,这样就不会被利用了。smurfmonitor 仓库提供了强大的一组可以用于开放解析器的iptables规则,比如阻止来自DNS放大攻击的域名解析请求。这个仓库会定期地更新,强烈建议DNS服务器管理员使用它。
总的来说,对于开放DNS解析器的攻击是很常见的,特别是对于没有适当安全防护的DNS服务器而言。这个教程延时了如何禁止一个开放DNS服务器。我们同样看到了如何使用iptables在一个开放DNS服务器上加上一层安全防护。
希望这对你有用。
边栏推荐
- Understand target detection in one article: r-cnn, fast r-cnn, fast r-cnn, Yolo, SSD "suggestions collection"
- 1175. 质数排列 / 剑指 Offer II 104. 排列的数目
- 智慧路灯| 云计算点亮智慧城市的“星星之火”
- Flitter - sort list sort
- Architecture of IM integrated messaging system sharing 100000 TPS
- How to distinguish between platform security and online hype? What are the stop loss techniques for online speculation?
- 76 page comprehensive solution 2022 for smart Logistics Park (download attached)
- 5g smart building solution 2021
- 如何使用 DataAnt 监控 Apache APISIX
- What are the contents and processes of software validation testing? How much does it cost to confirm the test report?
猜你喜欢

Fastjson V2 simple user manual

Solution to the conflict between unique index and logical deletion

Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance

What does project management really manage?

MIT doctoral dissertation optimization theory and machine learning practice

Redis - 01 缓存:如何利用读缓存提高系统性能?

Solve arm_ release_ ver of this libmali is ‘g2p0-01eac0‘,rk_ so_ Ver is' 4 ', libgl1 mesa dev will not be installed, and there are unsatisfied dependencies

In 2022, the latest JCR officially released the list of the latest global impact factors (top 600)

Fastjson V2 简单使用手册

RIDE:获取图片base64
随机推荐
Asynchronous transition scenario - generator
Doker's container data volume
Redis的事务和锁机制
基金客户服务
零样本和少样本学习
Braces on the left of latex braces in latex multiline formula
[Android, kotlin, tflite] mobile device integration depth learning light model tflite (image classification)
leetcode:104. Maximum depth of binary tree
What does project management really manage?
PS2 handle-1 "recommended collection"
有孚网络混合云,加速企业数字化转型升级
基金銷售行為規範及信息管理
Ms17-010 Eternal Blue vulnerability of MSF
RIDE:获取图片base64
未来十年世界数字化与机器智能展望
76 page comprehensive solution 2022 for smart Logistics Park (download attached)
Fund sales code of conduct and information management
理想中的接口自动化项目
206页上海BIM技术应用与发展报告2021
股票开户要如何办理呢?办理手机开户安全吗