在 Windows Azure 包中管理加密数据

 

适用于:Windows Azure Pack

Windows azure Pack for Windows Server 使用加密算法、加密密钥和密码来保护管理门户中数据库和用户之间的通信。 此数据存储在两个或三个位置中。

为了保护数据的安全性,你需要定期更改或轮换数据。 在一个位置中更改数据时,你需要在所有位置更改它。

我们提供了一个电子表格,其中列出所有加密算法、密钥和密码及其存储位置。 此电子表格还包含有关如何更改每个数据点的信息。 可以在 Microsoft 下载中心提供的 Windows Azure Pack 技术文档包 () https://go.microsoft.com/fwlink/?LinkId=329811 访问电子表格。 单击“ 下载”,选择WAPv1_encryption.xsl 文件,然后单击“ 下一步 ”开始下载该文件。

还可以使用适用于 Windows Azure Pack 的最佳做法分析器来验证数据的安全性。 有关最佳做法分析器的信息,请参阅 Windows Azure Pack 的扫描组件

使用以下信息来管理你的加密数据:

  • 更改数据库密码

  • 轮换与计算机密钥相关的加密数据

  • 轮换加密算法和密钥

  • 更改使用情况管理 API 密码

  • 更改与资源提供程序相关的密码

  • 更改与 Service Reporting 相关的密码

更改数据库密码

Windows Azure Pack 中有多个数据库,每个数据库都有一个数据库密码。 使用以下步骤来轮换数据库密码:

轮换数据库密码

  1. 获取一个新的密码。 运行以下 cmdlet:

    $password = New-MgmtSvcPassword –Length 64
    
  2. 使用电子表格中的数据查找和轮换第一个位置中的数据库密码。 例如,如果要轮换管理 API 的数据库密码,第一个位置是密码配置存储区(检查位置 1 的 C 列)。

    运行以下 cmdlet 以更改密码:

    Set-MgmtSvcDatabaseSetting <Service>  <Secret>  $password -Server <Server> -Passphrase <Passphrase> -Database “Microsoft.MgmtSvc.Config” -Force
    
  3. 然后,查找第三个位置中的数据库密码并进行轮换。 就上述示例而言,对于管理 API 数据库密码,此处是 SQL Server 安全登录(检查位置 3 的 G 列)。

    运行以下 cmdlet:

    Set-MgmtSvcDatabaseUser -Server <Server> -Database <Database> -Schema <Schema> -User <User> -UserPassword $password
    
  4. 最后,查找第二个位置中的数据库密码并进行轮换。 再次以管理 API 数据库密码为例,此处是 web.config 连接字符串(检查位置 2 的 E 列)。

    运行以下 cmdlet:

    $setting = Get-MgmtSvcDatabaseSetting <Service> <Secret> -Server <Server> -Passphrase <Passphrase>
    $connectionString = Get-MgmtSvcSetting $namespace <ConnectionString>
    $builder = New-Object System.Data.SqlClient.SqlConnectionStringBuilder($connectionString.Value)
    $builder.Password = $setting.Value
    Set-MgmtSvcSetting <Service> <ConnectionString> $builder.ConnectionString
    

解密和验证设置,以及管理 API、管理员管理门户 (AdminSite)、身份验证网站 (AuthSite)、租户管理门户 (TenantSite) 和 Windows 身份验证网站 (WindowsAuthSite) 的密钥是使用计算机密钥存储的。 使用以下步骤来轮换此数据。

  1. 获取新的计算机密钥。 下面的示例为管理 API 服务的 machineKey.decrytpion 获取一个新的计算机密钥。 可以使用以下步骤来更改计算机密钥的其他值。

    运行以下 cmdlet 以获取新的计算机密钥:

    $machineKey = New-MgmtSvcMachineKey
    $decryption = $machineKey.Attribute('decryption').Value
    
  2. 使用电子表格中的数据查找 machineKey.decryption 的第一个位置。 对于 管理员 API 服务,这是机密配置Microsoft Store。

    运行以下 cmdlet 以更改 machineKey.decryption 设置:

    Set-MgmtSvcDatabaseSetting <Service> "machineKey.decryption" $decryption -Server <Server> -Passphrase <Passphrase> -Force
    
  3. 找到 machineKey.decryption 的第二个位置。 对于 管理员 API 服务,这是 web.config machineKey 部分。

    运行以下 cmdlet 以更改 machineKey.decryption 设置:

    $decryption = Get-MgmtSvcDatabaseSetting <Service> “machineKey.decryption” –Server <Server> -Passphrase <Passphrase>
    Set-MgmtSvcSetting <Service> "machineKey.decryption" $decryption.Value
    

轮换加密算法和密钥

使用以下步骤轮换加密算法和加密密钥。

轮换加密算法和加密密钥

  1. 获取新的计算机密钥。 下面的示例为 Notification 加密算法获取一个新的密钥,并为管理站点获取一个密钥。 你还可使用这些步骤更改其他加密算法和密钥。

    注意

    相同的密钥可同时用于加密和解密。 因此它们既可被视为加密密钥,也可被视为解密密钥,具体取决于执行的操作。 因此,我们使用下面的 解密 值,尽管轮换的密钥是 加密密钥

    运行以下 cmdlet 以获取新的计算机密钥:

    $machineKey = New-MgmtSvcMachineKey
    $encryption = $machineKey.Attribute('decryption').Value
    $encryptionKey = $machineKey.Attribute('decryptionKey').Value
    
  2. 使用电子表格中的数据查找第一个位置中的加密算法或密钥。 对于管理站点的 Notification 加密算法和密钥,这是密码配置存储区。

    运行以下 cmdlet 以更改加密算法和密钥:

    Set-MgmtSvcDatabaseSetting <Service> "NotificationEncryptionAlgorithm " $encryption -Server <Server> -Passphrase <Passphrase> -Force
    Set-MgmtSvcDatabaseSetting <Service> "EncryptionKey " $encryptionKey -Server <Server> -Passphrase <Passphrase> -Force
    
  3. 查找第二个位置中的加密算法或密钥。 对于管理站点的 Notification 加密算法和密钥,这是 web.config 应用设置部分。

    运行以下 cmdlet 以更改加密算法和密钥:

    $encryption = Get-MgmtSvcDatabaseSetting <Service> “NotificationEncryptionAlgorithm” –Server <Server> -Passphrase <Passphrase>
    Set-MgmtSvcSetting <Service> "NotificationEncryptionAlgorithm" $encryption.Value
    $encryptionKey = Get-MgmtSvcDatabaseSetting <Service> “EncryptionKey” –Server <Server> -Passphrase <Passphrase>
    Set-MgmtSvcSetting <Service> "EncryptionKey" $encryptionKey.Value
    

更改使用情况管理 API 密码

不同于资源提供程序(详见下一节)使用的密码,使用情况管理 API 的密码存储在密码配置存储区和 web.config 应用设置部分中。 使用以下步骤更改使用情况管理 API 密码。

轮换使用情况管理 API 密码

  1. 获取一个新的密码。 运行以下 cmdlet:

    $password = New-MgmtSvcPassword
    
  2. 更改第一个位置(密码配置存储区)中的密码。 运行以下 cmdlet:

    Set-MgmtSvcDatabaseSetting <Service>  <Secret>  $password -Server <Server> -Passphrase <Passphrase> -Force
    
  3. 更改第二个位置(web.config 应用设置部分)中的密码。 运行以下 cmdlet:

    $setting = Get-MgmtSvcDatabaseSetting <Service> <Secret> -Server <Server> -Passphrase <Passphrase>
    Set-MgmtSvcSetting <Service> <Secret> $setting.Value
    

使用以下信息轮换监控资源提供程序、MySQL 资源提供程序、SQL Server 资源提供程序以及使用情况资源提供程序的密码。

轮换资源提供程序密码

  1. 获取资源提供程序的新密码。 运行以下 cmdlet:

    $password = New-MgmtSvcPassword
    
  2. 更改第一个位置中的密码。 运行以下 cmdlet:

    Set-MgmtSvcDatabaseSetting <Service> “Password” $pw -Server <Server> -Passphrase <Passphrase> -Force
    
  3. 更改第三个位置中的密码。

    注意

    对于监控服务,此密码被称为“MonitoringRestBasicAuthKnownPassword”。 对于其他资源提供程序,此密码被称为"密码"。

    运行以下 cmdlet:

    Set-MgmtSvcSetting <Service>  “Password” $pw -Encode
    
  4. 更改第二个位置中的密码。

    注意

    以下 cmdlet 更改全部四个终结点的密码,但并非所有资源提供程序都具有所有这些终结点。 查看 $rp 的结果以识别每个资源提供程序的终结点,然后对 AuthenticationPassword 值进行相应的调整。

    运行以下 cmdlet:

    $rp = Get-MgmtSvcResourceProviderConfiguration <Resource Provider Name> -DecryptPassword
    $rp.AdminEndpoint.AuthenticationPassword = $pw
    $rp.TenantEndpoint.AuthenticationPassword = $pw
    $rp.UsageEndpoint.AuthenticationPassword = $pw
    $rp.NotificationEndpoint.AuthenticationPassword = $pw
    Add-MgmtSvcResourceProviderConfiguration $rp -Force
    

如果将 Service Reporting 与 Windows Azure Pack 配合使用,则在更改使用情况服务密码时,必须在 Service Reporting SQL VM 中更新密码。

使用以下步骤来重置密码。

更改 Service reporting 的 SQL VM 密码

  1. 如果你的 VM 上安装了支持 Service Reporting 的 SQL 数据库,确保 Service Reporting SQL 代理作业未处于运行状态。 使用以下步骤查看作业的状态:

    1. 连接<前缀>-DW-SQL\CPSDW 数据库实例。

    2. 在对象资源管理器中,展开SQL Server 代理

    3. 单击“作业”。

    4. 在“视图”选项卡上,单击对象资源管理器详细信息

      检查 “状态 ”列以查看代理作业是否正在运行。

  2. Service Reporting 包括一个脚本,你可以运行该脚本来更改密码。 要运行此脚本,请从 PowerShell 命令提示符处运行以下 cmdlet。

    \\<Service reporting host>\ServiceReporting\Maintenance\PostDeploymentConfig.ps1 -User UsageClient –Password $newPassword