Kerberos Authentication
Kerberos is a network authentication protocol that verifies the identity of a user or a host. A user obtains a ticket-granting ticket (TGT) from the Key Distribution Center (KDC), which runs on the domain controller. The user then uses the TGT to request a service ticket and presents that ticket to the service they want to access.
The Kerberos protocol lets Active Directory users sign in to the Axidian Privilege console with a domain account: the user doesn't need to enter a password, because authentication relies on the issued ticket.
- Kerberos authentication supports a single Active Directory domain. If other directories are connected, disable them in the Web Wizard.
- When Kerberos authentication is configured, only internal users can sign in to PAM with a username and password.
- The time on the Management Server, the domain controller, and the user's computer must be synchronized. If the time skew exceeds the maximum tolerance configured in the domain (5 minutes by default), the KDC rejects the tickets. For more information, see the Microsoft documentation.
Preparing the infrastructure
Select the scenario that matches your PAM deployment.
- Management Server on Windows
- Management Server on Linux
If the Management Server runs on Windows, complete the following steps:
- Verify the SPN for each address that users use to open the PAM console.
- Configure authentication in the Web Wizard.
- Configure the browser for Kerberos sign-in.
A Windows-based Management Server is joined to the domain, so no keytab file is required.
Verifying the SPN
A service principal name (SPN) is the unique identifier of a service instance. Kerberos authentication uses SPNs to associate a service instance with a service logon account.
- Basic deployment
- Load-balanced deployment
Perform these steps on a domain controller or on a domain-joined computer that has the Remote Server Administration Tools (RSAT) or the Active Directory module for PowerShell installed.
For the DNS name of the SPN management server, an SPN is automatically registered for the computer account if the following conditions are met:
- The Management Server is joined to the domain.
- In the Windows Authentication settings, the
useAppPoolCredentialsparameter is set toFalse, so the service ticket is decrypted with the key of the computer account.
If users open the PAM console through a load balancer address or through a DNS alias that doesn't match the DNS name of the Management Server, register the SPN manually.
Verify that the SPN for each PAM FQDN is registered to exactly one account:
Run PowerShell as an administrator.
Run the following command:
setspn -Q */<PAM FQDN>The output must list a single account. In a basic deployment, this is the computer account of the Management Server, in the format
<domain>\<DNS name of the Management Server>$.If the SPN isn't found, or if it's registered to more than one account, contact your domain administrator.
If users open the PAM console through the shared virtual address of a load balancer, you must manually register the SPN for the virtual name, because the virtual name doesn't match the DNS name of the Management Server.
To register the SPN:
Assign a service account as the identity of the
Axidian.Privilege.Idpapplication pool.How to assign the account
NotePerform these steps on every Management Server.
- Open IIS Manager.
- In the Connections pane, select Application Pools.
- Right-click the
Axidian.Privilege.Idppool, and then select Advanced Settings. - In the Process Model section, next to Identity, click
.
- Select Custom account, and then specify the service account. Enter the username in the format
DOMAIN\Account name. - Click OK.
Configure IIS to use the application pool identity (
Axidian.Privilege.Idp) for decrypting Kerberos service tickets.How to configure
Axidian.Privilege.Idpto validate ticketsinfoPerform these steps on every Management Server.
In the Connections pane, select Sites → Default Web Site → idp.
In the Management section, double-click Configuration Editor.
In the Section list, select
system.webServer→security→authentication→windowsAuthentication.Set the
useAppPoolCredentialsparameter toTrue.In the Actions pane, click Apply.
In the IIS section, double-click Authentication.
Select Windows Authentication, and then in the Actions pane, click Providers.
Make sure that the authentication providers are listed in the following order:
Negotiate
NTLMIf a provider isn't listed, select it in the Available Providers list, and then click Add.
To change the order of the providers, use Move Up and Move Down.
Go to Application Pools, select
Axidian.Privilege.Idp, and then in the Actions pane, click Recycle.
Register the SPN for the service account that the
Axidian.Privilege.Idpapplication pool runs under.How to register the SPN manually
infoPerform these steps on a domain controller or on a domain-joined computer that has the Remote Server Administration Tools (RSAT) or the
Active Directorymodule for PowerShell installed.To register the SPN:
Run PowerShell as an administrator.
Run the following command:
setspn -S HTTP/<PAM FQDN> <domain>\<AD account>Examplesetspn -S HTTP/pam.company.local PAM\pam-ad-userThe
-Sswitch checks the forest for duplicate SPNs before it adds the SPN.infoAn SPN must be unique within the forest. Don't register the same SPN for another account.
What to do if the SPN is already registered
If
setspnreturnsDuplicate SPN found, aborting operation!, the SPN is already registered to another account.To resolve the conflict:
Run the following command:
setspn -Q HTTP/<PAM FQDN>The output shows the account that the SPN is currently registered to.
Delete the SPN from that account:
cautionCoordinate the deletion with your domain administrator. The existing SPN might be in use by another service.
setspn -D HTTP/<PAM FQDN> <domain>\<current AD account>Register the SPN for the new account:
setspn -S HTTP/<PAM FQDN> <domain>\<new AD account>Verify that the conflict is resolved and that the SPN is registered to the intended account:
setspn -Q HTTP/<PAM FQDN>The output shows the account that the SPN is now registered to.
List the SPNs registered to the account:
setspn -L <domain>\<AD account>
If the Management Server runs on Linux, complete the following steps:
Prepare the service account that is used to validate tickets.
Register the SPN for each address that users use to open the PAM console.
Prepare the
keytabfile that is used to validate tickets.WarningThe
keytabfile contains the keys of the service account. Treat this file as a secret: never share it or store it in shared file repositories, such as network shares or version control. If the file is compromised, reset the service account password and generate a newkeytabfile.Configure authentication in the Web Wizard.
Configure the browser for Kerberos sign-in.
Preparing the Active Directory service account
A Linux-based Management Server isn't joined to the domain, so PAM has no domain account of its own to validate user tickets during Kerberos authentication. A dedicated Active Directory service account fills this role: you generate a keytab file for this account, and PAM uses the file to validate the tickets that users present when they sign in to the console.
Perform these steps on a domain controller or on a domain-joined computer that has the Remote Server Administration Tools (RSAT) or the Active Directory module for PowerShell installed.
- Active Directory
- PowerShell
- Open Active Directory Users and Computers.
- Go to the appropriate organizational unit, and then create a dedicated service account for the Kerberos configuration.
- Right-click the new account, and then select Properties.
- On the Account tab, in Account options, do the following:
- Select This account supports Kerberos AES 256 bit encryption.
- Clear Use only Kerberos DES encryption types for this account.
- Click OK.
Run PowerShell as an administrator.
Create a dedicated service account for the Kerberos configuration:
New-ADUser -Name "<AD account>" -SamAccountName "<AD account>" `
-UserPrincipalName "<AD account>@<domain>" `
-AccountPassword (Read-Host -AsSecureString "Password") `
-PasswordNeverExpires $true -Enabled $trueExample commandNew-ADUser -Name "pam-ad-user" -SamAccountName "pam-ad-user" `
-UserPrincipalName "pam-ad-user@company.local" `
-AccountPassword (Read-Host -AsSecureString "Password") `
-PasswordNeverExpires $true -Enabled $trueSet the Kerberos AES-256 encryption type for the service account:
Set-ADUser <AD account> -KerberosEncryptionType AES256
Registering the SPN
A service principal name (SPN) is the unique identifier of a service instance. Kerberos authentication uses SPNs to associate a service instance with a service logon account.
- Basic deployment
- Load-balanced deployment
Determine the primary FQDN that users use to open the PAM console. Register an SPN for this address in the format HTTP/<PAM FQDN>, and map it to the dedicated Active Directory service account.
If users open the PAM console through the shared virtual address of a load balancer, register the SPN for that shared address, and map it to the dedicated Active Directory service account.
Perform these steps on a domain controller or on a domain-joined computer that has the Remote Server Administration Tools (RSAT) or the Active Directory module for PowerShell installed.
To register the SPN:
Run PowerShell as an administrator.
Run the following command:
setspn -S HTTP/<PAM FQDN> <domain>\<AD account>Examplesetspn -S HTTP/pam.company.local PAM\pam-ad-userThe
-Sswitch checks the forest for duplicate SPNs before it adds the SPN.infoAn SPN must be unique within the forest. Don't register the same SPN for another account.
What to do if the SPN is already registered
If
setspnreturnsDuplicate SPN found, aborting operation!, the SPN is already registered to another account.To resolve the conflict:
Run the following command:
setspn -Q HTTP/<PAM FQDN>The output shows the account that the SPN is currently registered to.
Delete the SPN from that account:
cautionCoordinate the deletion with your domain administrator. The existing SPN might be in use by another service.
setspn -D HTTP/<PAM FQDN> <domain>\<current AD account>Register the SPN for the new account:
setspn -S HTTP/<PAM FQDN> <domain>\<new AD account>Verify that the conflict is resolved and that the SPN is registered to the intended account:
setspn -Q HTTP/<PAM FQDN>The output shows the account that the SPN is now registered to.
List the SPNs registered to the account:
setspn -L <domain>\<AD account>
Preparing the keytab file
All Management Servers use the same keytab file. If you change the service account password or the PAM FQDN, generate a new keytab file.
The keytab file contains one or more Kerberos principal names and their corresponding secret keys, which are derived from the service account password. The Management Server uses these keys to decrypt and validate the service tickets that the browser presents.
Generating the keytab file
Perform these steps on a domain controller or on a domain-joined computer that has the Remote Server Administration Tools (RSAT) or the Active Directory module for PowerShell installed.
- Basic deployment
- Load-balanced deployment
To generate the keytab file, Run PowerShell as an administrator, and then run the following command:
ktpass -princ HTTP/<PAM FQDN>@<REALM> `
-mapuser <domain\AD account> `
-crypto AES256-SHA1 `
-ptype KRB5_NT_PRINCIPAL `
-pass * `
-out <path to save keytab>
If users open the PAM console through the shared virtual address of a load balancer, generate the keytab file for that shared address.
To generate the keytab file, Run PowerShell as an administrator, and then run the following command:
ktpass -princ HTTP/<Load Balancer FQDN>@<REALM> `
-mapuser <domain\AD account> `
-crypto AES256-SHA1 `
-ptype KRB5_NT_PRINCIPAL `
-pass * `
-out <path to save keytab>
Store the resulting keytab file on a trusted host with restricted access.
Command example and parameters
ktpass -princ HTTP/pam.company.local@COMPANY.LOCAL `
-mapuser PAM\pam-ad-user `
-crypto AES256-SHA1 `
-ptype KRB5_NT_PRINCIPAL `
-pass * `
-out http.keytab
| Parameter | Description |
|---|---|
-princ | The Kerberos principal that the keys are generated for. Specify the value in the format HTTP/<PAM FQDN>@<REALM>REALM is the Kerberos realm name. In most cases, the realm name is your Active Directory DNS domain name, written in uppercase. For example, company.local becomes COMPANY.LOCAL. |
-mapuser | The Active Directory account that the principal is mapped to. The keys in the keytab file are derived from the password of this account. For example: PAM\pam-ad-user. |
-crypto | The encryption type of the keys. Specify AES256-SHA1. |
-ptype | The Kerberos principal type. Specify KRB5_NT_PRINCIPAL—the general principal type used for user and service accounts. |
-pass | The password of the Active Directory account. Specify an asterisk (*) to be prompted for the password. Avoid passing the password in plain text. ktpass resets the account password to the value that you specify. |
-out | The path or the file name to save the keytab file to. You can specify:
|
Avoid running ktpass more than once: each run resets the service account password and increments the Key Version Number (KVNO), which invalidates any keytab file generated earlier. Use only the keytab file that the most recent run produced.
If you generate the file again, update the keytab file in PAM through the Web Wizard.
Validating the keytab file
Validate the file on a trusted Linux host that has restricted access and Kerberos utilities installed.
To validate the keytab file:
Copy the
keytabfile to the trusted host.In the directory that contains the copy of the
keytabfile, create akrb5.conffile with the following structure:[libdefaults]
default_realm = <REALM>
dns_lookup_realm = false
dns_lookup_kdc = true
rdns = false
[domain_realm]
.<DNS domain> = <REALM>
<DNS domain> = <REALM>File example and parameters
Example file[libdefaults]
default_realm = COMPANY.LOCAL
dns_lookup_realm = false
dns_lookup_kdc = true
rdns = false
[domain_realm]
.company.local = COMPANY.LOCAL
company.local = COMPANY.LOCALParameter Description default_realmThe default Kerberos realm—your Active Directory DNS domain name in uppercase letters. The value must match the realm of the principal that is stored in the keytabfile.dns_lookup_realmSpecifies whether the Kerberos realm is resolved through DNS. Set this parameter to false.dns_lookup_kdcSpecifies whether DNS SRV records are used to locate the KDC. Set this parameter to true.rdnsSpecifies whether reverse DNS lookups (PTR records) are used when host names are canonicalized. Set this parameter to false.[domain_realm]The rules that map DNS names to the Kerberos realm: .<DNS domain> = <REALM>— maps the subdomains of the DNS domain to the realm.<DNS domain> = <REALM>— maps the DNS domain itself to the realm.
In the directory that contains the
keytabandkrb5.conffiles, run the following command to obtain a ticket-granting ticket (TGT) for the service principal:KRB5_CONFIG=./krb5.conf \
KRB5CCNAME=FILE:./<ticket file>.ccache \
kinit -V -kt <keytab file> \
HTTP/<PAM FQDN>@<REALM>For the
KRB5CCNAMEparameter, specify the credential cache file that the ticket is written to.Verify that the ticket was obtained:
KRB5CCNAME=FILE:./<ticket file>.ccache klistIf the output lists a ticket, the
keytabfile contains valid keys: the keys match the current service account password and the Key Version Number (KVNO) in Active Directory.If the command returns an error
Error Possible cause and solution Preauthentication failedThe keys in the keytabfile don't match the current password or the Key Version Number (KVNO) on the domain controller. Generate thekeytabfile again.Keytab contains no suitable keysThe keytabfile doesn't contain a suitable key: either the file has no key for the specified principal, or it has no key of an encryption type that the domain controller supports. Check the contents of the file with .klist -kte <keytab file>Client not found in Kerberos databaseThe domain controller has no principal that matches the value of the -princparameter. Make sure that the principal name is correct and that the SPN is registered.Server not found in Kerberos databaseThe domain controller has no krbtgtprincipal for the requested realm. Make sure that theREALMvalue is correct.Cannot find KDC for realmThe host that runs the validation can't locate a domain controller for the specified realm. Check the DNS settings and the availability of the domain controller. After the validation, destroy the credential cache:
KRB5CCNAME=FILE:./<ticket file>.ccache kdestroyDelete the
krb5.conffile and the copy of thekeytabfile from the trusted host.
Configuring authentication in the Web Wizard
You enable Kerberos authentication in the Web Wizard.
Launch the Web Wizard.
How to launch the Web Wizard
In the PAM distribution directory, run the following command to start the Web Wizard:
sudo bash run-wizard.shOpen the URL that the script displays in the console.
In the Access code field, enter the
For example:AuthenticationCodethat the script displays in the console.vVHyTVRyKX5pxUKM6e1ZgCWEnOdXFdOy.Time limitThe access code is valid for two hours.
Click Sign in.
Select a scenario, such as Changing PAM configuration, and follow the instructions in the Web Wizard.
On the Authentication step, select the Kerberos authentication mechanism.
Upload the keytab file that you generated. The file must be generated with AES-256 encryption.
Continue to change the configuration by following the instructions in the Web Wizard.
When the Web Wizard finishes, Kerberos authentication is available on the sign-in page of the PAM console.
Configuring the browser
To sign in to the PAM console using the Kerberos protocol, the browser must send the user's domain credentials to the address where the PAM console is opened. To allow this, add the PAM address to the list of addresses allowed for Integrated Windows Authentication. The list is defined by the AuthServerAllowlist browser policy.
The AuthServerAllowlist policy is configured on a domain controller and distributed through Active Directory Group Policy to all domain-joined computers.
Perform these steps on a domain-joined computer that has the Group Policy Management Tools installed or the GroupPolicy PowerShell module available.
Run PowerShell as an administrator.
Create a Group Policy Object (GPO):
New-GPO -Name "<GPO name>"Configure the
AuthServerAllowlistpolicy for the target browser.- Google Chrome
- Microsoft Edge
Set-GPRegistryValue -Name "<GPO name>" `
-Key "HKLM\Software\Policies\Google\Chrome" `
-ValueName AuthServerAllowlist -Type String -Value "<PAM addresses>"Set-GPRegistryValue -Name "<GPO name>" `
-Key "HKLM\Software\Policies\Microsoft\Edge" `
-ValueName AuthServerAllowlist -Type String -Value "<PAM addresses>"For the
-Valueparameter, specify the addresses that users use to open the PAM console. You can define the list of allowed addresses in the following formats:<PAM FQDN>— an individual PAM address, for example,pam.company.local*.<DNS domain>— every PAM address in the domain, for example,*.company.local*.<DNS domain>,<PAM FQDN>— a combined list, for example,*.company.local,pam.company.local
Specify explicit PAM FQDNs whenever possible. Use the
*.<DNS domain>wildcard only when necessary, because it applies the policy to every server in that DNS domain.Link the GPO to the domain or to the organizational unit (OU) that contains the users' computers:
New-GPLink -Name "<GPO name>" -Target "<DN of domain or OU>"For the
-Targetparameter, specify the distinguished name (DN) of the domain or OU, for example,DC=company,DC=localorOU=Workstations,DC=company,DC=local.
The policy takes effect at the next Group Policy refresh interval on the user's computer. To apply the policy immediately, close all browser processes on the target computer, and then run gpupdate /force.
How to verify that the policy has been applied
Verify the policy on the user's computer.
- Google Chrome
- Microsoft Edge
- Open Google Chrome, and then enter
chrome://policyin the address bar. The browser policies page opens. - Verify that the AuthServerAllowlist policy is listed under Chrome policies.
- Open Microsoft Edge, and then enter
edge://policyin the address bar. The browser policies page opens. - Verify that the AuthServerAllowlist policy is listed under Microsoft Edge policies.
(Optional) Run PowerShell as an administrator and purge the cached Kerberos tickets:
klist purge(Optional) Request a service ticket for the PAM FQDN:
klist get HTTP/<PAM FQDN>
klistThe output lists the following Kerberos tickets:
- A ticket-granting ticket (TGT), which is used to request service tickets.
- A service ticket (also called a TGS ticket), which is used to authenticate to the PAM console.
Sign in to PAM
Users from the connected Active Directory domain can sign in only with Kerberos.
Signing in with a username and password is available only for internal PAM users.
- Open the PAM user console or administrator console.
- Click Sign in with domain account.
- (Optional) Provide your second authentication factor.
If the sign-in attempt fails, contact the PAM administrator.