在 Active Directory 域服务 (AD DS) 中为主机或服务配置服务器主体名称,并生成一个包含服务的共享机密密钥的 .keytab 文件。 .Keytab 文件基于麻省理工学院 (MIT) 对 Kerberos 身份验证协议的实现。 ktpass 命令行工具允许支持 Kerberos 身份验证的非 Windows 服务使用 Kerberos 密钥发行中心 (KDC) 服务提供的互操作性功能。
Syntax
ktpass
[/out <filename>]
[/princ <principalname>]
[/mapuser <useraccount>]
[/mapop {add|set}] [{-|+}desonly] [/in <filename>]
[/pass {password|*|{-|+}rndpass}]
[/minpass]
[/maxpass]
[/crypto {DES-CBC-CRC|DES-CBC-MD5|RC4-HMAC-NT|AES256-SHA1|AES128-SHA1|All}]
[/itercount]
[/ptype {KRB5_NT_PRINCIPAL|KRB5_NT_SRV_INST|KRB5_NT_SRV_HST}]
[/kvno <keyversionnum>]
[/answer {-|+}]
[/target]
[/rawsalt] [{-|+}dumpsalt] [{-|+}setupn] [{-|+}setpass <password>] [/?|/h|/help]
Parameters
Parameter | Description |
---|---|
/外 <filename> |
指定要生成的 Kerberos 版本 5 .keytab 文件的名称。 Note: This is the .keytab file you transfer to a computer that isn't running the Windows operating system, and then replace or merge with your existing .keytab file, /Etc/Krb5.keytab. |
/princ <principalname> |
以主机/computer.contoso.com@CONTOSO.COM 格式指定主体名称。 Warning: This parameter is case-sensitive. |
/地图用户 <useraccount> |
Maps the name of the Kerberos principal, which is specified by the princ parameter, to the specified domain account. |
/mapop {add|set} |
指定映射属性的设置方式。
|
{-|+} desonly |
默认设置仅 DES 加密。
|
/在 <filename> |
指定要从未运行 Windows 操作系统的主机读取的 .keytab 文件。 |
/通过 {password|*|{-|+}rndpass} |
Specifies a password for the principal user name that is specified by the princ parameter. 使用 * 来提示用户输入密码。 |
/minpass | 将随机密码的最小长度设置为 15 个字符。 |
/maxpass | 将随机密码的最大长度设置为 256 个字符。 |
/加密 {DES-CBC-CRC|DES-CBC-MD5|RC4-HMAC-NT|AES256-SHA1|AES128-SHA1|All} |
指定在 keytab 文件中生成的密钥:
Note: Because the default settings are based on older MIT versions, you should always use the |
/itercount | 指定用于 AES 加密的迭代计数。 The default ignores itercount for non-AES encryption and sets AES encryption to 4,096. |
/ptype {KRB5_NT_PRINCIPAL|KRB5_NT_SRV_INST|KRB5_NT_SRV_HST} |
指定主体类型。
|
/kvno <keyversionnum> |
指定密钥版本号。 默认值为 1。 |
/答 {-|+} |
设置后台应答模式:
|
/target | 设置要使用的域控制器。 默认根据主体名称检测域控制器。 如果域控制器名称未解析,则会显示一个对话框,提示输入有效的域控制器。 |
/rawsalt | 强制 ktpass 在生成密钥时使用 rawsalt 算法。 此参数是可选的。 |
{-|+}dumpsalt |
此参数的输出显示用于生成密钥的 MIT salt 算法。 |
{-|+}setupn |
除了设置服务主体名称 (SPN) 之外,还设置用户主体名称 (UPN)。 默认在 .keytab 文件中同时设置这两者。 |
{-|+}setpass <password> |
在提供时设置用户的密码。 如果使用 rndpass,则改为生成随机密码。 |
/? | 显示此命令的帮助。 |
Remarks
在未运行 Windows 操作系统的系统上运行的服务可以使用 AD DS 中的服务实例帐户进行配置。 这样,任何 Kerberos 客户端就都可以使用 Windows KDC 向未运行 Windows 操作系统的服务进行身份验证。
The /princ parameter isn't evaluated by ktpass and is used as provided. There's no check to see if the parameter matches the exact case of the userPrincipalName attribute value when generating the Keytab file. 如果没有精确的大小写匹配,使用此 Keytab 文件的区分大小写的 Kerberos 分发可能会出现问题,甚至可能在预身份验证期间失败。 To check and retrieve the correct userPrincipalName attribute value from a LDifDE export file. For example:
ldifde /f keytab_user.ldf /d CN=Keytab User,OU=UserAccounts,DC=contoso,DC=corp,DC=microsoft,DC=com /p base /l samaccountname,userprincipalname
Examples
若要为未运行 Windows 操作系统的主机创建 Kerberos .keytab 文件,必须将主体映射到帐户并设置主机主体密码。
使用 Active Directory“用户和计算机”管理单元为未运行 Windows 操作系统的计算机上的服务创建用户帐户。 For example, create an account with the name User1.
Use the ktpass command to set up an identity mapping for the user account by typing:
ktpass /princ host/User1.contoso.com@CONTOSO.COM /mapuser User1 /pass MyPas$w0rd /out machine.keytab /crypto all /ptype KRB5_NT_PRINCIPAL /mapop set
Note
不能将多个服务实例映射到同一用户帐户。
Merge the .keytab file with the /Etc/Krb5.keytab file on a host computer that isn't running the Windows operating system.