ملاحظة: تنطبق المعلومات على هذه الصفحة إلى إعلان خ 2012 R2 والإصدارات الأحدث.
إذا تم نشر وكيل تطبيق ويب (WAP)، يجب تأسيس علاقة ثقة الوكيل بين الملقم وآب وخادم AD FS. تحقق من حالة علاقة الثقة الوكيل، أو بتشغيل فشل عند نقطة معينة في الوقت.
معلومات أساسية
علاقة الثقة الوكيل شهادة العميل. عند تشغيل المعالج بعد تثبيت "وكيل تطبيق ويب"، المعالج ينشئ شهادة موقعة ذاتيا عميل باستخدام بيانات الاعتماد التي قمت بتحديدها في المعالج. ثم إدراج الشهادة في قاعدة بيانات التكوين AD FS المعالج ويقوم بإضافتها إلى مخزن الشهادات أدفستروستيديفيسيس على خادم AD FS.
لأي اتصال SSL، يستخدم http.sys ترتيب الأولوية التالي لروابط شهادة SSL لتطابق شهادة:
الأولوية |
الاسم |
معلمات |
الوصف |
1 |
IP |
IP:port |
تطابق تام IP والمنفذ |
2 |
الشركة |
Hostname:port |
مطابقة اسم المضيف المحدد (يجب تحديد اتصال الشركة) |
3 |
قانون الأحوال المدنية |
المنفذ |
استدعاء المركزي مخزن الشهادات |
4 |
بدل IPv6 |
المنفذ |
تطابق حرف البدل IPv6 (يجب أن يكون اتصال IPv6) |
5 |
بدل IP |
المنفذ |
تطابق حرف البدل IP (يمكن اتصال IPv4 أو IPv6) |
إعلان خ 2012 R2 ولاحقا هي مستقلة عن خدمات معلومات إنترنت (IIS) ويعمل كخدمة مقدمة http.sys. تستخدم روابط شهادة SSL hostname:port خ الإعلان. أثناء مصادقة شهادة العميل، يرسل خ إعلان قائمة شهادات الموثوق بها (CTL) استناداً إلى الشهادات الموجودة في مخزن أدفستروستيديفيسيس. إذا كان يستخدم ربط شهادة SSL لملقم AD FS IP:port أو مخزن CTL غير أدفستروستيديفيسيس، لا يمكن إنشاء علاقة ثقة الوكيل.
الحصول على الارتباطات شهادة SSL ل AD FS
على ملقم AD FS، تشغيل الأمر التالي في Windows PowerShell:
netsh http show sslcert
في قائمة الروابط التي تم إرجاعها، ابحث عن تلك باستخدام "معرف التطبيق" 5d89a20c-باب-4389-9447-324788eb944a. إليك مثال الربط السليم. لاحظ الأجزاء التي باللون الغامق.
Hostname:port : adfs.contoso.com:443
Certificate Hash : 3638de9b03a488341dfe32fc3ae5c480ee687793
Application ID : {5d89a20c-beab-4389-9447-324788eb944a}
Certificate Store Name : MY
Verify Client Certificate Revocation : Enabled
Verify Revocation Using Cached Client Certificate Only : Disabled
Usage Check : Enabled
Revocation Freshness Time : 0
URL Retrieval Timeout : 0
Ctl Identifier : (null)
Ctl Store Name : AdfsTrustedDevices
DS Mapper Usage : Disabled
Negotiate Client Certificate : Disabled
استكشاف الأخطاء وإصلاحها
للكشف عن المشاكل المتعلقة بعلاقة الثقة الوكيل، تشغيل البرنامج النصي التالي. استناداً إلى الكشف عن المشكلة، اتخاذ الإجراءات وفقا لذلك في نهاية الصفحة.
param
(
[switch]$syncproxytrustcerts
)
function checkhttpsyscertbindings()
{
Write-Host; Write-Host("1 – Checking http.sys certificate bindings for potential issues")
$httpsslcertoutput = netsh http show sslcert
$adfsservicefqdn = (Get-AdfsProperties).HostName
$i = 1
$certbindingissuedetected = $false
While($i -lt $httpsslcertoutput.count)
{
$ipport = $false
$hostnameport = $false
if ( ( $httpsslcertoutput[$i] -match "IP:port" ) ) { $ipport = $true }
elseif ( ( $httpsslcertoutput[$i] -match "Hostname:port" ) ) { $hostnameport = $true }
# Check for IP specific certificate bindings
if ( ( $ipport -eq $true ) )
{
$httpsslcertoutput[$i]
$ipbindingparsed = $httpsslcertoutput[$i].split(":")
if ( ( $ipbindingparsed[2].trim() -ne "0.0.0.0" ) -and ( $ipbindingparsed[3].trim() -eq "443") )
{
$warning = "There is an IP specific binding on IP " + $ipbindingparsed[2].trim() + " which may conflict with the AD FS port 443 cert binding." | Write-Warning
$certbindingissuedetected = $true
}
$i = $i + 14
continue
}
# check that CTL Store is set for ADFS service binding
elseif ( $hostnameport -eq $true )
{
$httpsslcertoutput[$i]
$ipbindingparsed = $httpsslcertoutput[$i].split(":")
If ( ( $ipbindingparsed[2].trim() -eq $adfsservicefqdn ) -and ( $ipbindingparsed[3].trim() -eq "443") -and ( $httpsslcertoutput[$i+10].split(":")[1].trim() -ne "AdfsTrustedDevices" ) )
{
Write-Warning "ADFS Service binding does not have CTL Store Name set to AdfsTrustedDevices"
$certbindingissuedetected = $true
}
$i = $i + 14
continue
}
$i++
}
If ( $certbindingissuedetected -eq $false ) { Write-Host "Check Passed: No certificate binding issues detected" }
}
function checkadfstrusteddevicesstore()
{
# check for CA issued (non-self signed) certs in the AdfsTrustedDevices cert store
Write-Host; Write-Host "2 – Checking AdfsTrustedDevices cert store for non-self signed certificates"
$certlist = Get-Childitem cert:\LocalMachine\AdfsTrustedDevices -recurse | Where-Object {$_.Issuer -ne $_.Subject}
If ( $certlist.count -gt 0 )
{
Write-Warning "The following non-self signed certificates are present in the AdfsTrustedDevices store and should be removed"
$certlist | Format-List Subject
}
Else { Write-Host "Check Passed: No non-self signed certs present in AdfsTrustedDevices cert store" }
}
function checkproxytrustcerts
{
Param ([bool]$repair=$false)
Write-Host; Write-Host("3 – Checking AdfsTrustedDevices cert store is in sync with ADFS Proxy Trust config")
$doc = new-object Xml
$doc.Load("$env:windir\ADFS\Microsoft.IdentityServer.Servicehost.exe.config")
$connString = $doc.configuration.'microsoft.identityServer.service'.policystore.connectionString
$command = "Select ServiceSettingsData from [IdentityServerPolicy].[ServiceSettings]"
$cli = new-object System.Data.SqlClient.SqlConnection
$cli.ConnectionString = $connString
$cmd = new-object System.Data.SqlClient.SqlCommand
$cmd.CommandText = $command
$cmd.Connection = $cli
$cli.Open()
$configString = $cmd.ExecuteScalar()
$configXml = new-object XML
$configXml.LoadXml($configString)
$rawCerts = $configXml.ServiceSettingsData.SecurityTokenService.ProxyTrustConfiguration._subjectNameIndex.KeyValueOfstringArrayOfX509Certificate29zVOn6VQ.Value.X509Certificate2
#$ctl = dir cert:\LocalMachine\ADFSTrustedDevices
$store = new-object System.Security.Cryptography.X509Certificates.X509Store("ADFSTrustedDevices","LocalMachine")
$store.open("MaxAllowed")
$atLeastOneMismatch = $false
$badCerts = @()
foreach($rawCert in $rawCerts)
{
$rawCertBytes = [System.Convert]::FromBase64String($rawCert.RawData.'#text')
$cert=New-Object System.Security.Cryptography.X509Certificates.X509Certificate2(,$rawCertBytes)
$now = Get-Date
if ( ($cert.NotBefore -lt $now) -and ($cert.NotAfter -gt $now))
{
$certThumbprint = $cert.Thumbprint
$certSubject = $cert.Subject
$ctlMatch = dir cert:\localmachine\ADFSTrustedDevices\$certThumbprint -ErrorAction SilentlyContinue
if ($ctlMatch -eq $null)
{
$atLeastOneMismatch = $true
Write-Warning "This cert is NOT in the CTL: $certThumbprint – $certSubject"
if ($repair -eq $true)
{
write-Warning "Attempting to repair"
$store.Add($cert)
Write-Warning "Repair successful"
}
else
{
Write-Warning ("Please install KB.2964735 or re-run script with -syncproxytrustcerts switch to add missing Proxy Trust certs to AdfsTrustedDevices cert store")
}
}
}
}
$store.Close()
if ($atLeastOneMismatch -eq $false)
{
Write-Host("Check Passed: No mismatched certs found. CTL is in sync with DB content")
}
}
checkhttpsyscertbindings
checkadfstrusteddevicesstore
checkproxytrustcerts($syncproxytrustcerts)
Write-Host; Write-Host("All checks completed.")
ما هي المشكلة اكتشاف؟