如何在Azure Web角色上禁用RC4密码

Mah*_*amy 9 ssl azure ssl-certificate azure-web-roles

我有一个托管在Microsoft Azure Web角色上的Web应用程序.如何禁用RC4密码?

Ale*_*x S 9

我使用Powershell脚本遇到的问题是需要修改的键包含正斜杠,而Powershell将其视为路径分隔符并且脚本失败.

解决方案是创建一个控制台应用程序并将其设置为在启动时运行:

class Program
{
    static void Main(string[] args)
    {
        string[] subKeys = new string[]
        {
            "RC4 40/128",
            "RC4 56/128",
            "RC4 64/128",
            "RC4 128/128",
        };

        RegistryKey parentKey = Registry.LocalMachine.OpenSubKey(
            @"SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers", true);

        foreach (string keyName in subKeys)
        {
            var newKey = parentKey.CreateSubKey(keyName);
            newKey.SetValue("Enabled", 0);
            newKey.Close();
        }
        parentKey.Close();
    }
}
Run Code Online (Sandbox Code Playgroud)

将输出文件(在我的情况下为DisableRc4.exe)复制到webrole的根目录,并设置为"始终复制"

创建一个包含的文件DisableRc4.cmd

.\DisableRc4.exe
EXIT /B 0
Run Code Online (Sandbox Code Playgroud)

更新Web角色的ServiceDefinition.csdef,如下所示

<Startup>
    <Task commandLine="DisableRc4.cmd" executionContext="elevated" taskType="simple" />
</Startup>
Run Code Online (Sandbox Code Playgroud)

我使用https://www.ssllabs.com/ssltest/index.html验证了RC4支持已被删除

在启动修改之前 在启动cmd之前

启动cmd后