驗證 Azure Stack Hub PKI 憑證

從 PowerShell 資源庫可取得本文中所述的 Azure Stack Hub 整備檢查工具。 使用此工具來驗證產生的公開金鑰基礎結構 (PKI) 憑證是否適用於預先部署。 保留足夠的時間來測試及重新發出憑證以驗證憑證 (如有需要的話)。

整備檢查工具會執行下列憑證驗證:

  • 剖析 PFX
    確認 PFX 檔案有效且密碼正確,以及公用資訊是否未受密碼保護。
  • 到期日
    檢查是否有最少七天的有效期限。
  • 簽章演算法
    確認簽章演算法不是 SHA1。
  • 私密金鑰
    確認私密金鑰存在,且是以本機電腦屬性匯出。
  • 信任鏈結
    確認信任鏈結完整包括自我簽署憑證的檢查。
  • DNS 名稱
    檢查 SAN 包含每個端點的相關 DNS 名稱,或支援萬用字元是否存在。
  • 金鑰使用方式
    檢查金鑰使用方式是否包含數位簽章和金鑰加密,並檢查增強金鑰使用方法是否包含伺服器驗證和用戶端驗證。
  • 金鑰大小
    確認金鑰大小為 2048 或更大。
  • 鏈結順序
    檢查其他鏈結的順序,確認順序正確。
  • 其他憑證
    請確定除了相關的分葉憑證及其鏈結之外,PFX 中沒有封裝其他憑證。

重要

PKI 憑證是 PFX 檔案,且密碼都應該視為機密資訊。

必要條件

在驗證 Azure Stack Hub 部署的 PKI 憑證之前,您的系統應該符合下列必要條件:

  • Microsoft Azure Stack Hub 整備檢查工具。
  • 遵循準備指示匯出的 SSL 憑證。
  • DeploymentData.json。
  • Windows 10 或 Windows Server 2016。

執行核心服務憑證驗證

使用下列步驟驗證用於部署和祕密輪替的 Azure Stack Hub PKI 憑證:

  1. 執行下列 Cmdlet,以從 PowerShell (5.1 或更新版本) 提示字元安裝 AzsReadinessChecker

    Install-Module Microsoft.AzureStack.ReadinessChecker -Force -AllowPrerelease
    
  2. 建立憑證目錄結構。 在下列範例中,您可以將 <C:\Certificates\Deployment> 變更為您所選擇的新目錄路徑。

    New-Item C:\Certificates\Deployment -ItemType Directory
    
    $directories = 'ACSBlob', 'ACSQueue', 'ACSTable', 'Admin Extension Host', 'Admin Portal', 'ARM Admin', 'ARM Public', 'KeyVault', 'KeyVaultInternal', 'Public Extension Host', 'Public Portal'
    
    $destination = 'C:\Certificates\Deployment'
    
    $directories | % { New-Item -Path (Join-Path $destination $PSITEM) -ItemType Directory -Force}
    

    注意

    如果您使用 AD FS 作為身分識別系統,則需要 AD FS 和 Graph。 例如:

    $directories = 'ACSBlob', 'ACSQueue', 'ACSTable', 'ADFS', 'Admin Extension Host', 'Admin Portal', 'ARM Admin', 'ARM Public', 'Graph', 'KeyVault', 'KeyVaultInternal', 'Public Extension Host', 'Public Portal'
    
    • 將您的憑證放在上一個步驟中建立的適當目錄。 例如:
      • C:\Certificates\Deployment\ACSBlob\CustomerCertificate.pfx
      • C:\Certificates\Deployment\Admin Portal\CustomerCertificate.pfx
      • C:\Certificates\Deployment\ARM Admin\CustomerCertificate.pfx
  3. 在 PowerShell 視窗中,將 RegionNameFQDNIdentitySystem 的值變更為適合 Azure Stack Hub 環境的值,並執行下列 Cmdlet:

    $pfxPassword = Read-Host -Prompt "Enter PFX Password" -AsSecureString 
    Invoke-AzsHubDeploymentCertificateValidation -CertificatePath C:\Certificates\Deployment -pfxPassword $pfxPassword -RegionName east -FQDN azurestack.contoso.com -IdentitySystem AAD  
    
  4. 檢查輸出,並確定所有憑證都通過所有測試。 例如:

    Invoke-AzsHubDeploymentCertificateValidation v1.2005.1286.272 started.
    Testing: KeyVaultInternal\KeyVaultInternal.pfx
    Thumbprint: E86699****************************4617D6
        PFX Encryption: OK
        Expiry Date: OK
        Signature Algorithm: OK
        DNS Names: OK
        Key Usage: OK
        Key Length: OK
        Parse PFX: OK
        Private Key: OK
        Cert Chain: OK
        Chain Order: OK
        Other Certificates: OK
    Testing: ARM Public\ARMPublic.pfx
    Thumbprint: 8DC4D9****************************69DBAA
        PFX Encryption: OK
        Expiry Date: OK
        Signature Algorithm: OK
        DNS Names: OK
        Key Usage: OK
        Key Length: OK
        Parse PFX: OK
        Private Key: OK
        Cert Chain: OK
        Chain Order: OK
        Other Certificates: OK
    Testing: Admin Portal\AdminPortal.pfx
    Thumbprint: 6F9055****************************4AC0EA
        PFX Encryption: OK
        Expiry Date: OK
        Signature Algorithm: OK
        DNS Names: OK
        Key Usage: OK
        Key Length: OK
        Parse PFX: OK
        Private Key: OK
        Cert Chain: OK
        Chain Order: OK
        Other Certificates: OK
    Testing: Public Portal\PublicPortal.pfx
    
    
    Log location (contains PII): C:\Users\[*redacted*]\AppData\Local\Temp\AzsReadinessChecker\AzsReadinessChecker.log
    Report location (contains PII): C:\Users\[*redacted*]\AppData\Local\Temp\AzsReadinessChecker\AzsReadinessCheckerReport.json
    Invoke-AzsHubDeploymentCertificateValidation Completed
    

    若要驗證其他 Azure Stack Hub 服務的憑證,請變更 -CertificatePath 的值。 例如:

    # App Services
    Invoke-AzsHubAppServicesCertificateValidation -CertificatePath C:\Certificates\AppServices -pfxPassword $pfxPassword -RegionName east -FQDN azurestack.contoso.com
    
    # DBAdapter
    Invoke-AzsHubDBAdapterCertificateValidation -CertificatePath C:\Certificates\DBAdapter -pfxPassword $pfxPassword -RegionName east -FQDN azurestack.contoso.com
    
    # EventHubs
    Invoke-AzsHubEventHubsCertificateValidation -CertificatePath C:\Certificates\EventHubs -pfxPassword $pfxPassword -RegionName east -FQDN azurestack.contoso.com
    

    每個資料夾都應該包含適用於該憑證類型的單一 PFX 檔案。 如果憑證類型有多憑證需求,則每個個別憑證都應該會有巢狀資料夾,且資料夾的名稱必須有所區別。 下列程式碼顯示所有憑證類型的範例資料夾/憑證結構,以及 的適當值 -CertificatePath

    C:\>tree c:\SecretStore /A /F
        Folder PATH listing
        Volume serial number is 85AE-DF2E
        C:\SECRETSTORE
        \---AzureStack
            +---CertificateRequests
            \---Certificates
                +---AppServices         # Invoke-AzsCertificateValidation `
                |   +---API             # -CertificatePath C:\Certificates\AppServices
                |   |       api.pfx     
                |   |
                |   +---DefaultDomain
                |   |       wappsvc.pfx
                |   |
                |   +---Identity
                |   |       sso.pfx
                |   |
                |   \---Publishing
                |           ftp.pfx
                |
                +---DBAdapter           # Invoke-AzsCertificateValidation `
                |       dbadapter.pfx   # -CertificatePath C:\Certificates\DBAdapter
                |                       
                |
                +---Deployment          # Invoke-AzsCertificateValidation `
                |   +---ACSBlob         # -CertificatePath C:\Certificates\Deployment
                |   |       acsblob.pfx 
                |   |
                |   +---ACSQueue
                |   |       acsqueue.pfx
               ./. ./. ./. ./. ./. ./. ./.    <- Deployment certificate tree trimmed.
                |   \---Public Portal
                |           portal.pfx
                |
                \---EventHubs           # Invoke-AzsCertificateValidation `
                        eventhubs.pfx   # -CertificatePath C:\Certificates\EventHubs
    
    

已知問題

徵兆:測試會略過

原因:如果不符合相依性,AzsReadinessChecker 會略過某些測試:

  • 如果信任鏈結失敗,則會略過其他憑證。

    Testing: ACSBlob\singlewildcard.pfx
         Read PFX: OK
         Signature Algorithm: OK
         Private Key: OK
         Cert Chain: OK
         DNS Names: Fail
         Key Usage: OK
         Key Size: OK
         Chain Order: OK
         Other Certificates: Skipped
    Details:
    The certificate records '*.east.azurestack.contoso.com' do not contain a record that is valid for '*.blob.east.azurestack.contoso.com'. Please refer to the documentation for how to create the required certificate file.
    The other certificates check was skipped because cert chain and/or DNS names failed. Follow the guidance to remediate those issues and recheck. 
    
    Log location (contains PII): C:\Users\username\AppData\Local\Temp\AzsReadinessChecker\AzsReadinessChecker.log
    Report location (contains PII): C:\Users\username\AppData\Local\Temp\AzsReadinessChecker\AzsReadinessCheckerReport.json
    Invoke-AzsCertificateValidation Completed
    

解析:遵循每個憑證測試集合下詳細資料區段中的工具指引。

徵兆:HTTP CRL 檢查失敗,儘管 HTTP CDP 已寫入 x509 擴充功能。

原因:目前 AzsReadinessChecker 無法檢查某些語言的 HTTP CDP。

解決方式:將 OS 語言設定為 EN-US 執行驗證。

憑證

目錄 憑證
ACSBlob wildcard_blob_<region>_<externalFQDN>
ACSQueue wildcard_queue_<region>_<externalFQDN>
ACSTable wildcard_table_<region>_<externalFQDN>
管理員延伸主機 wildcard_adminhosting_<region>_<externalFQDN>
管理入口網站 adminportal_<region>_<externalFQDN>
SSL 管理員 adminmanagement_<region>_<externalFQDN>
ARM 公用 management_<region>_<externalFQDN>
KeyVault wildcard_vault_<region>_<externalFQDN>
KeyVaultInternal wildcard_adminvault_<region>_<externalFQDN>
公用延伸主機 wildcard_hosting_<region>_<externalFQDN>
公用入口網站 portal_<region>_<externalFQDN>

後續步驟

憑證通過 AzsReadinessChecker 的驗證後,您就可以在 Azure Stack Hub 部署或部署後祕密輪替中使用憑證。