CONFIGURING KERBEROS SSO
To enable authentication using Kerberos, the following requirements must be met:
- Kerberos_ENABLED=true (enables the Kerberos authentication strategy).
- KERBEROS_KEYTAB_PATH=/etc/krb5_multi.keytab (absolute or relative path to the keytab file; see Generating a Keytab File).
- Ensure that DNS contains A and RTP records for the server where PLAN-R will be deployed.
- Configure browsers for SSO.
- Integration with Active Directory must be configured. For details, see Active Directory Integration.
Once all requirements are met, a "kerberos" button should appear on the sign-in screen. Clicking it authenticates the user using their operating system session.
Operating system session authentication button
Generating a Keytab File
An SPN (Service Principal Name) is a unique identifier for a service instance. Kerberos authentication uses an SPN to map a service instance to a service logon account. This allows client applications to authenticate a service without knowing its account name.
Before Kerberos can use an SPN to authenticate a service, the SPN must be registered to the account used to sign in. An SPN can be registered to only one account. If the account associated with the SPN changes, the SPN must be registered again.
When a client needs to use a service, it locates a service instance, constructs an SPN for that instance, and then uses the SPN for authentication.
A keytab file contains pairs of Kerberos principals and their keys, derived from their Kerberos passwords. These files enable authentication in systems that use Kerberos without entering a password. If a principal's password changes, the keytab file must be regenerated.
Windows DC
- Create a user account to associate with the SPN. Prevent the user from changing the password and configure the password to never expire; otherwise, the keytab file will need to be regenerated.
Creating a user on a Windows DC
- Register the SPN to the account using the domain controller's command prompt.
- setspn -A HTTP/test-planr.dppm.ru planr-sso
Registering the SPN to the created account
To verify that the SPN has been registered to the account correctly, run:
- setspn -L planr-sso
Verifying SPN registration to the created account
- Create the keytab file and map the principal to the account using the following command:
- ktpass -princ HTTP/test-planr.dppm.ru@DPPM.RU -mapuser planr-sso -pass Pa$$word -ptype KRB5_NT_PRINCIPAL -crypto AES256-SHA1 -out C:\planr.keytab
where:
- -princ — principal name containing the SPN and Kerberos realm;
- -mapuser — user account associated with the SPN;
- -pass — user password;
- -ptype — principal type (KRB5_NT_PRINCIPAL is recommended);
- -crypto — encryption algorithm (AES256-SHA1 is recommended);
- -out — path and name of the generated file.
Creating a keytab file
To test Kerberos authentication using the keytab file and verify that it works, run the following command in Linux:
- kinit -5 -V -k -t ./planr.keytab HTTP/test-planr.dppm.ru@DPPM.RU
Testing authentication
- Open the ADUC snap-in and verify that the created account's "User logon name" has changed to the registered SPN. Ensure that 128-bit and 256-bit encryption support is enabled for Kerberos.
Verifying the account
- Copy the generated keytab file to the PLAN-R server and specify its path using the KERBEROS_KEYTAB_PATH variable in the .env file.
Samba DC
- Create a user account and register the SPN to it.
- samba-tool user create --random-password planr-sso
- samba-tool user setexpiry planr-sso –noexpiry
- samba-tool spn add HTTP/plan-r.ru planr-sso
Creating a user and registering the SPN
- Verify that the created account's "User logon name" has changed to the registered SPN. If it has not, manually enter the registered SPN in the "User logon name" field before generating the keytab file. Also ensure that 128-bit and 256-bit encryption support is enabled for Kerberos.
User logon name
- Generate the keytab file using the following command.
Generating a keytab file for a Samba DC
- Copy the file to the server and specify its path using the KERBEROS_KEYTAB_PATH variable.
RED OS
- Create a service account to associate with the SPN.
- RED ADM Directory Service -> Domain Object Management -> Users -> Create
Attention! The password must never expire.
Domain Object Management. Users
- Create an SPN.
- RED ADM Directory Service -> Domain Management -> Global Configuration -> SPN -> Add
Global Configuration. SPN
- Enter the SPN in the SPN field. In the Associate with... field, click ..., find the user created in the previous step to associate with the SPN, and click Select.
SPN. Add SPN
SPN. Object search
- The fields in the Add SPN dialog should now be populated as shown below. Click Add.
Creating an SPN
- Next, change the Logon name setting in the properties of the user you created.
RED ADM -> Domain Object Management -> Users -> Select the created user -> Account -> Logon name -> Replace with the registered SPN -> Save
Account. Logon name
- Generate a keytab file.
- Sign in to the domain controller using a domain administrator account and generate the keytab file by running the following command in the terminal:
samba-tool domain exportkeytab /tmp/planr.keytab --principal=HTTP/planr.dp.red.ru@DP.RED.RU
- To test Kerberos authentication using the keytab file and verify that it works, run:
kinit -5 -V -k -t /tmp/planr.keytab HTTP/planr.dp.red.ru@DP.RED.RU
- Copy the generated keytab file to the PLAN-R server and specify its path using the KERBEROS_KEYTAB_PATH variable in the .env file.
Configuring Browsers for SSO
Configuring Google Chrome, Microsoft Edge, and Yandex Browser for Kerberos Authentication
To configure Google Chrome, Microsoft Edge, and Yandex Browser to use Kerberos, follow these steps:
- Open Control Panel -> Internet Options -> Security tab -> Local intranet -> Sites.

SSO configuration. Internet Options
- Click Advanced.

SSO configuration. Local intranet
- In the Add this website to the zone field, enter the domain name of the host running the PLAN-R services and click Add.

SSO configuration. FQDN
The settings are the same for all three browsers in Windows.
Configuring Firefox for Kerberos Authentication
To enable Kerberos authentication for users of Firefox, open about:config in the browser and enter the domain name of the host running the PLAN-R services in the following configuration parameters:
network.negotiate-auth.trusted-uris
network.negotiate-auth.delegation-uris
Browser configuration
Troubleshooting
If you encounter problems with Kerberos authentication, check the logs:
- Add or uncomment the following variable in the .env file:
KERBEROS_LOG_LEVEL=debug - Restart the application by running ./start.sh.
- Check the Nginx logs using:
docker logs planr-proxy-1
DNS must contain an A record pointing to the server's IP address. The host name in the SPN must exactly match this A record (for example, if the A record is planr.ru, the SPN must be HTTP/planr.ru).
Diagnostics
On the server: Open a shell in the proxy server container (the name may differ depending on your architecture):
docker exec -it planr-proxy-1 bash
Inside the container, you can perform the following checks:
- Display the contents of the keytab file to see which SPNs and encryption algorithms it contains:
klist -ke /etc/krb5_multi.keytab - Test Kerberos authentication using the keytab file, simulating Nginx:
kinit -5 -V -k -t /etc/krb5_multi.keytab HTTP/<enter SPN>
On the client:
- List the SPNs registered to a specific service account in AD:
setspn -L <ServiceAccountName> - Find an account in AD by a known SPN to help identify duplicates:
setspn -Q HTTP/plan-r.ru - Display the Kerberos tickets currently stored in the client computer's memory to verify that the browser has obtained a ticket:
klist - Clear the entire Kerberos ticket cache. Run this on the client after changing the service account password or regenerating the keytab file:
klist purge
Merging Multiple Keytab Files
If you use multiple domain zones, you will need to merge their keys into a single krb5_multi.keytab file. In Linux, use the interactive ktutil utility:
# Start the utility
ktutil
# Read the keytab files one at a time:
ktutil: rkt domain1.keytab
ktutil: rkt domain2.keytab
# Write the result to a new combined file:
ktutil: wkt krb5_multi.keytab
ktutil: quit
Common Errors
- Repeated password prompts or a 401 Unauthorized error in the browser
- Cause: The browser does not send a Kerberos ticket to the server.
- Solution: Check that the system URL has been added to the Local intranet zone in Windows settings. Ensure that the client PC is joined to the domain and can contact the domain controller to obtain a ticket.
- Nginx error: Cannot find key for HTTP/xxx kvno X in keytab
- Cause: The key version number (KVNO) in AD has increased, for example, because the service account password was changed or the SPN was reissued, but the server still has the old keytab file.
- Solution: Generate a new keytab file on the domain controller and replace the file on the server. If necessary, run klist purge on the client PCs.
- Permission denied error when accessing the keytab file
- Cause: Nginx does not have permission to read the mounted krb5_multi.keytab file. This can occur when the file is copied to a Linux host and is readable only by root.
- Solution: Check the file's owner and permissions on the host machine. Ensure that the file is readable, for example, by running chmod 644 krb5_multi.keytab.