Skip to content
Snippets Groups Projects
Verified Commit 68602589 authored by David Beniamine's avatar David Beniamine
Browse files

WIP user management for #3

parent b3b44e3f
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ COMPOSE_FILE=docker-compose.yml:ports.yml
PASS=MON_SUPER_MOT_DE_PASSE
NAME=kasmVNC
VNC_USER=kasm
HOST=kasmVNC.tetras-lab.io
PORT=6901
......
......@@ -6,19 +6,17 @@ services:
args:
- SPYDER=${SPYDER}
- ANACONDA=${ANACONDA}
- KASM_USER=${USER}
- KASM_USER=${VNC_USER}
image: "kasmvnc-ubuntu-noble:spyder-${SPYDER}_anaconda-${ANACONDA}"
container_name: KasmVNC-ubuntu
volumes:
- homedir:/home/:rw
- etc_shadow:/opt/shadow
environment:
- VNC_PW=${PASS}
- SPYDER=${SPYDER}
- ANACONDA=${ANACONDA}
- KASM_USER=${USER}
- KASM_USER=${VNC_USER}
volumes:
homedir:
etc_shadow:
......@@ -19,7 +19,6 @@ RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get install -y \
firefox \
gnome-system-tools \
inotify-tools \
language-pack-fr \
language-pack-fr-base \
......@@ -28,7 +27,8 @@ RUN apt-get update && \
locale-gen --purge fr_FR.UTF-8 en_US.UTF-8
RUN mkdir /install
RUN for f in /dockerstartup/*.sh; do sed -i -e "s/kasm_user/$KASM_USER/g" $f; done
RUN usermod -l $KASM_USER kasm-user; \
for f in /dockerstartup/*.sh; do sed -i -e "s/kasm_user/$KASM_USER/g" $f; done
WORKDIR /install
# === Install Spyder === #
......@@ -47,7 +47,7 @@ RUN if [ "$ANACONDA" = true ] ; then \
RUN rm -rf $HOME/.cache
COPY custom_startup.sh $STARTUPDIR/custom_startup.sh
COPY shadow_monitor.sh /
COPY change_password.sh /
######### End Customizations ###########
......
#!/bin/bash
title="Changement du mot de passe"
password=$(zenity --title="$title" --question="Veuillez entrer votre mot de passe" --entry)
confirm=$(zenity --title="$title" --question="Veuillez entrer votre mot de passe" --entry)
icon="error"
if [ "$password" != "$confirm" ]; then
message=$(echo -e "$password\n$password" | vncpasswd -u $KASM_USER $HOME/.vnc/passwd)
if [ $? -eq 0 ]; then
message="Mot de passe changé"
icon="info"
fi
else
message="La confirmation du mot de passe n'est pas identique au mot de passe"
fi
notify-send -i $icon "$message"
......@@ -7,10 +7,10 @@ sed -i -e "s@kasm-default-profile@$KASM_USER@g" ~/anaconda3/etc/profile.d/conda.
mkdir -p $VNC_HOME/Desktop
cat <<EOF > $VNC_HOME/Desktop/users.desktop
[Desktop Entry]
Type=Link
Type=Application
Name=Change password
Icon=config-users
URL=/usr/share/applications/users.desktop
Exec=/change_password.sh
terminal=true
EOF
......@@ -35,12 +35,4 @@ Icon=$VNC_HOME/anaconda3/share/icons/spyder.png
Exec=$(which spyder)
eof
fi
if [ -f "/opt/shadow/shadow" ]
then
echo "Copying shadow file"
cp /opt/shadow/shadow /etc/shadow
sync
fi
/shadow_monitor.sh
chmod +x $VNC_HOME/Desktop/*.desktop
#!/bin/bash
sleep 10
while true; do
modif=$(inotifywait --event move /etc)
echo "Modif : '$modif'"
if [ ! -z "$(echo $modif | grep 'MOVED_FROM nshadow')" ]; then
echo "Shadow file has changed"
sync
cp /etc/shadow /opt/shadow/shadow
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment