溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Windows2008R2系統一鍵安全優化腳本

發布時間:2020-08-06 19:31:11 來源:網絡 閱讀:2456 作者:ceeportw 欄目:系統運維
::author vim
::QQ 82996821
::filename Windows2008R2_safe_auto_set.bat

:start
@echo off
color 0a
@echo 請選擇要服務操作類型:
@echo 1.更改遠程端口,重啟后生效
@echo 2.目錄權限優化
@echo 3.系統服務優化
@echo 4.網絡安全優化[修改注冊表]
@echo 5.禁用所有IPV6組件,除IPV6環回接口
@echo 6.刪除系統默認共享
@echo 7.卸載ASP漏洞wshom.ocx,shell32.dll組件
@echo 8.組策略優化
@echo 9.關閉防火墻
@echo 0.退出

set/p a=請選擇服務操作類型:
goto start%a%

:start1
echo 請輸入要修改的遠程端口號:
set /p var=
echo 開始修改
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t REG_DWORD /d %var% /f
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d %var% /f
echo 修改成功,下面是添加防火墻規則
netsh advfirewall firewall add rule name="remote_"%var% protocol=TCP dir=in localport=%var% action=allow
@pause
cls
goto :start

:start2
echo 目錄權限優化
echo ==========================================================
::echo 降低C盤權限
::cacls C:\  /e /r "CREATOR OWNER" "Users" >>log.log

echo windows系統文件夾權限設置
takeown /F C:\Windows\System32
takeown /F C:\Windows\System32\config
cacls C:\Windows\System32 /e /r "CREATOR OWNER">>log.log
cacls C:\Windows\System32\config /e /r "CREATOR OWNER">>log.log

echo 程序文件權限設置
takeown /F "C:\Program Files\Windows NT\Accessories"
takeown /F "C:\Program Files\Internet Explorer\iexplore.exe"
takeown /F "C:\Program Files\Common Files"
cacls "C:\Program Files\Windows NT\Accessories"  /e /r "CREATOR OWNER" "Users" >>log.log
cacls "C:\Program Files\Internet Explorer\iexplore.exe" /e /r system users >>log.log
cacls "C:\Program Files\Common Files"  /e /r "CREATOR OWNER" "Users" >>log.log

echo 用戶配置信息的文件夾權限設置
takeown /F "C:\ProgramData\Documents"
takeown /F "C:\ProgramData\Application Data\Microsoft"
takeown /F "C:\ProgramData\Application Data"
takeown /F "C:\ProgramData\「開始」菜單"
takeown /F "C:\Documents and Settings"
cacls "C:\ProgramData\Documents" /e /r everyone >>log.log
cacls "C:\ProgramData\Application Data\Microsoft" /e /r everyone >>log.log
cacls "C:\ProgramData\Application Data" /e /r everyone >>log.log
cacls "C:\ProgramData\「開始」菜單" /e /r everyone >>log.log
cacls "C:\Documents and Settings"  /e /r everyone >>log.log

echo iis下的ASP,ASPX網站相關的EXE和DLL
takeown /F C:\Windows\System32\wscript.exe
takeown /F C:\Windows\System32\wshom.ocx
cacls  C:\Windows\System32\wscript.exe /e /r users >>log.log
cacls  C:\Windows\System32\wshom.ocx /e /r users >>log.log

echo windows系統文件夾下的關鍵二進制文件
takeown /f  C:\Windows\System32\zipfldr.dll
takeown /f  C:\Windows\System32\xcopy.exe
takeown /f  C:\Windows\System32\wshext.dll
takeown /f  C:\Windows\System32\where.exe
takeown /f  C:\Windows\System32\tracert.exe
takeown /f  C:\Windows\System32\syskey.exe
takeown /f  C:\Windows\System32\shutdown.exe
takeown /f  C:\Windows\System32\shadow.exe
takeown /f  C:\Windows\System32\setx.exe
takeown /f  C:\Windows\System32\sethc.exe
takeown /f  C:\Windows\System32\secedit.exe
takeown /f  C:\Windows\System32\sc.exe
takeown /f  C:\Windows\System32\runonce.exe
takeown /f  C:\Windows\System32\runas.exe
takeown /f  C:\Windows\System32\route.exe
takeown /f  C:\Windows\System32\replace.exe
takeown /f  C:\Windows\System32\regsvr32.exe
takeown /f  C:\Windows\System32\regedt32.exe
takeown /f  C:\Windows\System32\reg.exe
takeown /f  C:\Windows\System32\print.exe
takeown /f  C:\Windows\System32\powercfg.exe
takeown /f  C:\Windows\System32\ping.exe
takeown /f  C:\Windows\System32\nslookup.exe
takeown /f  C:\Windows\System32\notepad.exe
takeown /f  C:\Windows\System32\netstat.exe
takeown /f  C:\Windows\System32\netsh.exe
takeown /f  C:\Windows\System32\net1.exe
takeown /f  C:\Windows\System32\net.exe
takeown /f  C:\Windows\System32\mstsc.exe
takeown /f  C:\Windows\System32\mshta.exe
takeown /f  C:\Windows\System32\mountvol.exe
takeown /f  C:\Windows\System32\logoff.exe
takeown /f  C:\Windows\System32\ipconfig.exe
takeown /f  C:\Windows\System32\help.exe
takeown /f  C:\Windows\System32\gpupdate.exe
takeown /f  C:\Windows\System32\ftp.exe
takeown /f  C:\Windows\System32\format.com
takeown /f  C:\Windows\System32\finger.exe
takeown /f  C:\Windows\System32\find.exe
takeown /f  C:\Windows\System32\doskey.exe
takeown /f  C:\Windows\System32\cscript.exe
takeown /f  C:\Windows\System32\cmd.exe
takeown /f  C:\Windows\System32\cacls.exe
takeown /f  C:\Windows\System32\attrib.exe
takeown /f  C:\Windows\System32\at.exe
takeown /f  C:\Windows\System32\arp.exe
cacls  C:\Windows\System32\zipfldr.dll /e /r users >>log.log
cacls  C:\Windows\System32\xcopy.exe /e /r users >>log.log
cacls  C:\Windows\System32\wshext.dll /e /r users >>log.log
cacls  C:\Windows\System32\where.exe /e /r users >>log.log
cacls  C:\Windows\System32\tracert.exe /e /r users >>log.log
cacls  C:\Windows\System32\syskey.exe /e /r users >>log.log
cacls  C:\Windows\System32\shutdown.exe /e /r users >>log.log
cacls  C:\Windows\System32\shadow.exe /e /r users >>log.log
cacls  C:\Windows\System32\setx.exe /e /r users >>log.log
cacls  C:\Windows\System32\sethc.exe /e /r users >>log.log
cacls  C:\Windows\System32\secedit.exe /e /r users >>log.log
cacls  C:\Windows\System32\sc.exe /e /r users >>log.log
cacls  C:\Windows\System32\runonce.exe /e /r users >>log.log
cacls  C:\Windows\System32\runas.exe /e /r users >>log.log
cacls  C:\Windows\System32\route.exe /e /r users >>log.log
cacls  C:\Windows\System32\replace.exe /e /r users >>log.log
cacls  C:\Windows\System32\regsvr32.exe /e /r users >>log.log
cacls  C:\Windows\System32\regedt32.exe /e /r users >>log.log
cacls  C:\Windows\System32\reg.exe /e /r users >>log.log
cacls  C:\Windows\System32\print.exe /e /r users >>log.log
cacls  C:\Windows\System32\powercfg.exe /e /r users >>log.log
cacls  C:\Windows\System32\ping.exe /e /r users >>log.log
cacls  C:\Windows\System32\nslookup.exe /e /r users >>log.log
cacls  C:\Windows\System32\notepad.exe /e /r users >>log.log
cacls  C:\Windows\System32\netstat.exe /e /r users >>log.log
cacls  C:\Windows\System32\netsh.exe /e /r users >>log.log
cacls  C:\Windows\System32\net1.exe /e /r users >>log.log
cacls  C:\Windows\System32\net.exe /e /r users >>log.log
cacls  C:\Windows\System32\mstsc.exe /e /r users >>log.log
cacls  C:\Windows\System32\mshta.exe /e /r users >>log.log
cacls  C:\Windows\System32\mountvol.exe /e /r users >>log.log
cacls  C:\Windows\System32\logoff.exe /e /r users >>log.log
cacls  C:\Windows\System32\ipconfig.exe /e /r users >>log.log
cacls  C:\Windows\System32\help.exe /e /r users >>log.log
cacls  C:\Windows\System32\gpupdate.exe /e /r users >>log.log
cacls  C:\Windows\System32\ftp.exe /e /r users >>log.log
cacls  C:\Windows\System32\format.com /e /r users >>log.log
cacls  C:\Windows\System32\finger.exe /e /r users >>log.log
cacls  C:\Windows\System32\find.exe /e /r users >>log.log
cacls  C:\Windows\System32\doskey.exe /e /r users >>log.log
cacls  C:\Windows\System32\cscript.exe /e /r users >>log.log
cacls  C:\Windows\System32\cmd.exe /e /r users >>log.log
cacls  C:\Windows\System32\cacls.exe /e /r users >>log.log
cacls  C:\Windows\System32\attrib.exe /e /r users >>log.log
cacls  C:\Windows\System32\at.exe /e /r users >>log.log
cacls  C:\Windows\System32\arp.exe /e /r users >>log.log
@pause
cls
goto :start

:start3
echo 系統服務優化
echo ==========================================================
echo Background Intelligent Transfer Service 使用空閑網絡帶寬在后臺傳送文件。
sc config BITS start= disabled >>log.log
echo 關閉TCP/IP NetBIOS Helper 提供 TCP/IP (NetBT) 服務上的 NetBIOS 和網絡上客戶端的 NetBIOS 名稱解析的支持
sc config lmhosts start= disabled >>log.log
echo 關閉Network Location Awareness網絡訪問保護(NAP)代理服務
sc config NlaSvc start= disabled >>log.log
echo 關閉Remote Registry 遠程修改注冊表
sc config RemoteRegistry start= disabled >>log.log
echo 關閉Print Spooler 將文件加載到內存供稍后打印
sc config Spooler start= disabled >>log.log
echo 關閉Distributed Link linktracking client 用于局域網更新連接信息
sc config TrkWks start= disabled >>log.log
echo 關閉Shell Hardware Detection 為自動播放硬件事件提供通知。
sc config ShellHWDetection start= disabled >>log.log
echo 關閉Windows Update 啟用檢測、下載和安裝 Windows 和其他程序的更新。
sc config wuauserv start= disabled >>log.log
echo 關閉支持此計算機通過網絡的文件、打印、和命名管道共享。
sc config LanmanServer start= disabled >>log.log
@pause
cls
goto :start

:start4
echo 網絡安全優化[修改注冊表]
echo ==============備份注冊表在當前目錄=====================
reg export hklm hklm.reg
reg export hkcu hkcu.reg
reg export hkcr hkcr.reg
reg export hku hku.reg
reg export hkcc hkcc.reg

echo ===================優化注冊表=========================
echo 135端口主要用于使用遠程過程調用,服務器上一般不建議開啟
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole" /v EnableDCOM /t REG_SZ /d N /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc" /v "DCOM Protocols" /t REG_MULTI_SZ /f
reg add "HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys" /v Flags /t REG_SZ /d 506 /f

echo 445端口控制在局域網中輕松訪問各種共享文件夾或共享打印機,服務器上一般不建議開啟
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\NetBT\Parameters" /v SMBDeviceEnabled /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v SMBDeviceEnabled /t REG_DWORD /d 0 /f

echo IPC空連接可以使連接者與目標主機建立一個空的連接而無需用戶名與密碼,存在風險建議關閉
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa" /v restrictanonymous /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v restrictanonymous /t REG_DWORD /d 1 /f

echo 配置Backlog,提高網絡并發性及網絡的處理能力
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\AFD\Parameters" /v EnableDynamicBacklog /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\AFD\Parameters" /v MinimumDynamicBacklog /t REG_DWORD /d 20 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\AFD\Parameters" /v MaximumDynamicBacklog /t REG_DWORD /d 20000 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters" /v EnableDynamicBacklog /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters" /v MinimumDynamicBacklog /t REG_DWORD /d 20 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters" /v MaximumDynamicBacklog /t REG_DWORD /d 20000 /f

echo 通過優化該選項可提高系統防御SYN***的能力,建議優化
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services" /v SynAttackProtect /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services" /v EnableDeadGWDetect /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v SynAttackProtect /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TCPMaxPortsExhausted /t REG_DWORD /d 5 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v SynAttackProtect /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TCPMaxPortsExhausted /t REG_DWORD /d 5 /f

echo 通過優化設置SYN-ACK等待時間,可提高系統的網絡性能
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TcpMaxConnectResponseRetransmissions /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TcpMaxConnectResponseRetransmissions /t REG_DWORD /d 2 /f

echo 抵御SNMP***,檢查無效網關,以便優化網絡
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnableDeadGWDetect /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableDeadGWDetect /t REG_DWORD /d 0 /f

echo 抵御ICMP***,檢查有可能用以***的ICMP重定向報文
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnableICMPRedirects /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableICMPRedirects /t REG_DWORD /d 0 /f

echo 檢查TCPIP協議棧IGMP堆棧溢出本地拒絕服務***
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v IGMPLevel /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v IGMPLevel /t REG_DWORD /d 0 /f

echo 檢查是否禁止IP源路由,建議丟棄所有接受的源路由包
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v DisableIPSourceRouting /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v DisableIPSourceRouting /t REG_DWORD /d 2 /f

echo 禁止路由發現功能,ICMP路由通告報文可以被用來增加路由表紀錄,可以導致***
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v PerformRouterDiscovery /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces" /v PerformRouterDiscovery /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v PerformRouterDiscovery /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces" /v PerformRouterDiscovery /t REG_DWORD /d 0 /f

echo 更改ping命令返回的默認TTL值。***可通過些值判斷操作系統類型
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v DefaultTTL /t REG_DWORD /d 240 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces" /v DefaultTTL /t REG_DWORD /d 240 /f

echo 優化計算機在收到名稱釋放請求時是否釋放其NETBIOS名稱,使計算機受惡意的名稱釋放***
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\NetBT\Parameters" /v NoNameReleaseOnDemand /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters" /v NoNameReleaseOnDemand /t REG_DWORD /d 1 /f

echo 優化TCP閑置鏈接檢查時間,提升網絡性能
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v KeepAliveTime /t REG_DWORD /d 300000 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v KeepAliveTime /t REG_DWORD /d 300000 /f

echo 禁止進行最大包長度路徑檢測。如開啟該功能,***者可能將數據包強制分段,這公使堆棧不堪重負
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnablePMTUDiscovery /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnablePMTUDiscovery /t REG_DWORD /d 0 /f

echo 優化TCP半連接相關參數值,提升網絡性能
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TcpMaxHalfOpen /t REG_DWORD /d 500 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TcpMaxHalfOpenRetried /t REG_DWORD /d 400 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TcpMaxHalfOpen /t REG_DWORD /d 500 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TcpMaxHalfOpenRetried /t REG_DWORD /d 400 /f

echo 設置TCP重傳單個數據段的次數。缺少項值為5,缺省這一過程消耗時間240秒。微軟站點安全推薦為3
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v TcpMaxDataRetransmissions /t REG_DWORD /d 2 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v TcpMaxDataRetransmissions /t REG_DWORD /d 2 /f

echo 禁止轉發IP多播數據包。多播數據包可能被多臺主機響應,從而導致響應淹沒網絡
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnableMulticastForwarding /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableMulticastForwarding /t REG_DWORD /d 0 /f

echo 屏蔽網絡拓撲結構細節,防止***者利用主機響應來了解內部網絡情況
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters" /v EnableAddrMaskReply /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableAddrMaskReply /t REG_DWORD /d 0 /f
@pause
cls
goto :start

:start5
echo 禁用所有IPV6組件,除IPV6環回接口
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /v DisabledComponents /t REG_DWORD /d 0xffffffff /f
echo 禁用所有IPV6組件,除IPV6環回接口完畢
@pause
cls
goto :start

:start6
echo 刪除系統默認共享
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters" /v AutoShareServer /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters" /v AutoShareWks /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v RestrictAnonymous /t REG_DWORD /d 1 /f
echo 刪除系統默認共享完畢
@pause
cls
goto :start

:start7
echo 卸載ASP漏洞wshom.ocx,shell32.dll組件
regsvr32/u wshom.ocx >>log.log
regsvr32 /u shell32.dll >>log.log
echo 卸載ASP漏洞wshom.ocx,shell32.dll組件完畢
@pause
cls
goto :start

:start8
echo 組策略優化
echo ================備份組策略到當前目錄====================
secedit /export /cfg ./gpedit_bak.inf
echo ================恢復組策略優化后文件====================
secedit /configure /db temp.sdb /cfg ./gpedit_setup.inf
@pause
cls
goto :start

:start9
echo 關閉防火墻
netsh advfirewall set allprofiles state off
@pause
cls
goto :start

:start0
goto end
:end

##########windows_2008_R2_優化內容詳細#################


echo 目錄權限優化

echo ==========================================================

echo windows系統文件夾權限設置

C:\Windows\System32

C:\Windows\System32\config


echo 程序文件權限設置

"C:\Program Files\Windows NT\Accessories"

"C:\Program Files\Internet Explorer\iexplore.exe"

"C:\Program Files\Common Files"


echo 用戶配置信息的文件夾權限設置

"C:\ProgramData\Documents"

"C:\ProgramData\Application Data\Microsoft"

"C:\ProgramData\Application Data"

"C:\ProgramData\「開始」菜單"

"C:\Documents and Settings" 


echo iis下的ASP,ASPX網站相關的EXE和DLL

 C:\Windows\System32\wscript.exe

 C:\Windows\System32\wshom.ocx


echo windows系統文件夾下的關鍵二進制文件

 C:\Windows\System32\zipfldr.dll

 C:\Windows\System32\xcopy.exe

 C:\Windows\System32\wshext.dll

 C:\Windows\System32\where.exe

 C:\Windows\System32\tracert.exe

 C:\Windows\System32\syskey.exe

 C:\Windows\System32\shutdown.exe

 C:\Windows\System32\shadow.exe

 C:\Windows\System32\setx.exe

 C:\Windows\System32\sethc.exe

 C:\Windows\System32\secedit.exe

 C:\Windows\System32\sc.exe

 C:\Windows\System32\runonce.exe

 C:\Windows\System32\runas.exe

 C:\Windows\System32\route.exe

 C:\Windows\System32\replace.exe

 C:\Windows\System32\regsvr32.exe

 C:\Windows\System32\regedt32.exe

 C:\Windows\System32\reg.exe

 C:\Windows\System32\print.exe

 C:\Windows\System32\powercfg.exe

 C:\Windows\System32\ping.exe

 C:\Windows\System32\nslookup.exe

 C:\Windows\System32\notepad.exe

 C:\Windows\System32\netstat.exe

 C:\Windows\System32\netsh.exe

 C:\Windows\System32\net1.exe

 C:\Windows\System32\net.exe

 C:\Windows\System32\mstsc.exe

 C:\Windows\System32\mshta.exe

 C:\Windows\System32\mountvol.exe

 C:\Windows\System32\logoff.exe

 C:\Windows\System32\ipconfig.exe

 C:\Windows\System32\help.exe

 C:\Windows\System32\gpupdate.exe

 C:\Windows\System32\ftp.exe

 C:\Windows\System32\format.com

 C:\Windows\System32\finger.exe

 C:\Windows\System32\find.exe

 C:\Windows\System32\doskey.exe

 C:\Windows\System32\cscript.exe

 C:\Windows\System32\cmd.exe

 C:\Windows\System32\cacls.exe

 C:\Windows\System32\attrib.exe

 C:\Windows\System32\at.exe

 C:\Windows\System32\arp.exe


########################################################################################


echo 系統服務優化

echo ==========================================================

echo Background Intelligent Transfer Service 使用空閑網絡帶寬在后臺傳送文件。

echo 關閉TCP/IP NetBIOS Helper 提供 TCP/IP (NetBT) 服務上的 NetBIOS 和網絡上客戶端的 NetBIOS 名稱解析的支持

echo 關閉Network Location Awareness網絡訪問保護(NAP)代理服務

echo 關閉Remote Registry 遠程修改注冊表

echo 關閉Print Spooler 將文件加載到內存供稍后打印

echo 關閉Distributed Link linktracking client 用于局域網更新連接信息

echo 關閉Shell Hardware Detection 為自動播放硬件事件提供通知。

echo 關閉Windows Update 啟用檢測、下載和安裝 Windows 和其他程序的更新。


########################################################################################


echo 網絡安全優化[修改注冊表]

#網絡安全優化[修改注冊表]

135端口主要用于使用遠程過程調用,服務器上一般不建議開啟

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole] 

"EnableDCOM"="Y" 

"EnableDCOM"="N" 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc] 

"DCOM Protocols"=hex(7):6e,00,63,00,61,00,63,00,6e,00,5f,00,69,00,70,00,5f,00,\

  74,00,63,00,70,00,00,00,00,00 

"DCOM Protocols"=hex(7): 

[HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys] 

"Flags"="510" 

"Flags"="506" 


445端口控制在局域網中輕松訪問各種共享文件夾或共享打印機,服務器上一般不建議開啟

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\NetBT\Parameters] 

"SMBDeviceEnabled"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters] 

"SMBDeviceEnabled"=dword:00000000


IPC空連接可以使連接者與目標主機建立一個空的連接而無需用戶名與密碼,存在風險建議關閉

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa] 

"restrictanonymous"=dword:00000000 

"restrictanonymous"=dword:00000001 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa] 

"restrictanonymous"=dword:00000000 

"restrictanonymous"=dword:00000001 


配置Backlog,提高網絡并發性及網絡的處理能力

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\AFD\Parameters] 

"EnableDynamicBacklog"=dword:00000001 

"MinimumDynamicBacklog"=dword:00000014 

"MaximumDynamicBacklog"=dword:00004e20 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters] 

"EnableDynamicBacklog"=dword:00000001 

"MinimumDynamicBacklog"=dword:00000014 

"MaximumDynamicBacklog"=dword:00004e20 


通過優化該選項可提高系統防御SYN***的能力,建議優化

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services] 

"SynAttackProtect"=dword:00000001 

"EnableDeadGWDetect"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"SynAttackProtect"=dword:00000002 

"TCPMaxPortsExhausted"=dword:00000005 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services] 

"SynAttackProtect"=dword:00000001 

"EnableDeadGWDetect"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"SynAttackProtect"=dword:00000002 

"TCPMaxPortsExhausted"=dword:00000005 


通過優化設置SYN-ACK等待時間,可提高系統的網絡性能

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"TcpMaxConnectResponseRetransmissions"=dword:00000002 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"TcpMaxConnectResponseRetransmissions"=dword:00000002 


抵御SNMP***,檢查無效網關,以便優化網絡

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"EnableDeadGWDetect"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"EnableDeadGWDetect"=dword:00000000 


抵御ICMP***,檢查有可能用以***的ICMP重定向報文

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"EnableICMPRedirects"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"EnableICMPRedirects"=dword:00000000 


檢查TCPIP協議棧IGMP堆棧溢出本地拒絕服務***

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"IGMPLevel"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"IGMPLevel"=dword:00000000 



檢查是否禁止IP源路由,建議丟棄所有接受的源路由包

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"DisableIPSourceRouting"=dword:00000002 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"DisableIPSourceRouting"=dword:00000002 


禁止路由發現功能,ICMP路由通告報文可以被用來增加路由表紀錄,可以導致***

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"PerformRouterDiscovery"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces] 

"PerformRouterDiscovery"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"PerformRouterDiscovery"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces] 

"PerformRouterDiscovery"=dword:00000000 


更改ping命令返回的默認TTL值。***可通過些值判斷操作系統類型

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"DefaultTTL"=dword:000000f0 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"DefaultTTL"=dword:000000f0 


優化計算機在收到名稱釋放請求時是否釋放其NETBIOS名稱,使計算機受惡意的名稱釋放***

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\NetBT\Parameters] 

"NoNameReleaseOnDemand"=dword:00000001 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters] 

"NoNameReleaseOnDemand"=dword:00000001 


優化TCP閑置鏈接檢查時間,提升網絡性能

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"KeepAliveTime"=dword:000493e0 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"KeepAliveTime"=dword:000493e0 


禁止進行最大包長度路徑檢測。如開啟該功能,***者可能將數據包強制分段,這公使堆棧不堪重負

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"EnablePMTUDiscovery"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"EnablePMTUDiscovery"=dword:00000000 


優化TCP半連接相關參數值,提升網絡性能

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"TcpMaxHalfOpen"=dword:000001f4 

"TcpMaxHalfOpenRetried"=dword:00000190 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"TcpMaxHalfOpen"=dword:000001f4 

"TcpMaxHalfOpenRetried"=dword:00000190 


設置TCP重傳單個數據段的次數。缺少項值為5,缺省這一過程消耗時間240秒。微軟站點安全推薦為3

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"TcpMaxDataRetransmissions"=dword:00000002 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"TcpMaxDataRetransmissions"=dword:00000002 


禁止轉發IP多播數據包。多播數據包可能被多臺主機響應,從而導致響應淹沒網絡

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"EnableMulticastForwarding"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"EnableMulticastForwarding"=dword:00000000 


屏蔽網絡拓撲結構細節,防止***者利用主機響應來了解內部網絡情況

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters] 

"EnableAddrMaskReply"=dword:00000000 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters] 

"EnableAddrMaskReply"=dword:00000000 


########################################################################################


echo 禁用所有IPV6組件,除IPV6環回接口

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /v DisabledComponents /t REG_DWORD /d 0xffffffff /f


########################################################################################


echo 刪除系統默認共享

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters" /v AutoShareServer /t REG_DWORD /d 0 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters" /v AutoShareWks /t REG_DWORD /d 0 /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v RestrictAnonymous /t REG_DWORD /d 1 /f


########################################################################################


echo 卸載regsvr32.dll組件

regsvr32 /u shell32.dll >>log.log

echo 卸載regsvr32.dll組件完畢


########################################################################################


echo 組策略優化

echo ================備份組策略到當前目錄====================

secedit /export /cfg ./gpedit_bak.inf

echo ================恢復組策略優化后文件====================

secedit /configure /db temp.sdb /cfg ./gpedit_setup.inf


########################################################################################

echo 關閉防火墻

netsh advfirewall set allprofiles state off


#########################################################################################

echo 組策略優化內容

本地策略——>安全選項

計算機配置-->Windows設置-->安全設置-->本地策略-->安全選項

交互式登陸:不顯示最后的用戶名       啟用 

網絡訪問:不允許SAM帳戶的匿名枚舉      啟用 已經啟用 

網絡訪問:不允許SAM帳戶和共享的匿名枚舉   啟用 

網絡訪問:不允許儲存網絡身份驗證的憑據   啟用 

網絡訪問:可匿名訪問的共享         內容全部刪除 

網絡訪問:可匿名訪問的命名管道       內容全部刪除 

網絡訪問:可遠程訪問的注冊表路徑      內容全部刪除 

網絡訪問:可遠程訪問的注冊表路徑和子路徑  內容全部刪除 

帳戶:重命名來賓帳戶            這里可以更改guest帳號 

帳戶:重命名系統管理員帳戶         這里可以更改Administrator帳號

=================================================================

安全設置-->賬戶策略-->賬戶鎖定策略

在運行中輸入gpedit.msc回車,打開組策略編輯器,選擇計算機配置-->Windows設置-->安全設置-->賬戶策略-->賬戶鎖定策略,將賬戶鎖定閾值設為“三次登陸無效”,“鎖定時間為30分鐘”,“復位鎖定計數設為30分鐘”。

=================================================================

計算機配置-->Windows設置-->安全設置-->本地策略-->用戶權限分配 

關閉系統:只有Administrators組、其它全部刪除。 

通過終端服務拒絕登陸:加入Guests組、NETWORK SERVICE

通過終端服務允許登陸:加入Administrators、Remote Desktop Users組,其他全部刪除



########################其它可以手動操作的設置###########################

1、安裝安全防護軟件,比如安全狗。

2、新系統一定要先打上補丁

3、開啟防水墻

4、安裝殺毒軟件

5、防火墻禁PING

6、修改administrator,guest 用戶名稱

7、密碼用數字、大小寫字母、符號組成,并且密碼長度在14位以上。

8、guest用戶設置復雜密碼


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女