summaryrefslogtreecommitdiffstats
path: root/remote/modules
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules')
-rwxr-xr-xremote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script24
-rwxr-xr-xremote/modules/pam/data/opt/openslx/scripts/pam_script_auth21
l---------remote/modules/sshd/data/etc/systemd/system/network.target.wants/sshd.service1
3 files changed, 22 insertions, 24 deletions
diff --git a/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
index 17633caa..9a9bdf1c 100755
--- a/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
+++ b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
@@ -28,13 +28,19 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then
# X11
if [ -n "$DISPLAY" ]; then
# Seems to be x11
- USRHOME=$(/usr/bin/getent passwd "$NAME" | awk -F ':' '{print $6}')
- export XAUTHORITY="$USRHOME/.Xauthority"
+ IDLE=
+ export XAUTHORITY=$(ps a | grep -v grep | grep -o -- '-auth.*$' | awk '{print $2}')
+ [ -n "$XAUTHORITY" ] && [ -f "$XAUTHORITY" ] && IDLE=$(xprintidle)
# Now that we have DISPLAY and XAUTHORITY set, xprintidle should work
- IDLE=$(xprintidle)
+ if [ -z "$IDLE" ]; then
+ # Try user's xauth
+ USRHOME=$(/usr/bin/getent passwd "$NAME" | awk -F ':' '{print $6}')
+ export XAUTHORITY="$USRHOME/.Xauthority"
+ [ -f "$XAUTHORITY" ] && IDLE=$(xprintidle)
+ fi
if [ -n "$IDLE" ]; then
IDLE=$(( $IDLE / 1000 ))
- if [ "$IDLE" -lt "$SLX_LOGOUT_TIMEOUT" ]; then
+ if [ -z "$IDLE" ] || [ "$IDLE" -lt "$SLX_LOGOUT_TIMEOUT" ]; then
IS_IDLE=no
else
loginctl terminate-session "$ses"
@@ -63,11 +69,11 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then
# end other sessions
done
rm -f -- "$TMP"
- if [ "$IS_IDLE" = "yes" ]; then
- [ ! -e "$IDLEHINT" ] && echo "$NOW" > "$IDLEHINT"
- else
- rm -f -- "$IDLEHINT"
- fi
+ fi
+ if [ "$IS_IDLE" = "yes" ]; then
+ [ ! -e "$IDLEHINT" ] && echo "$NOW" > "$IDLEHINT"
+ else
+ rm -f -- "$IDLEHINT"
fi
else
# No logout timeout is set, take shortcut for shutdown timeout (if set)
diff --git a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth
index 65eefcdc..b8ed4166 100755
--- a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth
+++ b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth
@@ -3,21 +3,17 @@
# 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"
-touch "/tmp/ldapsearch.${PAM_USER}"
-chmod 0600 "/tmp/ldapsearch.${PAM_USER}"
-if ldapsearch -l 3 -o nettimeout=3 -x -LLL uid="${PAM_USER}" uid homeMount realAccount > "/tmp/ldapsearch.${PAM_USER}" 2>/dev/null; then
- VOLUME=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^homeMount:" | head -n 1 | cut -d" " -f2)
- REAL_ACCOUNT=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^realAccount:" | head -n 1 | cut -d" " -f2)
- PCASE=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^uid:" | head -n 1 | cut -d" " -f2)
- [ -n "$PCASE" ] && PAM_USER=$PCASE
-fi
+# check if the script runs as root
+[ "x$(whoami)" != "xroot" ] && exit 0
-PASSWD=$(/usr/bin/getent passwd "$PAM_USER")
+PASSWD=$(getent passwd "$PAM_USER")
+USER_NAME=$(echo "$PASSWD" | awk -F ':' '{print $1}')
USER_UID=$(echo "$PASSWD" | awk -F ':' '{print $3}')
USER_GID=$(echo "$PASSWD" | awk -F ':' '{print $4}')
USER_HOME=$(echo "$PASSWD" | awk -F ':' '{print $6}')
-[ -z "$USER_UID" ] && USER_UID=$(/usr/bin/id -u "$PAM_USER")
-[ -z "$USER_GID" ] && USER_GID=$(/usr/bin/id -g "$PAM_USER")
+[ -n "$USER_NAME" ] && PAM_USER="$USER_NAME"
+[ -z "$USER_UID" ] && USER_UID=$(id -u "$PAM_USER")
+[ -z "$USER_GID" ] && USER_GID=$(id -g "$PAM_USER")
[ -z "$USER_HOME" ] && USER_HOME="/home/$PAM_USER"
if [ -z "$USER_UID" -o -z "$USER_GID" ]; then
slxlog "pam-get-ids" "Could not determine UID or GID for user '$PAM_USER'."
@@ -27,9 +23,6 @@ fi
# The user's non-persistent home directory mount point, which should be their linux home
TEMP_HOME_DIR="$USER_HOME"
-# check if the script runs as root
-[ "x$(/usr/bin/whoami)" != "xroot" ] && exit 0
-
# check if PAM_USER is root and skip if it is the case
[ "x${PAM_USER}" == "xroot" ] && exit 0
diff --git a/remote/modules/sshd/data/etc/systemd/system/network.target.wants/sshd.service b/remote/modules/sshd/data/etc/systemd/system/network.target.wants/sshd.service
deleted file mode 120000
index d41264ec..00000000
--- a/remote/modules/sshd/data/etc/systemd/system/network.target.wants/sshd.service
+++ /dev/null
@@ -1 +0,0 @@
-../sshd.service \ No newline at end of file