Crate kadmin

Crate kadmin 

Source
Expand description

Rust bindings to libkadm5

This is a safe, idiomatic Rust interface to libkadm5. This crate offers two features, client and local. They are similar to how kadmin-sys behaves. You should only enable one of them.

With the client feature:

use kadmin::{KAdmin, KAdminImpl};

let princ = "user/admin@EXAMPLE.ORG";
let password = "vErYsEcUrE";

let kadmin = KAdmin::builder().with_password(&princ, &password).unwrap();

dbg!("{}", kadmin.list_principals(None).unwrap());

With the local feature:

use kadmin::{KAdmin, KAdminImpl};

let kadmin = KAdmin::builder().with_local().unwrap();

dbg!("{}", kadmin.list_principals(None).unwrap());

§About thread safety

As far as I can tell, libkadm5 APIs are not thread safe. As such, the types provided by this crate are neither Send nor Sync. You must not use those with threads. You can either create a KAdmin instance per thread, or use the kadmin::sync::KAdmin interface that spawns a thread and sends the various commands to it. The API is not exactly the same as the non-thread-safe one, but should be close enough that switching between one or the other is easy enough.

Re-exports§

pub use error::Error;
pub use context::Context;
pub use params::Params;
pub use db_args::DbArgs;
pub use tl_data::TlData;
pub use tl_data::TlDataEntry;
pub use keysalt::EncryptionType;
pub use keysalt::KeySalt;
pub use keysalt::KeySalts;
pub use keysalt::SaltType;
pub use kadmin::KAdmin;
pub use kadmin::KAdminApiVersion;
pub use kadmin::KAdminImpl;
pub use kadmin::KAdminPrivileges;
pub use policy::Policy;
pub use principal::Principal;
pub use principal::PrincipalAttributes;

Modules§

context
Manage kerberos contexts
db_args
Define DbArgs to pass to kadm5
error
Error type for various errors this library can encounter
kadmin
KAdmin interface to kadm5
keysalt
Kerberos keysalt lists
params
Define Params to pass to kadm5
policy
kadm5 policy
principal
kadm5 principal
sync
Thread-safe KAdmin interface to kadm5
tl_data
Kadm5 TlData