arrstack: set *arr AuthenticationMethod=External (proxy-trusted)
ci/woodpecker/pr/vector-test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/kubeconform Pipeline was successful

The *arr UIs behind arrproxy prompt "Authentication Required" because
Sonarr v4 refuses remote access when AuthenticationMethod=None. Since
arrproxy + oauth2-proxy already authenticate every user at the front
door, the *arr apps should defer UI auth to the proxy instead of
double-prompting.

Extend the existing apikey-init container for sonarr/radarr/prowlarr to
also idempotently enforce <AuthenticationMethod>External</AuthenticationMethod>
and <AuthenticationRequired>Enabled</AuthenticationRequired> in
/config/config.xml (create or replace, without disturbing ApiKey/UrlBase).

In Servarr v4 External registers the same NoAuthenticationHandler as None
(no username header required) but is exempt from the None remote-access
block, so it stops the UI login prompt without needing arrproxy to forward
any identity header (arrproxy's trustBoundary strips those by design).
This commit is contained in:
unkin-agent
2026-08-17 22:36:49 +10:00
parent c22fbe435a
commit 66eb81b5e0
3 changed files with 54 additions and 9 deletions
+18 -3
View File
@@ -26,7 +26,10 @@ spec:
# (override bootstrap): the key is minted in Vault, synced by VSO into the
# prowlarr-apikey Secret, and written here. UrlBase=/prowlarr lets arrproxy
# forward arrstack.unkin.net/prowlarr/... with the prefix preserved (no 307).
# Runs as root to fix ownership; touches only <ApiKey> and <UrlBase>.
# Runs as root to fix ownership; touches only <ApiKey>, <UrlBase>, and
# <AuthenticationMethod>=External + <AuthenticationRequired>. External makes
# the *arr defer UI login to arrproxy/oauth2-proxy (same no-auth request
# handler as None, but permits remote access without prompting).
- name: apikey-init
image: artifactapi.k8s.syd1.au.unkin.net/dockerhub/library/busybox:1.37.0
imagePullPolicy: IfNotPresent
@@ -50,9 +53,11 @@ spec:
;;
esac
URL_BASE=/prowlarr
AUTH_METHOD=External
AUTH_REQUIRED=Enabled
CFG=/config/config.xml
if [ ! -f "$CFG" ]; then
printf '<Config>\n <ApiKey>%s</ApiKey>\n <UrlBase>%s</UrlBase>\n</Config>\n' "$API_KEY" "$URL_BASE" > "$CFG"
printf '<Config>\n <ApiKey>%s</ApiKey>\n <UrlBase>%s</UrlBase>\n <AuthenticationMethod>%s</AuthenticationMethod>\n <AuthenticationRequired>%s</AuthenticationRequired>\n</Config>\n' "$API_KEY" "$URL_BASE" "$AUTH_METHOD" "$AUTH_REQUIRED" > "$CFG"
else
if grep -q '<ApiKey>' "$CFG"; then
sed -i "s|<ApiKey>[^<]*</ApiKey>|<ApiKey>${API_KEY}</ApiKey>|" "$CFG"
@@ -64,10 +69,20 @@ spec:
else
sed -i "s|<Config>|<Config>\n <UrlBase>${URL_BASE}</UrlBase>|" "$CFG"
fi
if grep -q '<AuthenticationMethod>' "$CFG"; then
sed -i "s|<AuthenticationMethod>[^<]*</AuthenticationMethod>|<AuthenticationMethod>${AUTH_METHOD}</AuthenticationMethod>|" "$CFG"
else
sed -i "s|<Config>|<Config>\n <AuthenticationMethod>${AUTH_METHOD}</AuthenticationMethod>|" "$CFG"
fi
if grep -q '<AuthenticationRequired>' "$CFG"; then
sed -i "s|<AuthenticationRequired>[^<]*</AuthenticationRequired>|<AuthenticationRequired>${AUTH_REQUIRED}</AuthenticationRequired>|" "$CFG"
else
sed -i "s|<Config>|<Config>\n <AuthenticationRequired>${AUTH_REQUIRED}</AuthenticationRequired>|" "$CFG"
fi
fi
chown 1000:1000 "$CFG"
chmod 600 "$CFG"
echo "config-init: <ApiKey> and <UrlBase>=${URL_BASE} enforced from Vault"
echo "config-init: <ApiKey>, <UrlBase>=${URL_BASE}, <AuthenticationMethod>=${AUTH_METHOD}, <AuthenticationRequired>=${AUTH_REQUIRED} enforced from Vault"
resources:
requests:
cpu: 50m
+18 -3
View File
@@ -26,7 +26,10 @@ spec:
# (override bootstrap): the key is minted in Vault, synced by VSO into the
# radarr-apikey Secret, and written here. UrlBase=/radarr lets arrproxy
# forward arrstack.unkin.net/radarr/... with the prefix preserved (no 307).
# Runs as root to fix ownership; touches only <ApiKey> and <UrlBase>.
# Runs as root to fix ownership; touches only <ApiKey>, <UrlBase>, and
# <AuthenticationMethod>=External + <AuthenticationRequired>. External makes
# the *arr defer UI login to arrproxy/oauth2-proxy (same no-auth request
# handler as None, but permits remote access without prompting).
- name: apikey-init
image: artifactapi.k8s.syd1.au.unkin.net/dockerhub/library/busybox:1.37.0
imagePullPolicy: IfNotPresent
@@ -50,9 +53,11 @@ spec:
;;
esac
URL_BASE=/radarr
AUTH_METHOD=External
AUTH_REQUIRED=Enabled
CFG=/config/config.xml
if [ ! -f "$CFG" ]; then
printf '<Config>\n <ApiKey>%s</ApiKey>\n <UrlBase>%s</UrlBase>\n</Config>\n' "$API_KEY" "$URL_BASE" > "$CFG"
printf '<Config>\n <ApiKey>%s</ApiKey>\n <UrlBase>%s</UrlBase>\n <AuthenticationMethod>%s</AuthenticationMethod>\n <AuthenticationRequired>%s</AuthenticationRequired>\n</Config>\n' "$API_KEY" "$URL_BASE" "$AUTH_METHOD" "$AUTH_REQUIRED" > "$CFG"
else
if grep -q '<ApiKey>' "$CFG"; then
sed -i "s|<ApiKey>[^<]*</ApiKey>|<ApiKey>${API_KEY}</ApiKey>|" "$CFG"
@@ -64,10 +69,20 @@ spec:
else
sed -i "s|<Config>|<Config>\n <UrlBase>${URL_BASE}</UrlBase>|" "$CFG"
fi
if grep -q '<AuthenticationMethod>' "$CFG"; then
sed -i "s|<AuthenticationMethod>[^<]*</AuthenticationMethod>|<AuthenticationMethod>${AUTH_METHOD}</AuthenticationMethod>|" "$CFG"
else
sed -i "s|<Config>|<Config>\n <AuthenticationMethod>${AUTH_METHOD}</AuthenticationMethod>|" "$CFG"
fi
if grep -q '<AuthenticationRequired>' "$CFG"; then
sed -i "s|<AuthenticationRequired>[^<]*</AuthenticationRequired>|<AuthenticationRequired>${AUTH_REQUIRED}</AuthenticationRequired>|" "$CFG"
else
sed -i "s|<Config>|<Config>\n <AuthenticationRequired>${AUTH_REQUIRED}</AuthenticationRequired>|" "$CFG"
fi
fi
chown 1000:1000 "$CFG"
chmod 600 "$CFG"
echo "config-init: <ApiKey> and <UrlBase>=${URL_BASE} enforced from Vault"
echo "config-init: <ApiKey>, <UrlBase>=${URL_BASE}, <AuthenticationMethod>=${AUTH_METHOD}, <AuthenticationRequired>=${AUTH_REQUIRED} enforced from Vault"
resources:
requests:
cpu: 50m
+18 -3
View File
@@ -29,7 +29,10 @@ spec:
# (override bootstrap): the key is minted in Vault, synced by VSO into the
# sonarr-apikey Secret, and written here. UrlBase=/sonarr lets arrproxy
# forward arrstack.unkin.net/sonarr/... with the prefix preserved (no 307).
# Runs as root to fix ownership; touches only <ApiKey> and <UrlBase>.
# Runs as root to fix ownership; touches only <ApiKey>, <UrlBase>, and
# <AuthenticationMethod>=External + <AuthenticationRequired>. External makes
# the *arr defer UI login to arrproxy/oauth2-proxy (same no-auth request
# handler as None, but permits remote access without prompting).
- name: apikey-init
image: artifactapi.k8s.syd1.au.unkin.net/dockerhub/library/busybox:1.37.0
imagePullPolicy: IfNotPresent
@@ -53,9 +56,11 @@ spec:
;;
esac
URL_BASE=/sonarr
AUTH_METHOD=External
AUTH_REQUIRED=Enabled
CFG=/config/config.xml
if [ ! -f "$CFG" ]; then
printf '<Config>\n <ApiKey>%s</ApiKey>\n <UrlBase>%s</UrlBase>\n</Config>\n' "$API_KEY" "$URL_BASE" > "$CFG"
printf '<Config>\n <ApiKey>%s</ApiKey>\n <UrlBase>%s</UrlBase>\n <AuthenticationMethod>%s</AuthenticationMethod>\n <AuthenticationRequired>%s</AuthenticationRequired>\n</Config>\n' "$API_KEY" "$URL_BASE" "$AUTH_METHOD" "$AUTH_REQUIRED" > "$CFG"
else
if grep -q '<ApiKey>' "$CFG"; then
sed -i "s|<ApiKey>[^<]*</ApiKey>|<ApiKey>${API_KEY}</ApiKey>|" "$CFG"
@@ -67,10 +72,20 @@ spec:
else
sed -i "s|<Config>|<Config>\n <UrlBase>${URL_BASE}</UrlBase>|" "$CFG"
fi
if grep -q '<AuthenticationMethod>' "$CFG"; then
sed -i "s|<AuthenticationMethod>[^<]*</AuthenticationMethod>|<AuthenticationMethod>${AUTH_METHOD}</AuthenticationMethod>|" "$CFG"
else
sed -i "s|<Config>|<Config>\n <AuthenticationMethod>${AUTH_METHOD}</AuthenticationMethod>|" "$CFG"
fi
if grep -q '<AuthenticationRequired>' "$CFG"; then
sed -i "s|<AuthenticationRequired>[^<]*</AuthenticationRequired>|<AuthenticationRequired>${AUTH_REQUIRED}</AuthenticationRequired>|" "$CFG"
else
sed -i "s|<Config>|<Config>\n <AuthenticationRequired>${AUTH_REQUIRED}</AuthenticationRequired>|" "$CFG"
fi
fi
chown 1000:1000 "$CFG"
chmod 600 "$CFG"
echo "config-init: <ApiKey> and <UrlBase>=${URL_BASE} enforced from Vault"
echo "config-init: <ApiKey>, <UrlBase>=${URL_BASE}, <AuthenticationMethod>=${AUTH_METHOD}, <AuthenticationRequired>=${AUTH_REQUIRED} enforced from Vault"
resources:
requests:
cpu: 50m