CPM - CACPM810E Failed to get user token OR CACPM071E Error creating password operation process (error 0) OR CACPM453E Error creating logon token using logon user (error 0)
Symptom
When CPM fails to get a user token for PluginManagerUser in order to execute a CPM plugin, an incorrect error code is logged in the pm.log.
IE when reason if due to "Incorrect Function" which is error code 1, the following is logged:
28/09/2022 14:52:35 [2084] CACPM810E Failed to get user token.
28/09/2022 14:52:35 [2084] CACPM453E Error creating logon token using logon user (error 0).
Use the PowerShell code script below to attempt to login with PluginManagerUser and see the actual error code. When script is executed it will securely prompt for PluginManagerUser password and return output to the console regarding the attempt.
[SecureString]$pmuPassword = Read-Host -Prompt "PluginManagerUser Password" -AsSecureString
$logonUserDefinition =
@'
[DllImport( "advapi32.dll", SetLastError = true)]
public static extern bool LogonUser( String lpszUserName,
String lpszDomain,
String lpszPassword,
int dwLogonType,
int dwLogonProvider,
ref IntPtr phToken );
'@
$AdvApi32 = Add-Type -MemberDefinition $logonUserDefinition -Name "AdvApi32" -Namespace "PsInvoke.NativeMethods" -PassThru
$tokenHandle = [IntPtr]::Zero
$authenticated = $AdvApi32::LogonUser('PluginManagerUser', $null, [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pmuPassword)), 2, 0, [Ref]$tokenHandle)
$codeout = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
If ($authenticated -eq $true) {
"Successfully authenticated PluginManagerUser" | Write-Host -ForegroundColor Green
}
Else {
"Failed to authenticate PluginManagerUser" | Write-Host -ForegroundColor Red
"Error Code: $codeout, $([System.ComponentModel.Win32Exception]::new($codeout).Message)" | Write-Host
}
Expected Behavior:
error should contain the correct error code, in this case 1, and preferably the error code description, in this case "Incorrect Function".
Environment
14.6 Privileged Access Manager (PAM, self-hosted) Central Policy Manager (CPM)
Cause
Cause: "Network security: Restrict NTLM:Incoming NTLM Traffic" -"Deny all accounts" or "Deny all domain accounts"
Resolution
Workaround description
There are three options for workaround.
1) Set "Network Security: Restrict NTLM: Incoming NTLM traffic" to "Allow All". With this setting, the CPM can successfully run in user separation mode while still joined to the domain.
2) Disjoin the CPM from the Active Directory domain. With the CPM disjoined from the domain, "Network Security: Restrict NTLM: Incoming NTLM traffic" can still be set to "Deny all domain accounts" or "Deny all accounts" and user separation will work successfully.
3) If you run the script and get Failed to authenticate PluginManagerUser with Error Code -2146892994, Smartcard logon is required and was not use.
This is due to policy need smartcard logon, which is NOT supported by CPM at this time. Need change policy to use password for all CPM local users.
4) Setting the platforms to "RunPluginWithHighPrivilege"
Go to Target Account Platform > Automatic Password Management, right-click Additional Policy Settings, and select Add Parameters.
Add the following parameter:
RunPluginWithHighPrivilege: Value = Yes
This is to disable separation of system management functionality from user functionality