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

Almost acceptable user management

parent 68602589
No related branches found
No related tags found
No related merge requests found
.env
homedir
.*.sw?
dockerstartup/
......@@ -16,6 +16,7 @@ services:
- SPYDER=${SPYDER}
- ANACONDA=${ANACONDA}
- KASM_USER=${VNC_USER}
- VNCOPTIONS=-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7 -DLP_ClipDelay=0 -select-de manual -UnixRelay printer:/tmp/printer -allowoverride AcceptPointerEvents,BlacklistTimeout,BlacklistThreshold -blacklistthreshold 1000 -blacklisttimeout 1"
volumes:
......
#!/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)
password=$(zenity --title="$title" --text="Veuillez entrer votre mot de passe" --entry)
confirm=$(zenity --title="$title" --text="Veuillez confirmer votre mot de passe" --entry)
icon="error"
if [ "$password" != "$confirm" ]; then
message=$(echo -e "$password\n$password" | vncpasswd -u $KASM_USER $HOME/.vnc/passwd)
ok=0
if [ "$password" == "$confirm" ]; then
ok=1
message=$(echo -e "$password\n$password\n" | kasmvncpasswd -u $KASM_USER -wo 2>&1)
if [ $? -eq 0 ]; then
message="Mot de passe changé"
cp $HOME/.kasmpasswd $HOME/.kasmpasswd.persist
# Restart the VNC server
kill $(cat .vnc/*.pid)
icon="info"
message="Le mot de passe a été changé"
fi
else
message="La confirmation du mot de passe n'est pas identique au mot de passe"
......
......@@ -36,3 +36,11 @@ Exec=$(which spyder)
eof
fi
chmod +x $VNC_HOME/Desktop/*.desktop
if [ -f "$HOME/.kasmpasswd.persist" ]; then
cp $HOME/.kasmpasswd.persist $HOME/.kasmpasswd
chown 600 $HOME/.kasmpasswd
fi
# We should not exit
sleep infinity
kasm 0 → 100755
#!/bin/bash
is_docker() {
if [ ! -z "$(which docker 2>/dev/null | grep -v 'not found')" ];
then
echo "1"
else
echo "0"
fi
}
usage() {
echo -e "Usage $0 <command> [args]\n"
echo -e "COMMANDS\n"
echo "bash"
echo -e "\topens a shell in kasm"
echo "config"
echo -e "\tquery vncconfig [-list|-get|-set|desc] args"
echo "down"
echo -e "\tStops the services"
echo "reset_passwd"
echo -e "\tReinitialize the passowrd"
echo "restart"
echo -e "\trestarts the services"
echo "up"
echo -e "\tStarts the services"
}
if [ "$(is_docker)" -eq 1 ]; then
if [ ! -z "$(which docker-compose 2>/dev/null)" ]; then
compose="docker-compose"
else
compose="docker compose"
fi
cmd="$compose exec kasm"
fi
action=$1
shift
# Keep actions sorted
case $action in
"bash")
$cmd bash
;;
"config")
if [ -z "$1" ]; then
args="-list"
else
args="$@"
fi
$cmd vncconfig $args
;;
"down")
$compose down $@
;;
"reset_passwd")
$cmd rm .kasmpasswd.persist
$compose down
$compose up -d
;;
"restart")
$compose restart
;;
"up")
$compose up $@
;;
*)
echo "ERROR: No command given"
usage
exit 1
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment