CCP Client Certificate - How to troubleshoot certificate authentication with IIS logs
Objective
When using client certificate serial number application authentication in CCP, we sometimes come across issues that require further investigation.
The below instructions are useful in cases where we need to see the certificate details. In those cases, usually the certificate is not being passed from IIS to the CP, and we will see IIS 403/500 error codes such as:
403.7 (Client certificate doesn't have an associated private key installed)
403.13 (CRL unreachable, or certificate revoked)
403.16 (certificate not trusted)
403.17 (expired certificate)
500 - In the appaudit.log of the CP, we see an indication that a certificate was not loaded with the call ("Failed to obtain client certificate details").
By enabling SSL Client Certificate logging in IIS, we can see the details of the client certificate that was loaded with the call, or if none was loaded (for example in cases where the LB is dropping the certificate on the way, or IIS SSL was not set to 'Accept').
Microsoft Source: https://learn.microsoft.com/en-us/iis/web-dev-reference/server-variables
Environment
14.0 Privileged Access Manager (PAM, self-hosted) Central Credential Provider
Procedure
Enable IIS logging for SSL Client Certificate:
- In IIS 7 and higher go to:
IIS Manager > Select the server's name from the left pane > Under IIS double click 'Logging'
Under 'Log File' ensure that the 'Format' selected is 'W3C' and click 'Select Fields...' > Under 'Custom Fields' click 'Add Field...'
In Field Name enter:
Cert-Issuer
In Source Type select:
Server Variable
In Source select:
CERT_ISSUER
Click 'Add Field...'
In Field Name enter:
Cert-Subject
In Source Type select:
Server Variable
In Source select:
CERT_SUBJECT
Click 'Add Field...'
In Field Name enter:
Cert-SN
In Source Type select:
Server Variable
In Source select:
CERT_SERIALNUMBER
Click 'OK' and 'OK' and the 'Apply' on the top right to save the changes.
- Perform in IISRESET to apply the logging changes
(IIS logs are saved by default under: C:\inetpub\logs\LogFiles\W3SVC1)
Below is an example of a request that came from a machine with a client certificate issued by 'cybr Issuing CA' to 'Mike' with the serial number '23-00-00-00-0c-cb-f5-d4-72-25-7e-20-5d-00-00-00-00-00-0c':
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken Cert-Issuer Cert-Subject Cert-SN
2024-05-16 20:57:57 10.0.10.20 GET /aimwebservice/api/accounts appid=sampleapp&safe=demosafe&address=1.1.1.1 443 - 10.0.10.20 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/124.0.0.0+Safari/537.36 - 200 0 0 166 DC=com,+DC=cybr,+CN=cybr+Issuing+CA DC=com,+DC=cybr,+CN=Users,+CN=Mike,+E=mike@cybr.com 23-00-00-00-0c-cb-f5-d4-72-25-7e-20-5d-00-00-00-00-00-0c
Images-