jcmturner / gokrb5

Pure Go Kerberos library for clients and services
Apache License 2.0
729 stars 253 forks source link

Fails to parse include and includedir files #504

Open johnnybubonic opened 1 year ago

johnnybubonic commented 1 year ago

Currently, the include and includedir directives of krb5.conf are not parsed. They are not even considered. They are indeed a canonical directive of krb5.conf:

The krb5.conf file can include other files using either of the following directives at the beginning of a line:

include FILENAME includedir DIRNAME

FILENAME or DIRNAME should be an absolute path. The named file or directory must exist and be readable. Including a directory includes all files within the directory whose names consist solely of alphanumeric characters, dashes, or underscores. Included profile files are syntactically independent of their parents, so each included file must begin with a section header.

Because of this, this library entirely fails to work properly on e.g. RHEL/EL Linux distributions which have been joined to a domain via sssd, as SSSD makes use of nested includedir directives to manage Kerberos.

I suspect you could simply do a "pre-pass" parse, searching only for lines that have an include or includedir directive, and replacing those lines in-place with the referenced file(s') contents.

bendylan commented 1 year ago

Just wanted to +1 on this issue, would be nice to have a fix to use this library on EL