Merge pull request #6662 from dokku/openresty-domain-limit
Allow limiting letsencrypt to certain domains when using openresty as a proxy
This commit is contained in:
@@ -1 +1 @@
|
||||
FROM dokku/openresty-docker-proxy:0.6.0
|
||||
FROM dokku/openresty-docker-proxy:0.7.0
|
||||
|
||||
@@ -37,6 +37,7 @@ cmd-openresty-report-single() {
|
||||
local flag_map=(
|
||||
"--openresty-access-log-format: $(fn-openresty-access-log-format "$APP")"
|
||||
"--openresty-access-log-path: $(fn-openresty-access-log-path "$APP")"
|
||||
"--openresty-allowed-letsencrypt-domains-func-base64: $(fn-openresty-allowed-letsencrypt-domains-func-base64)"
|
||||
"--openresty-bind-address-ipv4: $(fn-openresty-bind-address-ipv4 "$APP")"
|
||||
"--openresty-bind-address-ipv6: $(fn-openresty-bind-address-ipv6 "$APP")"
|
||||
"--openresty-client-max-body-size: $(fn-openresty-client-max-body-size "$APP")"
|
||||
|
||||
@@ -26,6 +26,12 @@ fn-openresty-access-log-path() {
|
||||
fn-plugin-property-get-default "openresty" "$APP" "access-log-path" "${OPENRESTY_LOG_ROOT}/${APP}-access.log"
|
||||
}
|
||||
|
||||
fn-fn-openresty-allowed-letsencrypt-domains-func-base64() {
|
||||
declare desc="get the configured allowed domains func base64"
|
||||
|
||||
fn-plugin-property-get-default "openresty" "--global" "allowed-letsencrypt-domains-func-base64" "return true" | base64 -w 0
|
||||
}
|
||||
|
||||
fn-openresty-bind-address-ipv4() {
|
||||
declare desc="get the configured ipv4 bind address"
|
||||
declare APP="$1"
|
||||
@@ -221,6 +227,11 @@ fn-openresty-template-compose-file() {
|
||||
OPENRESTY_LETSENCRYPT_EMAIL="$(fn-openresty-letsencrypt-email)"
|
||||
OPENRESTY_LETSENCRYPT_SERVER="$(fn-openresty-letsencrypt-server)")
|
||||
|
||||
local ALLOWED_DOMAINS_FUNC_BASE64="$(fn-fn-openresty-allowed-letsencrypt-domains-func-base64)"
|
||||
if [[ -n "$ALLOWED_DOMAINS_FUNC_BASE64" ]]; then
|
||||
SIGIL_PARAMS+=(ALLOWED_DOMAINS_FUNC_BASE64="$ALLOWED_DOMAINS_FUNC_BASE64")
|
||||
fi
|
||||
|
||||
sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH"
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ cmd-openresty-set() {
|
||||
declare cmd="openresty:set"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1" KEY="$2" VALUE="$3"
|
||||
local VALID_KEYS=("access-log-format" "access-log-path" "bind-address-ipv4" "bind-address-ipv6" "client-max-body-size" "error-log-path" "hsts" "hsts-include-subdomains" "hsts-preload" "hsts-max-age" "image" "log-level" "letsencrypt-email" "letsencrypt-server" "proxy-read-timeout" "proxy-buffer-size" "proxy-buffering" "proxy-buffers" "proxy-busy-buffers-size" "underscore-in-headers" "x-forwarded-for-value" "x-forwarded-port-value" "x-forwarded-proto-value" "x-forwarded-ssl")
|
||||
local GLOBAL_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server")
|
||||
local VALID_KEYS=("access-log-format" "access-log-path" "allowed-letsencrypt-domains-func-base64" "bind-address-ipv4" "bind-address-ipv6" "client-max-body-size" "error-log-path" "hsts" "hsts-include-subdomains" "hsts-preload" "hsts-max-age" "image" "log-level" "letsencrypt-email" "letsencrypt-server" "proxy-read-timeout" "proxy-buffer-size" "proxy-buffering" "proxy-buffers" "proxy-busy-buffers-size" "underscore-in-headers" "x-forwarded-for-value" "x-forwarded-port-value" "x-forwarded-proto-value" "x-forwarded-ssl")
|
||||
local GLOBAL_KEYS=("allowed-letsencrypt-domains-func-base64" "image" "log-level" "letsencrypt-email" "letsencrypt-server")
|
||||
|
||||
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
|
||||
|
||||
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
|
||||
dokku_log_fail "Invalid key specified, valid keys include: access-log-format, access-log-path, bind-address-ipv4, bind-address-ipv6, client-max-body-size, error-log-path, hsts, hsts-include-subdomains, hsts-preload, hsts-max-age, image, log-level, letsencrypt-email, letsencrypt-server, proxy-read-timeout, proxy-buffer-size, proxy-buffering, proxy-buffers, proxy-busy-buffers-size, underscore-in-headers, x-forwarded-for-value, x-forwarded-port-value, x-forwarded-proto-value, x-forwarded-ssl"
|
||||
dokku_log_fail "Invalid key specified, valid keys include: access-log-format, access-log-path, allowed-letsencrypt-domains-func-base64, bind-address-ipv4, bind-address-ipv6, client-max-body-size, error-log-path, hsts, hsts-include-subdomains, hsts-preload, hsts-max-age, image, log-level, letsencrypt-email, letsencrypt-server, proxy-read-timeout, proxy-buffer-size, proxy-buffering, proxy-buffers, proxy-busy-buffers-size, underscore-in-headers, x-forwarded-for-value, x-forwarded-port-value, x-forwarded-proto-value, x-forwarded-ssl"
|
||||
fi
|
||||
|
||||
if ! fn-in-array "$KEY" "${GLOBAL_KEYS[@]}"; then
|
||||
|
||||
Reference in New Issue
Block a user