勒索病毒,华为/H3C三层交换机/路由器用ACL访问控制实现端口禁用
转摘自:https://www.cnblogs.com/chling/archive/2019/09/11/11505353.html
前不久勒索病毒横行,很多人都纷纷中招,从公司到个人,损失相当惨重。有些公司在互联网入口上做了控制,但是这样并非完全,万一有人把中了毒的U盘插入网内设备上呢?那我们的内网中很有可能集体中招(打过相关补丁的除外)。
我们今天就说说如何在路由、交换机上实现相应的访问控制,封堵相关端口,防止病毒在网络内部蔓延。以华为和H3C设备配置为例。
#
acl number 3100 //创建ALC控制规则
rule 5 deny tcp destination-port eq 445 //禁止TCP 445端口数据
rule 10 deny tcp destination-port eq 135
rule 15 deny tcp destination-port eq 137
rule 20 deny tcp destination-port eq 138
rule 25 deny tcp destination-port eq 139
rule 30 deny udp destination-port eq 445
rule 35 deny udp destination-port eq 135
rule 40 deny udp destination-port eq 137
rule 45 deny udp destination-port eq 138
rule 50 deny udp destination-port eq 139
#
traffic classifier anti_wana operator or precedence 5 //创建流分类
if-match acl 3100 //将ACL与流分类关联
#
traffic behavior anti_wana //创建流行为
deny //动作为禁止
statistic enable //使能流量统计(可选)
#
traffic policy anti_wana match-order config //创建流策略
classifier anti_wana behavior anti_wana //将流分类和流行为进行关联
[全局视图]
traffic-policy anti_wana global inbound //全局应用入方向流策略
traffic-policy anti_wana global outbound //全局应用出方向流策略
[接口视图] 也可以根据使用接口在接口上应用相关流策略
traffic-policy anti_wana inbound
traffic-policy anti_wana outbound
H3C
大部分配置相同,毕竟本是同根生啊。
#
acl number 3100 //创建ALC控制规则
rule 5 deny tcp destination-port eq 445
rule 10 deny tcp destination-port eq 135
rule 15 deny tcp destination-port eq 137
rule 20 deny tcp destination-port eq 138
rule 25 deny tcp destination-port eq 139
rule 30 deny udp destination-port eq 445
rule 35 deny udp destination-port eq 135
rule 40 deny udp destination-port eq 137
rule 45 deny udp destination-port eq 138
rule 50 deny udp destination-port eq 139
#
traffic classifier anti_wana operator and //创建流分类
if-match acl 3100 //将ACL与流分类关联
#
traffic behavior anti_wana //创建流行为
filter deny //动作为禁止
#
qos policy anti_wana //创建流策略
classifier anti_wana behavior anti_wana //将流分类和流行为进行关联
[接口视图]
qos apply policy anti_wana inbound
qos apply policy anti_wana outbound
[全局视图]基于全局应用QoS策略仅在MPE单板(仅入方向)和SPC单板上生效;部分设备无法使用此命令,只能在接口上应用。
qos apply policy anti_wana global inbound
qos apply policy anti_wana global outbound
[Vlan视图]
#
interface vlan-interface1000
ip address 192.168.0.1 255.255.255.0
packet-filter 3100 inbound
近期勒索病毒发生了变异,3389端口也在攻击之列中,请在ACL中添加相关规则,以防不测!
rule 55 deny udp destination-port eq 3389
rule 60 deny tcp destination-port eq 3389
对特定ip限制其端口访问
acl number 3001
rule 0 deny tcp source 192.168.1.1 0 destination-port eq 445
rule 1 deny udp source 192.168.1.1 0 destination-port eq 445
rule 2 deny tcp source 192.168.1.1 0 source-port eq 445
rule 3 deny udp source 192.168.1.1 0 source-port eq 445
quit
int g 1/0/1
packet-filter 3001 inbound
packet-filter 3001 outbound
quit
int Vlan-interface 100
packet-filter 3001 inbound
packet-filter 3001 outbound
quit
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。