mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 08:52:18 +03:00
bug fix for pam session open
This commit is contained in:
parent
25d8af83d0
commit
d7d79d848b
1 changed files with 28 additions and 3 deletions
|
@ -1,6 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ -n $PAM_USER ]; then
|
|
||||||
if [ $PAM_USER != "root" ]; then
|
function error_exit() {
|
||||||
sudo python3 /opt/ahenk/ahenkd.py login $PAM_USER
|
log "$1:$2 failed, exit status $?"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'error_exit "${BASH_SOURCE}" "${LINENO}"' ERR
|
||||||
|
|
||||||
|
LOG=/var/log/pam_script.log
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
logger --priority auth.info --tag "$0" "$@"
|
||||||
|
echo "$(date) $0: $@" >> $LOG
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n $PAM_USER ] && [ $PAM_USER != "root" ]; then
|
||||||
|
if ([ -n $PAM_SERVICE ] && [[ $PAM_SERVICE == *"dm" ]]) || ([ -n $PAM_TTY ] && [[ $PAM_TTY == ":"* ]]); then
|
||||||
|
SERVICE="none"
|
||||||
|
if [ -n $PAM_SERVICE ]; then
|
||||||
|
SERVICE="$PAM_SERVICE"
|
||||||
|
fi
|
||||||
|
TTY_DISPLAY="none"
|
||||||
|
if [ -n $PAM_TTY ]; then
|
||||||
|
TTY_DISPLAY="$PAM_TTY"
|
||||||
|
fi
|
||||||
|
log "login: $PAM_USER service: $SERVICE tty: $TTY_DISPLAY"
|
||||||
|
sudo python3 /opt/ahenk/ahenkd.py login $PAM_USER SERVICE TTY_DISPLAY
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue