(PAM) Howto setup login-notifications

Started by prod_fk, January 28, 2023, 06:54:30 PM

Previous topic - Next topic
January 28, 2023, 06:54:30 PM Last Edit: January 28, 2023, 06:58:16 PM by prod_fk
Hey folks,

I've setup a bash script on all of my machines, which sends a notification via curl to a REST-API every time a login happens.

Adding:

# login notifications
session optional pam_exec.so seteuid /usr/local/bin/common-notify.sh


On Linux in /etc/pam.d/common-session makes the script to execute whenever a user logs in or starts a new session on the system. However I couldn't find any corresponding file on OPNsense :/

I've already tried

  • /etc/pam.d/system
  • /etc/pam.d/sshd
  • /etc/pam.d/login
  • /usr/local/opnsense/service/templates/OPNsense/Auth/system.pam
and also changed optional to required, but logins (over ssh & UI) just keep working without any notification.

On FreeBSD PAM seems different and especially with the special OPNsense configurations (e.g. for 2FA "inside" your password) I just can't find out howto achive this.

Any ideas are highly appreciated!! :)