summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2019-06-13 13:51:56 +0200
committerPierre Ossman <ossman@cendio.se>2019-06-13 13:51:56 +0200
commit97924ebd5d1d39c9752fa9642f15684a89a62e0b (patch)
tree20e16951a23e1c8be07b2221a7ca0f3ebe17a5b8 /utils
parent32e081950cf2e2cf1218f17acd16df6a33bce370 (diff)
downloadnovnc-97924ebd5d1d39c9752fa9642f15684a89a62e0b.tar.gz
Add support for separate key file in launch script
Diffstat (limited to 'utils')
-rwxr-xr-xutils/launch.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/utils/launch.sh b/utils/launch.sh
index 162607e..0978b33 100755
--- a/utils/launch.sh
+++ b/utils/launch.sh
@@ -17,8 +17,10 @@ usage() {
echo " Default: 6080"
echo " --vnc VNC_HOST:PORT VNC server host:port proxy target"
echo " Default: localhost:5900"
- echo " --cert CERT Path to combined cert/key file"
+ echo " --cert CERT Path to combined cert/key file, or just"
+ echo " the cert file if used with --key"
echo " Default: self.pem"
+ echo " --key KEY Path to key file, when not combined with cert"
echo " --web WEB Path to web files (e.g. vnc.html)"
echo " Default: ./"
echo " --ssl-only Disable non-https connections."
@@ -34,6 +36,7 @@ HERE="$(cd "$(dirname "$REAL_NAME")" && pwd)"
PORT="6080"
VNC_DEST="localhost:5900"
CERT=""
+KEY=""
WEB=""
proxy_pid=""
SSLONLY=""
@@ -63,6 +66,7 @@ while [ "$*" ]; do
--listen) PORT="${OPTARG}"; shift ;;
--vnc) VNC_DEST="${OPTARG}"; shift ;;
--cert) CERT="${OPTARG}"; shift ;;
+ --key) KEY="${OPTARG}"; shift ;;
--web) WEB="${OPTARG}"; shift ;;
--ssl-only) SSLONLY="--ssl-only" ;;
--record) RECORD_ARG="--record ${OPTARG}"; shift ;;
@@ -116,6 +120,13 @@ else
echo "Warning: could not find self.pem"
fi
+# Check key file
+if [ -n "${KEY}" ]; then
+ if [ ! -e "${KEY}" ]; then
+ die "Could not find ${KEY}"
+ fi
+fi
+
# try to find websockify (prefer local, try global, then download local)
if [[ -e ${HERE}/websockify ]]; then
WEBSOCKIFY=${HERE}/websockify/run
@@ -148,7 +159,7 @@ fi
echo "Starting webserver and WebSockets proxy on port ${PORT}"
#${HERE}/websockify --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST} &
-${WEBSOCKIFY} ${SSLONLY} --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST} ${RECORD_ARG} &
+${WEBSOCKIFY} ${SSLONLY} --web ${WEB} ${CERT:+--cert ${CERT}} ${KEY:+--key ${KEY}} ${PORT} ${VNC_DEST} ${RECORD_ARG} &
proxy_pid="$!"
sleep 1
if ! ps -p ${proxy_pid} >/dev/null; then