A small .NET command-line utility to generate (or update) Kerberos keytab files for an Active Directory service account which has a SPN bound to it.
The tool authenticates with a user account, validates access to the target SPN, determines the correct Kerberos salt, and writes keytab entries for modern AES encryption types.
- Generates keytab entries for a service principal name (SPN)
- Creates a new keytab file or updates an existing one
- Adds entries for these encryption types:
AES128_CTS_HMAC_SHA1_96AES256_CTS_HMAC_SHA1_96AES128_CTS_HMAC_SHA256_128AES256_CTS_HMAC_SHA384_192
- .NET SDK
10.0(project target:net10.0) - Network access to your Kerberos/Active Directory domain controllers
- A valid user account that can request a service ticket for the target SPN
- User needs to have servicePrincipalName set for the target SPN (e.g.,
HTTP/app.example.com) - rc4 only accounts are not supported. Change the password to enable AES support on the AD KDCs
ktpassmust be run by an AD adminktpasschanges the upn to the spn name. This is required to change the salt to the RFC format- UPNs with '/' are not handled well with tools like entra ad sync
- This tools works with normal sys accounts and don't modify the accounts at all
From the repository root:
dotnet buildad-spn-keytab-util --user svc_account@EXAMPLE.COM --spn HTTP/app.example.com --output service.keytabWhen started, the tool prompts for the user password interactively.
-u,--user(required): Username, optionally asuser@DOMAIN-d,--domain(optional): Kerberos realm/domain (required if--userdoes not include@DOMAIN)-s,--spn(required): Target service principal name-o,--output(required): Path to the keytab file to create or update
The project is configured as a .NET tool package:
- Tool command name:
ad-spn-keytab-util - Package version:
0.0.1
Apache 2.0. See LICENSE.