summaryrefslogtreecommitdiffstats
path: root/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_open
blob: b918278e7eb27698f4fcb5b2b3dfff952311087d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/ash

# 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"

# just exit for greeter sessions
[ "x${PAM_SERVICE%greeter}" != "x${PAM_SERVICE}" ] && exit 0

# NSA needs to know
if [ "x$PAM_SERVICE" != "xsu" -a "x$PAM_SERVICE" != "xsudo" ]; then
	. /opt/openslx/config
	if [ "x$SLX_REMOTE_LOG_SESSIONS" = "xyes" -o "x$PAM_USER" = "xroot" ]; then
		slxlog "session-open" "$PAM_USER logged in on $PAM_TTY"
	elif [ "x$SLX_REMOTE_LOG_SESSIONS" = "xanonymous" ]; then
		slxlog "session-open" "User logged in on $PAM_TTY"
	fi
fi

# source the stuff in pam_script_ses_open.d, if it exists
if [ -d "/opt/openslx/scripts/pam_script_ses_open.d" ]; then
	for HOOK in $(ls "/opt/openslx/scripts/pam_script_ses_open.d"); do
		# source it, in case of failure do nothing since these scripts are non-critical
		. "/opt/openslx/scripts/pam_script_ses_open.d/$HOOK" || slxlog "pam-source-hooks" "Could not source '$HOOK'."
	done
fi

exit 0