libgssapi
A safe MIT licensed binding to gssapi
see rfc2744 for more info
gssapi is a huge and complex beast that is also very old (like Computer Chronicles old). The Kerberos 5 mech is covered by an integration test suite (tests/test.sh) that runs the same in-process-KDC handshake and credential tests against all three supported implementations: MIT natively, Heimdal in a podman container, and the Apple GSS framework natively on macOS.
For a simpler cross platform interface to Kerberos 5 see cross-krb5.
Features
The default is empty. None of the optional features build on every
implementation, so the only honest cross-platform default is no features —
each feature does exactly what it says, and enabling one the linked
implementation can't provide is a compile error, not a silent no-op. all
enables everything (MIT only).
iov—wrap_iov/unwrap_iovand theGssIovtypes. MIT + Heimdal (Apple's GSS framework has nogss_wrap_iov).localname—Name::local_name(POSIX local-name mapping). MIT + Heimdal (Apple has nogss_localname).store—Cred::store(store into the default ccache). MIT + Heimdal (Apple has nogss_store_cred).s4u— Kerberos S4U constrained delegation (Cred::impersonate,Cred::store_into, impersonator lookup). MIT only — Heimdal and Apple implement neithergss_acquire_cred_impersonate_namenorgss_store_cred_into.
To enable a feature only where it's available, select it in a target-specific dependency table rather than unconditionally:
[]
= { = "0.10", = ["iov", "localname", "store"] }
Build configuration
The build finds gssapi via pkg-config (preferring MIT over Heimdal),
falling back to searching standard library directories. Two env vars
override this:
LIBGSSAPI_IMPL=mit|heimdal|apple— force the implementation. Handy when both MIT and Heimdal are installed.LIBGSSAPI_PREFIX= colon-separated install prefixes — for installs pkg-config can't find. Each prefix adds<prefix>/includeto the header search and<prefix>/libto the library search.
Example KRB5 Mutual Authentication Between Client and Server
This is the krb5 example verbatim (libgssapi/examples/krb5.rs); run it
with cargo run --example krb5 -- nfs@host.example.com. See the comment at
the top of that file for how to set up the Kerberos environment it needs.
use args;
use ;