| Crates.io | awol2005ex_kinit |
| lib.rs | awol2005ex_kinit |
| version | 0.0.1 |
| created_at | 2025-10-28 08:03:10.146733+00 |
| updated_at | 2025-10-28 08:03:10.146733+00 |
| description | Kerberos authentication using password or keytab |
| homepage | |
| repository | https://gitee.com/awol2010ex/awol2005ex_kinit |
| max_upload_size | |
| id | 1904331 |
| size | 80,259 |
A Rust implementation of the Kerberos kinit command that supports both password and keytab authentication to obtain Kerberos TGT (Ticket Granting Ticket).
kinit principal)kinit -kt keytab principal)krb5.conf configuration files# Password authentication (prompts for password)
kinit principal@REALM.COM
# Keytab authentication (non-interactive)
kinit -t keytab_file.keytab principal@REALM.COM
# Specify KDC server explicitly
kinit principal@REALM.COM -s kdc.server.com
# Specify encryption type for password authentication
kinit principal@REALM.COM -e 18 # AES256
kinit principal@REALM.COM -e 17 # AES128
kinit principal@REALM.COM -e 23 # RC4-HMAC
# With verbose logging
kinit principal@REALM.COM -v
<PRINCIPAL>: Kerberos principal in format username@REALM (required)-t, --keytab <FILE>: Path to keytab file for keytab authentication-s, --server <SERVER>: KDC server hostname or IP address (optional)-e, --enctype <TYPE>: Encryption type for password authentication: 18 (AES256), 17 (AES128), 23 (RC4)-v, --verbose: Enable verbose logging-h, --help: Display help informationNote: If --keytab is not specified, the tool will prompt for password authentication.
# Password authentication (prompts for password)
kinit hdfs@TEST.COM
# Password authentication with specific KDC
kinit hdfs@TEST.COM -s 192.168.1.100
# Password authentication with AES256 encryption
kinit hdfs@TEST.COM -e 18
# Keytab authentication (non-interactive)
kinit -t hdfs@TEST.COM.keytab hdfs@TEST.COM
# Keytab authentication with specific KDC
kinit -t hdfs@TEST.COM.keytab hdfs@TEST.COM -s 192.168.1.100
# Verbose output for debugging
kinit hdfs@TEST.COM -v
kinit -t service.keytab service/user@EXAMPLE.COM -v
The tool automatically discovers KDC servers by reading Kerberos configuration files in the following order:
KRB5_CONFIG environment variable/etc/krb5.conf/etc/krb5/krb5.confC:\Windows\krb5.ini%WINDIR%\krb5.iniThe tool saves obtained credentials to a credential cache file:
KRB5CCNAME environment variable is set, uses that path{principal}.ccache (with @ and / replaced by _)The tool supports the following encryption types for both password and keytab authentication:
For password authentication:
-e option to specify a specific encryption typeFor keytab authentication:
Common error scenarios and their meanings:
username@REALMcargo build --release
The binary will be available at target/release/kinit
Run the test suite:
cargo test
This tool depends on the following Kerberos libraries:
awol2005ex_kerbeiros: Core Kerberos functionalityawol2005ex_kerberos_keytab: Keytab file parsingawol2005ex_kerberos_crypto: Cryptographic operationsThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2024 awol2005ex
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.