diff options
author | Simon Rettberg | 2018-03-09 16:54:30 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-03-09 16:54:30 +0100 |
commit | d905ac0c307dd747749a3afe72f327f9125aa86b (patch) | |
tree | ff2c9151d0645ff1236b2fc7ba46cf8babc7fde0 /core/modules/pam-slx-plug | |
parent | [pam] Remove session logging and process killing/unmount, those are now exter... (diff) | |
download | mltk-d905ac0c307dd747749a3afe72f327f9125aa86b.tar.gz mltk-d905ac0c307dd747749a3afe72f327f9125aa86b.tar.xz mltk-d905ac0c307dd747749a3afe72f327f9125aa86b.zip |
[pam-slx-plug] Implement session open/close handling
Diffstat (limited to 'core/modules/pam-slx-plug')
-rwxr-xr-x | core/modules/pam-slx-plug/data/opt/openslx/pam/exec_session | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/core/modules/pam-slx-plug/data/opt/openslx/pam/exec_session b/core/modules/pam-slx-plug/data/opt/openslx/pam/exec_session index a789e062..8e7b7bff 100755 --- a/core/modules/pam-slx-plug/data/opt/openslx/pam/exec_session +++ b/core/modules/pam-slx-plug/data/opt/openslx/pam/exec_session @@ -1,8 +1,35 @@ #!/bin/ash -# TODO - # PAM_TYPE will be "open_session" or "close_session" +# Needed as pam_script clears PATH +export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin" + +# can only work if script is run as root +[ "x$(whoami)" = "xroot" ] || exit 0 + +# just exit for greeter sessions +[ "x${PAM_SERVICE%greeter}" != "x${PAM_SERVICE}" ] && exit 0 + +if [ "$PAM_TYPE" = "open_session" ]; then + # OPEN OPEN OPEN + # source the stuff in pam_script_ses_open.d, if it exists + for HOOK in /opt/openslx/scripts/pam_script_ses_open.d/*; do + [ -f "$HOOK" ] || continue + # source it, in case of failure do nothing since these scripts are non-critical + ( . "$HOOK" ) || slxlog "pam-hooks-ses-open" "Could not source '$HOOK'." + done + # +elif [ "$PAM_TYPE" = "close_session" ]; then + # CLOSE CLOSE CLOSE + # source hooks if there are any + for HOOK in /opt/openslx/scripts/pam_script_ses_close.d/*; do + [ -f "$HOOK" ] || continue + # failure is non-critical + ( . "$HOOK" ) || slxlog "pam-hooks-ses-close" "Could not source '$HOOK'." + done + # +fi + exit 0 |