Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
/ rpam_motd Public archive

Rust implementation of pam_motd with overlays and dropins

Notifications You must be signed in to change notification settings

lucab/rpam_motd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rpam_motd

Build Status

A small Rust implementation of pam_motd, with support for overlays and dropins.

This shows how to write a simple pure-Rust PAM module to display a "message of the day" (motd). At the same time, this enhances pam_motd to support looking up paths with different priorities and merging multiple snippets.

By default, the following paths are sourced in this order:

  • /etc/motd (file)
  • /run/motd (file)
  • /usr/lib/motd (file)
  • /etc/motd.d/ (snippets)
  • /run/motd.d/ (snippets)
  • /usr/lib/motd.d/ (snippets)

This project follows the systemd-style approach of overlaying files and dropin snippets from multiple hierarchies (i.e. /usr/lib, /run, and /etc).

It does not have any additional non-Rust runtime dependency, that is it does not link against libpam.so on the target host.

Demo

This crate produces a shared object (librpam_motd.so) which can be directly installed as a PAM module, as follows:

$ cargo build --release
$ sudo install -o root -g root -m 0644 -D -s -Z target/release/librpam_motd.so /lib/x86_64-linux-gnu/security/rpam_motd.so

Please note that PAM modules path differs across distribution, so the /lib/x86_64-linux-gnu/security/ above may need to be adjusted to match host setup.

Default configuration for this PAM module is available under config/rpam-sample.

A live-action demo of that is in the following asciinema recording:

asciicast

Disclaimer

This project is an early proof-of-concept, and it may expose some raw edges or unexpected behavior.

About

Rust implementation of pam_motd with overlays and dropins

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages