目标主机使用了不受支持的SSL加密算法【原理扫描】

描述:

通过向服务端发送请求,获取到Banner信息,从而检测到目标服务加密通信使用的SSL加密算法

解决办法:

切换到TLSv1.2或者更高解密协议。

执行操作:

  1. 以管理员身份运行PowerShell
    按 Win + X → 选择 "Windows PowerShell (管理员)"

  2. 执行以下命令:

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
    cd C:\UpgradeFix
    .\Fix-SSLTLS-Protocol.ps1

ps1的完整脚本如下:

复制代码
# ============================================================
# SSL/TLS Protocol Security Hardening Script
# Function: Disable insecure SSL/TLS protocols, enable TLS 1.2 and TLS 1.3
# Usage: Run PowerShell as Administrator, execute this script
# ============================================================

$ErrorActionPreference = "Stop"

Write-Host "========================================" -ForegroundColor Cyan
Write-Host "  SSL/TLS Protocol Configuration Script" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""

$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if (-not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Write-Host "ERROR: Please run this script as Administrator!" -ForegroundColor Red
    Write-Host "Right-click PowerShell -> Run as Administrator" -ForegroundColor Yellow
    exit 1
}

Write-Host "[OK] Administrator privilege check passed" -ForegroundColor Green
Write-Host ""

Write-Host "WARNING: This script will modify system SSL/TLS protocol configuration" -ForegroundColor Yellow
Write-Host "  - Disable SSL 2.0, SSL 3.0" -ForegroundColor Yellow
Write-Host "  - Disable TLS 1.0, TLS 1.1" -ForegroundColor Yellow
Write-Host "  - Enable TLS 1.2, TLS 1.3" -ForegroundColor Yellow
Write-Host ""
$confirm = Read-Host "Continue execution? (Y/N)"

if ($confirm -ne "Y" -and $confirm -ne "y") {
    Write-Host "Operation cancelled" -ForegroundColor Yellow
    exit 0
}

Write-Host ""
Write-Host "Starting SSL/TLS protocol configuration..." -ForegroundColor Cyan
Write-Host ""

$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols"

try {
    Write-Host "[1/6] Disabling SSL 2.0..." -ForegroundColor White
    New-Item -Path "$regPath\SSL 2.0" -Force | Out-Null
    New-Item -Path "$regPath\SSL 2.0\Client" -Force | Out-Null
    New-ItemProperty -Path "$regPath\SSL 2.0\Client" -Name "Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\SSL 2.0\Client" -Name "DisabledByDefault" -Value 1 -PropertyType DWORD -Force | Out-Null
    New-Item -Path "$regPath\SSL 2.0\Server" -Force | Out-Null
    New-ItemProperty -Path "$regPath\SSL 2.0\Server" -Name "Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\SSL 2.0\Server" -Name "DisabledByDefault" -Value 1 -PropertyType DWORD -Force | Out-Null
    Write-Host "  [OK] SSL 2.0 disabled" -ForegroundColor Green

    Write-Host "[2/6] Disabling SSL 3.0..." -ForegroundColor White
    New-Item -Path "$regPath\SSL 3.0" -Force | Out-Null
    New-Item -Path "$regPath\SSL 3.0\Client" -Force | Out-Null
    New-ItemProperty -Path "$regPath\SSL 3.0\Client" -Name "Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\SSL 3.0\Client" -Name "DisabledByDefault" -Value 1 -PropertyType DWORD -Force | Out-Null
    New-Item -Path "$regPath\SSL 3.0\Server" -Force | Out-Null
    New-ItemProperty -Path "$regPath\SSL 3.0\Server" -Name "Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\SSL 3.0\Server" -Name "DisabledByDefault" -Value 1 -PropertyType DWORD -Force | Out-Null
    Write-Host "  [OK] SSL 3.0 disabled" -ForegroundColor Green

    Write-Host "[3/6] Disabling TLS 1.0..." -ForegroundColor White
    New-Item -Path "$regPath\TLS 1.0" -Force | Out-Null
    New-Item -Path "$regPath\TLS 1.0\Client" -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.0\Client" -Name "Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.0\Client" -Name "DisabledByDefault" -Value 1 -PropertyType DWORD -Force | Out-Null
    New-Item -Path "$regPath\TLS 1.0\Server" -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.0\Server" -Name "Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.0\Server" -Name "DisabledByDefault" -Value 1 -PropertyType DWORD -Force | Out-Null
    Write-Host "  [OK] TLS 1.0 disabled" -ForegroundColor Green

    Write-Host "[4/6] Disabling TLS 1.1..." -ForegroundColor White
    New-Item -Path "$regPath\TLS 1.1" -Force | Out-Null
    New-Item -Path "$regPath\TLS 1.1\Client" -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.1\Client" -Name "Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.1\Client" -Name "DisabledByDefault" -Value 1 -PropertyType DWORD -Force | Out-Null
    New-Item -Path "$regPath\TLS 1.1\Server" -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.1\Server" -Name "Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.1\Server" -Name "DisabledByDefault" -Value 1 -PropertyType DWORD -Force | Out-Null
    Write-Host "  [OK] TLS 1.1 disabled" -ForegroundColor Green

    Write-Host "[5/6] Enabling TLS 1.2..." -ForegroundColor White
    New-Item -Path "$regPath\TLS 1.2" -Force | Out-Null
    New-Item -Path "$regPath\TLS 1.2\Client" -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.2\Client" -Name "Enabled" -Value 1 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.2\Client" -Name "DisabledByDefault" -Value 0 -PropertyType DWORD -Force | Out-Null
    New-Item -Path "$regPath\TLS 1.2\Server" -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.2\Server" -Name "Enabled" -Value 1 -PropertyType DWORD -Force | Out-Null
    New-ItemProperty -Path "$regPath\TLS 1.2\Server" -Name "DisabledByDefault" -Value 0 -PropertyType DWORD -Force | Out-Null
    Write-Host "  [OK] TLS 1.2 enabled" -ForegroundColor Green

    Write-Host "[6/6] Enabling TLS 1.3..." -ForegroundColor White
    try {
        New-Item -Path "$regPath\TLS 1.3" -Force | Out-Null
        New-Item -Path "$regPath\TLS 1.3\Client" -Force | Out-Null
        New-ItemProperty -Path "$regPath\TLS 1.3\Client" -Name "Enabled" -Value 1 -PropertyType DWORD -Force | Out-Null
        New-ItemProperty -Path "$regPath\TLS 1.3\Client" -Name "DisabledByDefault" -Value 0 -PropertyType DWORD -Force | Out-Null
        New-Item -Path "$regPath\TLS 1.3\Server" -Force | Out-Null
        New-ItemProperty -Path "$regPath\TLS 1.3\Server" -Name "Enabled" -Value 1 -PropertyType DWORD -Force | Out-Null
        New-ItemProperty -Path "$regPath\TLS 1.3\Server" -Name "DisabledByDefault" -Value 0 -PropertyType DWORD -Force | Out-Null
        Write-Host "  [OK] TLS 1.3 enabled" -ForegroundColor Green
    }
    catch {
        Write-Host "  [!] TLS 1.3 not supported on this Windows version (requires Windows Server 2022 or later)" -ForegroundColor Yellow
    }

    Write-Host ""
    Write-Host "========================================" -ForegroundColor Green
    Write-Host "  SSL/TLS Protocol Configuration Completed!" -ForegroundColor Green
    Write-Host "========================================" -ForegroundColor Green
    Write-Host ""

    Write-Host "Configuration Summary:" -ForegroundColor Cyan
    Write-Host "  Disabled: SSL 2.0, SSL 3.0, TLS 1.0, TLS 1.1" -ForegroundColor Yellow
    Write-Host "  Enabled: TLS 1.2, TLS 1.3" -ForegroundColor Green
    Write-Host ""

    Write-Host "IMPORTANT:" -ForegroundColor Red
    Write-Host "  Configuration completed, but requires server restart to take effect!" -ForegroundColor Red
    Write-Host "  Please restart the server during a maintenance window." -ForegroundColor Red
    Write-Host ""

    $restart = Read-Host "Restart server now? (Y/N)"
    if ($restart -eq "Y" -or $restart -eq "y") {
        Write-Host "Restarting server..." -ForegroundColor Yellow
        Restart-Computer -Force
    }
    else {
        Write-Host "Please restart the server manually when convenient to apply configuration." -ForegroundColor Yellow
    }

}
catch {
    Write-Host ""
    Write-Host "ERROR: Exception occurred during configuration" -ForegroundColor Red
    Write-Host "Details: $_" -ForegroundColor Red
    Write-Host ""
    Write-Host "Suggestions:" -ForegroundColor Yellow
    Write-Host "  1. Confirm running as Administrator" -ForegroundColor Yellow
    Write-Host "  2. Check system permission settings" -ForegroundColor Yellow
    Write-Host "  3. Configure manually via Registry Editor" -ForegroundColor Yellow
    exit 1
}
相关推荐
阿里云云原生1 小时前
可用性从 99.9% 跃升至 99.995%:畅捷通如何用 AI 重塑运维底座?
运维·网络·人工智能
kisloy2 小时前
【爬虫入门第13讲】Scrapy 框架深度解析(四)核心配置与自定义扩展
网络·爬虫·scrapy
夜雪一千3 小时前
TCP数据包长什么样?拆解TCP报文头部结构
网络·网络协议·tcp/ip
德迅云安全杨德俊3 小时前
应用加速:一站式解决企业跨域网络加速与安全双重难题
网络·安全·ddos
瓦学妹4 小时前
什么是网络索引?它是如何工作的?
大数据·网络·python·网络爬虫
别催小唐敲代码4 小时前
STM32 I2C协议详解:从原理到实战
stm32·网络协议·协议
for_ever_love__6 小时前
iOS:网络请求再学习
网络·学习·ios·objective-c
一名普通的电源工程师7 小时前
E0512XT-1WR3 适配优选 钡特电源 DF1-05D12XT|1W 隔离5V转±12V模块电源选型参数技术解析
大数据·网络·人工智能
2301_780789667 小时前
零信任时代:WAF 从边界防护到微隔离的架构跃迁
网络·安全·web安全·kubernetes·ddos
regret~8 小时前
【记录】网络路由、转发与网卡隔离
linux·服务器·网络