cours-snt/test-python-ssh/entrypoint.sh
2021-02-05 17:11:47 +01:00

30 lines
509 B
Bash
Executable File

#!/bin/sh
# Check we got users
if [ ! -f 'users.txt' ] ; then
echo "Missing file users.txt"
exit -1
fi
# Generate passwords if not done yet
function genPassowrd () {
tr -dc A-Za-z0-9 </dev/urandom | head -c $1
}
if [ ! -f 'passwords.txt' ] ; then
for user in $(cat users.txt) ; do
echo $user $(genPassowrd 10) >> passwords.txt
done
fi
# Nginx
nginx -c '/etc/nginx/nginx.conf' &
# SSH server
#TODO
# Start watever the container should be doing
# TODO start it as www-data
$@