Bugfix: extra checks and removing forced SSL
This commit is contained in:
parent
5a97f16651
commit
c7cf101f26
|
|
@ -132,6 +132,14 @@ if [ -z "${HOST}" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if (cert | key) & self-sign are set, as they are incompatible
|
||||||
|
if [ -n "$CERT" ] || [ -n "$KEY" ] && [ -n "$SELF_SIGN" ]; then
|
||||||
|
echo "Arguments --cert and --key and incompatible with --self-sign"
|
||||||
|
echo ""
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
trap "cleanup" TERM QUIT INT EXIT
|
trap "cleanup" TERM QUIT INT EXIT
|
||||||
|
|
||||||
# Find vnc.html
|
# Find vnc.html
|
||||||
|
|
@ -153,14 +161,25 @@ fi
|
||||||
|
|
||||||
# Create self-signed certificates
|
# Create self-signed certificates
|
||||||
if [ -n "${SELF_SIGN}" ]; then
|
if [ -n "${SELF_SIGN}" ]; then
|
||||||
if [ ! -f $(pwd)/self.pem ]; then
|
# Check if OpenSSL is installed
|
||||||
echo "Generating Certificate for: ${SELF_SIGN}"
|
which openssl > /dev/null
|
||||||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out self.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=NoVNC/L=NoVNC/O=NoVNC/OU=NoVNC/CN=${SELF_SIGN}"
|
if [ $? != 0 ]; then
|
||||||
fi
|
echo "Unable to find OpenSSL, please ensure you have OpenSSL installed and available in \$PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Check that the file doesn't already exist
|
||||||
|
if [ -f $(pwd)/self.pem ]; then
|
||||||
|
read -p "$(pwd)/self.pem aleady exists, overwrite? (Y/N) " overwrite
|
||||||
|
if [ "$overwrite" != "Y" ]; then
|
||||||
|
echo "Not overwriting $(pwd)/self.pem"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "Generating Certificate for: ${SELF_SIGN}"
|
||||||
|
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out self.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=NoVNC/L=NoVNC/O=NoVNC/OU=NoVNC/CN=${SELF_SIGN}"
|
||||||
|
|
||||||
CERT=$(pwd)/self.pem
|
CERT=$(pwd)/self.pem
|
||||||
KEY=$(pwd)/key.pem
|
KEY=$(pwd)/key.pem
|
||||||
echo "Forcing SSL"
|
|
||||||
SSLONLY="--ssl-only"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Find self.pem
|
# Find self.pem
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue