#!/bin/bash declare -rg PUBLIC_BOTH="/etc/lighttpd/server.pem" declare -rg CHAIN="/etc/lighttpd/chain.pem" declare -rg DHPARAM="/etc/lighttpd/dhparam.pem" declare -rg REDIR_FLAG="/etc/lighttpd/redirect.flag" declare -rg INTERNAL_BOTH="/etc/ssl/openslx/lighttpd/server.pem" declare -g INTERNAL_CHAIN="/etc/ssl/openslx/lighttpd/ca-chain.pem" if ! [ -s "$DHPARAM" ] && ! ps aux | grep 'openssl dhparam' | grep -q -v grep; then openssl dhparam -out "$DHPARAM" 2048 &>/dev/null & fi /opt/openslx/slx-cert >&2 & wait [ -s "$INTERNAL_CHAIN" ] || INTERNAL_CHAIN= readonly INTERNAL_CHAIN if [ -f "/usr/lib/lighttpd/mod_openssl.so" ]; then echo 'server.modules += ( "mod_openssl" )' fi cat < %0 in redirect pattern # must be the most inner block to the redirect rule $HTTP["host"] =~ ".*" { url.redirect = ( "^/slx-admin/($|\?|index.php).*" => "https://%0$0" ) url.redirect-code = 302 } } HEREDOC exit 0