jcmturner / gokrb5

Pure Go Kerberos library for clients and services
Apache License 2.0
717 stars 243 forks source link

Encryption Type Parsing of krb5.conf - Case Sensitive #526

Open cnigh opened 11 months ago

cnigh commented 11 months ago

Description Morning, I've been working to write a SPNEGO HTTP client by using a provided krb5.conf and a keytab for client.NewWithKeytab().

Through the testing, it worked well on my laptop (macos) but was having issues with it on my Oracle Linux 7.9 servers. On the Linux servers, I kept getting no support for encryption type error messages: 2023/08/11 09:55:17 could not login client: [Root cause: KDC_Error] KDC_Error: AS Exchange Error: kerberos error response from KDC: KRB Error: (14) KDC_ERR_ETYPE_NOSUPP KDC has no support for encryption type

Upon inspecting my krb5.conf, I noticed that the linux server had specified several encryption types as preferred where as my laptop did not:

[libdefaults]
 default_tgs_enctypes = AES256-CTS AES128-CTS RC4-HMAC DES-CBC-MD5 DES-CBC-CRC
 default_tkt_enctypes = AES256-CTS AES128-CTS RC4-HMAC DES-CBC-MD5 DES-CBC-CRC
 preferred_enctypes = AES256-CTS AES128-CTS RC4-HMAC DES-CBC-MD5 DES-CBC-CRC

Reproduction Steps

Question/Bug It seems that the encryption types are made case-sensitive by this function: https://github.com/jcmturner/gokrb5/blob/855dbc707a37a21467aef6c0245fcf3328dc39ed/iana/etypeID/constants.go#L91

Since linux does not seem to have issues with the upper-case encryption types, should the look up of the type be converted to lowercase before look up?

Data