summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2014-10-06 17:54:24 +0200
committerJonathan Bauer2014-10-06 17:54:24 +0200
commit783ad8e311d5be0b741f240fe225a2873369a650 (patch)
tree394402ef1806f24459fe719585f138db7d95aeac
parent[vmchooser] fix eventual spaces in SOUND_CARD_INDEX (diff)
downloadtm-scripts-783ad8e311d5be0b741f240fe225a2873369a650.tar.gz
tm-scripts-783ad8e311d5be0b741f240fe225a2873369a650.tar.xz
tm-scripts-783ad8e311d5be0b741f240fe225a2873369a650.zip
[pam] support for common share mounting script in pam_script_auth
the actual common share mount script should be in /opt/openslx/scripts/pam_script_mount_common_share and should come from a server/module as it is at the very least institution-specific!
-rwxr-xr-xremote/modules/pam/data/opt/openslx/scripts/pam_script_auth48
1 files changed, 41 insertions, 7 deletions
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 48efcf6f..e7de3a8c 100755
--- a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth
+++ b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth
@@ -8,14 +8,8 @@ USER_UID=$(echo "$PASSWD" | awk -F ':' '{print $3}')
USER_GID=$(echo "$PASSWD" | awk -F ':' '{print $4}')
USER_HOME=$(echo "$PASSWD" | awk -F ':' '{print $6}')
-# Script to be sourced to mount the user's persistent home
-PERSISTENT_MOUNT_SCRIPT="/opt/openslx/scripts/pam_script_mount_persistent"
-# Script to be run in the user's context iff the persistent home could be mounted successfully
-PERSISTENT_MOUNT_USER_SCRIPT="/opt/openslx/scripts/pam_script_mount_persistent_user"
# The user's non-persistent home directory mount point, which should be their linux home
TEMP_HOME_DIR="$USER_HOME"
-# The user's persistent home directory mount point
-PERSISTENT_HOME_DIR="${TEMP_HOME_DIR}/PERSISTENT"
# check if the script runs as root
[ "x$(whoami)" != "xroot" ] && exit 0
@@ -44,6 +38,18 @@ Your real home is under /home/<user>/PERSISTENT.
Please save your files there.
EOF
+###############################################################################
+#
+# Preparations for /home/<user>/PERSISTENT
+#
+#
+# Script to be sourced to mount the user's persistent home
+PERSISTENT_MOUNT_SCRIPT="/opt/openslx/scripts/pam_script_mount_persistent"
+# Script to be run in the user's context iff the persistent home could be mounted successfully
+PERSISTENT_MOUNT_USER_SCRIPT="/opt/openslx/scripts/pam_script_mount_persistent_user"
+# The user's persistent home directory mount point
+PERSISTENT_HOME_DIR="${TEMP_HOME_DIR}/PERSISTENT"
+
# create the PERSISTENT directory
mkdir -p "${PERSISTENT_HOME_DIR}" || \
{ slxlog "pam-global-mkpersistent" "Could not create '${PERSISTENT_HOME_DIR}'."; exit 1; }
@@ -57,12 +63,40 @@ fi
[ ! -e "${PERSISTENT_MOUNT_SCRIPT}" ] && exit 0
# yes
. "${PERSISTENT_MOUNT_SCRIPT}" || \
- { slxlog "pam-global-sourcepersistent" "Could not source ${PERSISTENT_MOUNT_SCRIPT}."; exit 1; }
+ { slxlog "pam-global-sourcepersistent" "Could not source '${PERSISTENT_MOUNT_SCRIPT}'."; exit 1; }
# Just try to delete the persistent dir. If the mount was successful, it will not work
# If it was not successful, it will be removed so the user doesn't think he can store
# anything in there
rmdir "$PERSISTENT_HOME_DIR" 2> /dev/null
+###############################################################################
+#
+# Preparations for /home/<user>/SHARE
+#
+#
+# Script to be sourced to mount the common share folder
+COMMON_SHARE_MOUNT_SCRIPT="/opt/openslx/scripts/pam_script_mount_common_share"
+# User specific mount point for the common share
+COMMON_SHARE_MOUNT_POINT="${TEMP_HOME_DIR}/SHARE"
+
+# create the SHARE directory
+mkdir -p "${COMMON_SHARE_MOUNT_POINT}" || \
+ { slxlog "pam-global-mkshare" "Could not create '${COMMON_SHARE_MOUNT_POINT}'."; exit 1; }
+
+# chown the new dir
+chown "${PAM_USER}:${USER_GID}" "${COMMON_SHARE_MOUNT_POINT}" || \
+ { slxlog "pam-global-chshare" "Could not chown '${COMMON_SHARE_MOUNT_POINT}' to '${PAM_USER}'."; exit 1; }
+
+# check for common share mount script, exit if we don't have one
+[ ! -e "${COMMON_SHARE_MOUNT_SCRIPT}" ] && exit 0
+
+# we do!
+. "${COMMON_SHARE_MOUNT_SCRIPT}" || \
+ { slxlog "pam-global-sourceshare" "Could not source '${COMMON_SHARE_MOUNT_SCRIPT}'."; exit 1; }
+
+# Just try to delete the common share dir. If the mount was successful, it will not work
+rmdir "${COMMON_SHARE_MOUNT_POINT}" 2> /dev/null
+
exit 0