Windows下使用powershell修改防火墙

Windows下使用powershell修改防火墙

前两天,领导给了我一个漏扫报告,让我看着弄,其中上图这一条是花了一点时间的,做一个记录。

以下是原文

6、允许Traceroute探测
整改建议:在防火墙出站规则中禁用echo-reply(type 0)、time-exceeded(type 11)、destination-unreachable(type 3)类型的ICMP包

当时看到的这个时候,想着很简单,看我firewall-cmd大法,分分钟拿下,后来发现是Windows系统下,然后有了以下语句,注意,使用管理员打开powershell,powershell版本是 5.1.14393.206,其余版本没有测试。

New-NetFirewallRule -DisplayName "Disable Outbound ICMP0" -Direction "Outbound" -Protocol "ICMPv4" -ICMPType 0 -Action "Block"
New-NetFirewallRule -DisplayName "Disable Outbound ICMP11" -Direction "Outbound" -Protocol "ICMPv4" -ICMPType 11 -Action "Block"
New-NetFirewallRule -DisplayName "Disable Outbound ICMP3" -Direction "Outbound" -Protocol "ICMPv4" -ICMPType 3 -Action "Block"

参考连接

https://learn.microsoft.com/en-us/powershell/module/netsecurity/new-netfirewallrule?view=winserver2012r2-ps&redirectedfrom=MSDN

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值