centos-pam-with-update-motd icon indicating copy to clipboard operation
centos-pam-with-update-motd copied to clipboard

Replace with a ~custom~ built-in PAM module

Open gdubicki opened this issue 2 years ago • 2 comments

The main thing I would like to do is to run https://github.com/gdubicki/dynamotd (or a different program) to show a colored, dynamic MOTD on Centos 7 and Rocky 8.

And this solution for Centos 7 is only working for dynamic MOTD without colors - it is NOT working with colors (yet - see #3), not working on Rocky 8 and requires SELinux to be disabled.

I am starting to think that instead of hacking PAM itself and its built-in modules we should rather create a custom PAM module that will only run a specific program and show that as a MOTD. I am hoping that although the initial effort will be significant - I have little experience with coding in C - but the result will be a much cleaner and easier to maintain solution.

Note to self: check out https://github.com/beatgammit/simple-pam.

gdubicki avatar Mar 20 '22 00:03 gdubicki

It seems that we can achieve this by just using the built-in mod_exec module, like this:

session    optional     pam_exec.so stdout /usr/local/bin/dynamotd-linux-amd64 -force-color

...for dynamotd v1.1+.

(I feel like something in between 🥳 and 🤦‍♂️ , but I did learn a lot while working on this, so mostly 😀.)

gdubicki avatar Mar 20 '22 11:03 gdubicki

Updated dynamotd docs: https://github.com/gdubicki/dynamotd/commit/b059664b13c1e64fc698bc9347c5ceda8bb851e5

gdubicki avatar Mar 27 '22 16:03 gdubicki