mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2025-08-14 04:49:18 +02:00
34 lines
784 B
Bash
Executable file
34 lines
784 B
Bash
Executable file
#!/bin/sh
|
|
|
|
USER=rdpgw
|
|
|
|
file="/root/createusers.txt"
|
|
if [ -f $file ]
|
|
then
|
|
while IFS=: read -r username password is_sudo
|
|
do
|
|
echo "Username: $username, Password: **** , Sudo: $is_sudo"
|
|
|
|
if getent passwd "$username" > /dev/null 2>&1
|
|
then
|
|
echo "User Exists"
|
|
else
|
|
adduser -s /sbin/nologin "$username"
|
|
echo "$username:$password" | chpasswd
|
|
fi
|
|
done <"$file"
|
|
fi
|
|
|
|
cd /opt/rdpgw || exit 1
|
|
|
|
if [ -n "${RDPGW_SERVER__AUTHENTICATION}" ]; then
|
|
if [ "${RDPGW_SERVER__AUTHENTICATION}" = "local" ]; then
|
|
echo "Starting rdpgw-auth"
|
|
/opt/rdpgw/rdpgw-auth &
|
|
fi
|
|
fi
|
|
|
|
# drop privileges and run the application
|
|
su -c /opt/rdpgw/rdpgw "${USER}" -- "$@" &
|
|
wait
|
|
exit $?
|