| 1 |
#! /bin/sh |
| 2 |
# |
| 3 |
# An example pam-script, which can be used as a template for your own |
| 4 |
# |
| 5 |
# The accepted list of scripts: |
| 6 |
# pam_script_auth |
| 7 |
# pam_script_acct |
| 8 |
# pam_script_passwd |
| 9 |
# pam_script_ses_open |
| 10 |
# pam_script_ses_close |
| 11 |
# |
| 12 |
# The environment variables passed by pam-script onto the script |
| 13 |
# (all will exist but some may be null if not applicable): |
| 14 |
# PAM_SERVICE - the application that's invoking the PAM stack |
| 15 |
# PAM_TYPE - the module-type (e.g. auth,account,session,password) |
| 16 |
# PAM_USER - the user being authenticated into |
| 17 |
# PAM_RUSER - the remote user, the user invoking the application |
| 18 |
# PAM_RHOST - remote host |
| 19 |
# PAM_TTY - the controlling tty |
| 20 |
# PAM_AUTHTOK - password in readable text |
| 21 |
# |
| 22 |
# assume a GNU compatible date |
| 23 |
stamp=`/bin/date +'%Y%m%d%H%M%S %a'` |
| 24 |
# get the script name (could be link) |
| 25 |
script=`basename $0` |
| 26 |
# |
| 27 |
LOGFILE=/tmp/pam-script.log |
| 28 |
echo $stamp $script $PAM_SERVICE $PAM_TYPE \ |
| 29 |
user=$PAM_USER ruser=$PAM_RUSER rhost=$PAM_RHOST \ |
| 30 |
tty=$PAM_TTY \ |
| 31 |
args=["$@"] \ |
| 32 |
>> $LOGFILE |
| 33 |
chmod 666 $LOGFILE > /dev/null 2>&1 |
| 34 |
|
| 35 |
# success |
| 36 |
exit 0 |