#pam #auth

pam-auth

Safe Rust wrapper for PAM authentification

20 releases

0.5.5 Jul 4, 2018
0.5.4 Mar 21, 2018
0.5.3 Dec 4, 2017
0.5.2 Jun 19, 2017
0.0.5-pre Mar 29, 2015

#6 in Authentication

Download history 22/week @ 2018-05-04 21/week @ 2018-05-11 22/week @ 2018-05-18 42/week @ 2018-05-25 84/week @ 2018-06-01 5/week @ 2018-06-08 115/week @ 2018-06-15 21/week @ 2018-06-22 171/week @ 2018-06-29 14/week @ 2018-07-06 29/week @ 2018-07-13 63/week @ 2018-07-20 42/week @ 2018-07-27

203 downloads per month

pam-auth Version License Build Status

Safe Rust bindings to Linux Pluggable Authentication Modules (PAM). Currently only supports basic username/password authentication.

Documentation @ docs.rs

Warning

Environment support through the env module is probably broken and should not be used in the current state!

Supported Rust versions

The library is only continuously built against Rust stable, beta and nightly but as it does not use a lot of new language features it should probably compile on older versions as well. If you encounter problems building on older versions and a small fix can be applied to make the build succeed, consider opening a pull request.

Note about stability

This crate follows semantic versioning. As such all versions below 1.0.0 should be considered development versions. This means the API could change any time.

Usage

  1. Add pam-auth to your Cargo.toml:
[dependencies]
pam-auth = "0.5.0"
  1. Use the Authenticator struct to authenticate and open a session
extern crate pam_auth;
pub fn main() {
        let service = "<yourapp>";
        let user = "<user>";
        let password = "<pass>";

        let mut auth = pam_auth::Authenticator::new(service).unwrap();
        auth.set_credentials(user, password);
        if auth.authenticate().is_ok() && auth.open_session().is_ok() {
            println!("Successfully opened a session!");
        }
        else {
            println!("Authentication failed =/");
        }
}

TODO:

  • Implement basic user/password authentication
  • Add Authenticator struct
  • Add documentation
  • Verify current conv does not leak memory
  • Allow custom conv functions to be passed (in pam-sys?)
  • Code cleanup

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

MIT OR Apache-2.0 license

Dependencies

Reverse deps