Nextcloud Installation Modifications
Summary of changes made to fix OIDC authentication, MinIO, Redis, and Keycloak issues
1. Keycloak Configuration
helmfile/apps/keycloak/keycloak.yaml.gotmpl
- Changed
proxyHeadersfrom"forwarded"back to"xforwarded"(Bitnami entrypoint convertsxforwarded→--proxy-headers=xforwarded, which is valid for Keycloak 26+) - Added
extraEnvVarswiring from.Values.application.keycloak.extraEnvVarsto allow environment-specific overrides
helmfile/environments/demo/mijnbureau.yaml.gotmpl
- Added
extraEnvVarsblock inapplication.keycloak:KC_PROXY_HEADERS: xforwarded(was incorrectlyx-forwardedwith hyphen, which Keycloak rejects)KC_HOSTNAME_STRICT: false(allows mixed frontchannel/backchannel URLs)KC_HOSTNAME_BACKCHANNEL_DYNAMIC: true(Keycloak returns internal HTTP URLs for backchannel endpoints based on incoming Host header)KC_HTTP_ENABLED: true(enables HTTP listener for internal traffic)
- Added
authentication.client.nextcloudcredentials block - Added
application.nextcloud.oidc.discoveryUri: "http://keycloak-keycloak/realms/mijnbureau/.well-known/openid-configuration"
2. Nextcloud OIDC Configuration
helmfile/apps/nextcloud/values.yaml.gotmpl
- Added
discoveryUriwith fallback tohttp://keycloak-keycloak/realms/mijnbureau/.well-known/openid-configuration - Added
checkBearer: trueandbearerProvisioning: trueto OIDC provider config - Changed
externalRedis.existingSecret: "nextcloud-redis"andexistingSecretPasswordKey: "redis-password"(instead ofexternalRedis.passwordwhich helm would recompute on every sync)
3. Pre-start Hook for Nextcloud OIDC Provider
helmfile/apps/nextcloud/values.yaml.gotmpl
- Added
extraDeployConfigMap (nextcloud-oidc-pre-start) with scriptoidc-provider-update.sh - Mount path:
/docker-entrypoint-hooks.d/before-starting/(Bitnami convention, NOTpre-start/) - Script permissions:
defaultMode: 493(octal0755) - Script actions:
- Run
occ config:system:set allow_local_remote_servers --value true --type boolean(system-level, required byRemoteHostValidator) - Run
occ user_oidc:provider keycloakwith--check-bearer=1,--bearer-provisioning=1,--unique-uid=1to update the existing provider in-place (keeps stable numeric ID)
- Run
4. Redis Password Fix
helmfile/apps/nextcloud/charts/nextcloud/templates/_helpers.tpl
- Fixed typo:
ExistingSecretSecretPasswordKey→existingSecretPasswordKeyinnextcloud.redis.secretPasswordKeyhelper - This bug caused the chart to always look for key
passwordin the secret instead of respecting the configuredexistingSecretPasswordKeyvalue
5. Network Policy for Docs
helmfile/environments/demo/mijnbureau.yaml.gotmpl
- Changed
docs.backend.networkPolicy.extraEgressport from80to8080 - Kubernetes NetworkPolicy egress rules are evaluated after DNAT, so the destination port is the container port (8080), not the service port (80)
6. Bureaublad Backend Fix (Redis + Network Policy)
helmfile/apps/bureaublad/values.yaml.gotmpl
- Added
REDIS_URLenv var to backend section (was missing, causing OIDC callback to fail when storing auth session) - Added Redis egress rule (port 6379) to backend
networkPolicy.extraEgress - Added Keycloak OIDC egress rule (port 8080) to backend
networkPolicy.extraEgress
helmfile/apps/bureaublad/values.yaml.gotmpl
- Added Keycloak egress rule to backend
networkPolicy.extraEgress:- Port
8080(Keycloak container port, post-DNAT) - Targets pods with
app.kubernetes.io/name: keycloak
- Port
- This is needed because the bureaublad backend exchanges OIDC authorization codes for tokens via
http://keycloak-keycloak/.../token(HTTPS to the public endpoint works for auth redirect, but the token exchange uses internal HTTP)
7. MinIO Credentials Fix
nextcloud-externalminiosecret had a different password thannextcloud-minioroot password- Root cause: the initial helm deploy generated different SHA1 hashes from the derived password
- Fix: patched
nextcloud-externalminiosecret to matchnextcloud-minioroot password - This resolved the “Error while writing stream to object store” /
SignatureDoesNotMatcherrors
7. Files Modified
| File | Change |
|---|---|
helmfile/environments/demo/mijnbureau.yaml.gotmpl | Keycloak extraEnvVars, egress port fix, OIDC discovery URI, Nextcloud client credentials |
helmfile/apps/keycloak/keycloak.yaml.gotmpl | proxyHeaders reverted to xforwarded, extraEnvVars wiring |
helmfile/apps/nextcloud/values.yaml.gotmpl | OIDC config, pre-start hook, externalRedis with existingSecret |
helmfile/apps/nextcloud/charts/nextcloud/templates/_helpers.tpl | Fixed existingSecretPasswordKey typo |
helmfile/apps/docs/values.yaml.gotmpl | Reads extraEgress from environment config |