You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

notify-pam.sh 634B

1234567891011121314151617181920212223242526272829
  1. #! /usr/bin/env sh
  2. if [ ! "${PAM_TYPE}" = "open_session" ]
  3. then
  4. exit 0
  5. fi
  6. if [ -e /etc/notify-pam/ignore-list ]
  7. then
  8. while read line
  9. do
  10. user="$(echo "${line}" | cut -d' ' -f1)"
  11. service="$(echo "${line}" | cut -d' ' -f2)"
  12. if [ "${PAM_USER}" = "${user}" ] && [ "${PAM_SERVICE}" = "${service}" ]
  13. then
  14. exit 0
  15. fi
  16. done < /etc/notify-pam/ignore-list
  17. fi
  18. {
  19. echo "User: $PAM_USER"
  20. echo "Ruser: $PAM_RUSER"
  21. echo "Rhost: $PAM_RHOST"
  22. echo "Service: $PAM_SERVICE"
  23. echo "TTY: $PAM_TTY"
  24. echo "Date: `date`"
  25. echo "Server: `hostname -f`"
  26. } | mail -s "`hostname -s` $PAM_SERVICE login: $PAM_USER" root