三二互联专业提供速度最快最稳定的美国服务器、香港服务器。中美直连,亚洲优化![ 代理登陆 ] [ 付款方式 ] [ 找回密码 ][ 电子协议责任书 ]
硬件资源保障

采用高配品牌服务器

主流强悍CPU配置

确保服务高速稳定运行

中美直连线路

中美直连亚洲优化

采用中国CN2骨干网络

保证速度飞快稳定高效

如何配置Windows Server 2022的安全策略?

美国、香港服务器

如何配置Windows Server 2022的安全策略?

07-13   来源:

 一、账户策略

方式 1:图形界面配置(secpol.msc)
Win+R输入 secpol.msc 打开【本地安全策略】→账户策略
1)密码策略(推荐参数)
表格
配置项 设置值
密码必须符合复杂性要求 启用
密码长度最小值 14 位
密码最短使用期限 1 天
密码最长使用期限 60 天
强制密码历史 24 个旧密码
用可还原的加密来储存密码 禁用
2)账户锁定策略(这次账号锁定的根源)
账户锁定阈值:5 次无效登录直接锁定
账户锁定持续时间:30 分钟
重置账户锁定计数器:30 分钟
方式 2:PowerShell 一键执行(管理员 PS 复制运行)
powershell
#配置密码长度、有效期
net accounts /minpwlen:14 /maxpwage:60 /minpwage:1 /uniquepw:24
#配置登录失败锁定策略
net accounts /lockoutthreshold:5 /lockoutduration:30 /lockoutwindow:30
#开启密码复杂度
secedit /export /cfg C:\secpol.cfg
(Get-Content C:\secpol.cfg) -replace "PasswordComplexity = 0","PasswordComplexity = 1" | Set-Content C:\secpol_new.cfg
secedit /configure /db "$env:windir\security\local.sdb" /cfg C:\secpol_new.cfg /areas SECURITYPOLICY
#强制策略生效
gpupdate /force
解锁账号命令:
powershell
Unlock-LocalUser -Name "Administrator"
二、安全选项配置(secpol.msc → 本地策略‑安全选项,PowerShell 命令版)
1. 禁止空白密码远程登录(必做)
powershell
secedit /export /cfg C:\secpol.cfg
(Get-Content C:\secpol.cfg) -replace "LimitBlankPasswordUse = 0","LimitBlankPasswordUse = 1" | Set-Content C:\secpol_new.cfg
secedit /configure /db "$env:windir\security\local.sdb" /cfg C:\secpol_new.cfg /areas SECURITYPOLICY
gpupdate /force
2. 重命名默认管理员账号(降低扫描命中率)
图形方式:计算机管理( compmgmt.msc ) →本地用户和组→用户,把Administrator改名;
PowerShell 命令:
powershell
Rename-LocalUser -Name "Administrator" -NewName "Admin_xxxx"
3. 启用 LSA 保护,防止密码哈希窃取
cmd
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RunAsPPL /t REG_DWORD /d 1 /f
三、防火墙加固(重中之重,解决 3389 全网被爆破)
1. 基本原则:默认拒绝所有入站,只放行必要端口,3389 禁止全网开放
① 删除默认 3389 全网放行规则(管理员 PowerShell 执行)
powershell
Remove-NetFirewallRule -DisplayName "远程桌面‑TCP‑入站" -Confirm:$false
② 只允许你的公网 IP 访问 3389(替换成你自己的公网 IP)
powershell
New-NetFirewallRule -DisplayName "RDP‑仅本人IP访问" -Direction Inbound -Protocol TCP -LocalPort 3389 -RemoteAddress "你的公网IP/32" -Action Allow -Profile Any
③ 禁用高危端口 135,139,445(防止勒索病毒永恒之蓝)
powershell
New-NetFirewallRule -DisplayName "阻断高危端口135‑139‑445" -Direction Inbound -Protocol TCP -LocalPort 135,139,445 -Action Block -Profile Any
④ 开启防火墙日志,记录攻击 IP
powershell
Set-NetFirewallProfile -Profile Domain,Private,Public -LogBlocked True -LogAllowed False -LogMaxSizeKilobytes 16384
查看防火墙全部规则:
powershell
Get-NetFirewallRule -Direction Inbound | Select DisplayName,LocalPort,RemoteAddress,Enabled
四、关闭无用高危服务(PowerShell 执行)
关闭不需要的服务,减少攻击面:
powershell
#禁用远程注册表
Stop-Service RemoteRegistry -Force
Set-Service RemoteRegistry -StartupType Disabled
#禁用打印服务
Stop-Service Spooler -Force
Set-Service Spooler -StartupType Disabled
#禁用UPnP设备发现
Stop-Service SSDPSRV -Force
Set-Service SSDPSRV -StartupType Disabled
五、禁用老旧不安全协议
1. 关闭 SMB1
powershell
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
执行完成后重启服务器,只保留安全的 SMB3.0。
2. 关闭 TLS1.0、TLS1.1,只启用 TLS1.2、TLS1.3(IIS 网站 HTTPS 安全)
powershell
New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server" -Force
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server" -Name "Enabled" -Value 0 -Type DWord
New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server" -Force
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server" -Name "Enabled" -Value 0 -Type DWord
六、开启系统审计日志,用来排查暴力破解来源 IP
1. 组策略开启审计(gpedit.msc)
计算机配置‑Windows 设置‑安全设置‑本地策略‑审核策略:
审核登录事件:成功 + 失败(开启)(事件 ID4625 就是 3389 暴力破解日志)
审核进程创建、特权使用开启;
2. PowerShell 查看登录失败日志(查看爆破 IP)
powershell
Get-WinEvent -FilterHashtable @{LogName="Security";Id=4625} | Select TimeCreated,Message

三二互联专业提供香港VPS,美国VPS主机,香港云服务器租用等业务香港美国到大陆CN2 GIA速度最快

上一篇:如何通过PowerShell配置Windows Server 2022的防火墙策略? 下一篇:如何使用PowerShell命令配置密码策略中的密码最长使用期限?

美国GIA服务器三二互联版权所有 WWW.250.cc 2008-2015 All Rights Reserved
三二互联 - 专业的美国C3服务器香港vps、抗DOOS流量清洗、云备份系统、网站加速系统、美国GIA服务器和香港云服务器产品提供商
三二互联24小时在线工单系统为您提供全面、专业、周到的技术支持与服务
咨询热线:400-679-9994(免长话费)