2021-03-03 11:27:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-03-14 09:01:04 +01:00
|
|
|
if [[ "$1" = "--help" ]]; then
|
|
|
|
cat >&2 <<-USAGE
|
|
|
|
Usage: `basename $0` [options]
|
|
|
|
-d Debug output
|
|
|
|
-kill Kill vncserver
|
|
|
|
--help show this help
|
|
|
|
USAGE
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$1" = "-d" ]]; then
|
|
|
|
log_option="-log *:stderr:100"
|
|
|
|
fi
|
|
|
|
|
|
|
|
action=start
|
|
|
|
if [[ "$1" = "-kill" ]]; then
|
|
|
|
action=kill
|
|
|
|
fi
|
|
|
|
|
|
|
|
display=:10
|
2021-03-03 11:27:02 +01:00
|
|
|
interface=0.0.0.0
|
|
|
|
cert_group=ssl-cert
|
|
|
|
|
|
|
|
if groups | grep -qvw ssl-cert; then
|
|
|
|
cat <<-EOF
|
|
|
|
Can't access TLS certificate.
|
|
|
|
Please add your user to $cert_group via 'addgroup <user> ssl-cert'
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-03-14 09:01:04 +01:00
|
|
|
if [[ "$action" = "kill" ]]; then
|
|
|
|
vncserver -kill $display
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-03-03 11:27:02 +01:00
|
|
|
vncserver $display -interface $interface
|
|
|
|
vncserver -kill $display
|
|
|
|
vncserver $display -depth 24 -geometry 1280x1050 -websocketPort 8443 \
|
|
|
|
-cert /etc/ssl/certs/ssl-cert-snakeoil.pem \
|
|
|
|
-key /etc/ssl/private/ssl-cert-snakeoil.key -sslOnly -FrameRate=24 \
|
2021-03-14 09:01:04 +01:00
|
|
|
-interface $interface -httpd /usr/share/kasmvnc/www $log_option
|