diff options
author | Simon Rettberg | 2017-03-29 10:50:38 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-03-29 10:50:38 +0200 |
commit | 5188b15c3c53e0675d1c275c46b31fd265015c55 (patch) | |
tree | d6712cecd8fe1e0b96e1e4130f19f9f1f3eb1845 /scripts | |
parent | [LighttpdHttps] Update script to generate 2048 bit dh params (diff) | |
download | tmlite-bwlp-5188b15c3c53e0675d1c275c46b31fd265015c55.tar.gz tmlite-bwlp-5188b15c3c53e0675d1c275c46b31fd265015c55.tar.xz tmlite-bwlp-5188b15c3c53e0675d1c275c46b31fd265015c55.zip |
[LighttpdHttps] Support setting HTTPS redirection
This implements #3058
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install-https | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/scripts/install-https b/scripts/install-https index ad77a97..121fb0e 100755 --- a/scripts/install-https +++ b/scripts/install-https @@ -1,7 +1,8 @@ #!/bin/bash -CERTFILE="/etc/lighttpd/server.pem" -CHAINFILE="/etc/lighttpd/chain.pem" +declare -rg CERTFILE="/etc/lighttpd/server.pem" +declare -rg CHAINFILE="/etc/lighttpd/chain.pem" +declare -rg REDIR_FLAG="/etc/lighttpd/redirect.flag" op_disable () { @@ -76,20 +77,53 @@ generate_dh () fi } -OP=$1 -shift +setup_redirect () +{ + if [ -n "$REDIR" ]; then + touch "$REDIR_FLAG" + else + rm -f -- "$REDIR_FLAG" + fi +} -case "$OP" in - --random) op_random "$@" ;; - --test) op_test "$@" ;; - --import) op_import "$@" ;; - --disable) op_disable ;; +RE_ONLY= +REDIR= +while true; do + case "$1" in + --redirect-only) + RE_ONLY=tru + ;; + --redirect) + REDIR=truh + ;; *) - echo "Invalid operation: $1" - exit 1 + break ;; -esac + esac + shift +done + +setup_redirect + +if [ -z "$RE_ONLY" ]; then + + OP=$1 + shift + + case "$OP" in + --random) op_random "$@" ;; + --test) op_test "$@" ;; + --import) op_import "$@" ;; + --disable) op_disable ;; + *) + echo "Invalid operation: $1" + exit 1 + ;; + esac + +fi +sleep .5 systemctl restart lighttpd exit 0 |