クラウド プロキシから Windows エンドポイントにファイルをダウンロードすると、セキュリティ プロトコルが原因で失敗する可能性があります。
問題
Windows プラットフォームでスクリプトのダウンロードが失敗し、次のメッセージが表示されます。
要求が中止されました:SSL/TLS セキュア チャネルを作成できませんでした。
クラウド プロキシでホストされる PowerShell スクリプトは 3 種類あり、さまざまな目的のために Windows エンドポイント仮想マシンにダウンロードして実行することができます。
- スクリプトを使用してカスタム Telegraf をインストールする (download.ps1)。
- 物理サーバにカスタム Telegraf をインストールする (unmanagedagent_setup_sample.ps1)。
- 管理対象または管理対象外の仮想マシンでオープン ソース Telegraf を構成する (open_source_telegraf_monitor.ps1)。
解決方法
次のコマンドを使用して
ServerCertificateValidationCallback を無視します。
if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class ServerCertificateValidationCallback
{
public static void Ignore()
{
if(ServicePointManager.ServerCertificateValidationCallback ==null)
{
ServicePointManager.ServerCertificateValidationCallback +=
delegate
(
Object obj,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors errors
)
{
return true;
};
}
}
}
"@
Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
必要なスクリプトをダウンロードして実行した後、ServerCertificateValidationCallback を有効にできます。