16 releases

Uses old Rust 2015

0.5.5 Jun 28, 2024
0.5.4 Feb 9, 2024
0.5.3 Sep 1, 2023
0.5.2 May 2, 2022
0.1.0 Jun 25, 2017

#314 in Unix APIs

Download history 29/week @ 2025-01-27 70/week @ 2025-02-03 72/week @ 2025-02-10 58/week @ 2025-02-17 47/week @ 2025-02-24 43/week @ 2025-03-03 88/week @ 2025-03-10 52/week @ 2025-03-17 44/week @ 2025-03-24 47/week @ 2025-03-31 26/week @ 2025-04-07 20/week @ 2025-04-14 41/week @ 2025-04-21 37/week @ 2025-04-28 47/week @ 2025-05-05 74/week @ 2025-05-12

201 downloads per month
Used in 2 crates

GPL-3.0 license

31KB
550 lines

PAM Service Module wrappers

Usage

For example, here is a time based authentication module :

#[macro_use] extern crate pamsm;
extern crate time;

use pamsm::{PamServiceModule, Pam, PamFlags, PamError};

struct PamTime;

impl PamServiceModule for PamTime {
    fn authenticate(pamh: Pam, _: PamFlags, args: Vec<String>) -> PamError {
        let hour = time::OffsetDateTime::now_utc().hour();
        if hour != 4 {
            // Only allow authentication when it's 4 AM
            PamError::SUCCESS
        } else {
            PamError::AUTH_ERR
        }
    }
}

pam_module!(PamTime);

PAM SM

Crates.io version shield Crates.io license shield

Rust FFI wrapper to implement PAM service modules for Linux.

Documentation - Cargo - Repository

Features

This crate supports the following optional features:

  • libpam: this enables the extension trait PamLibExt and linking against libpam.so for its native implementation.

Dependencies

~120KB