Commit Graph
19 Commits
Author SHA1 Message Date
kevinveenbirkenbachandClaude Opus 5 eda6b25329 fix(pihole): pass the admin password through a dotenv-quoted env file and judge the denial before the callback URL
Run 34421944328 pihole#1 (README replay, sso off) never left
/admin/login: the native login was refused. The compose template put
the administrator password inline under environment:, and compose
interpolates every $name in it, so the container held the inventory
password with each $name removed (its sha256 prefix matches that
mangled value, not the real one). The environment moves into
templates/env.j2, which has_env wires as env_file, with the password
through dotenv_quote like every other role. Rendering the real template
with a password containing $name, ${...} and $$ and reading it back from a
compose v5.5.1 container returns it unchanged, while an unquoted RAW=S$x
control line in the same file comes back as "S". TZ now comes from the
shared sys-svc-container include, so PIHOLE_TIMEZONE goes.

pihole#0 (onion) timed out on "still handing off": oauth2-proxy serves
its 403 page for a user outside the allowed group on /oauth2/callback,
and the poll checked the callback URL before the page text. The CI
trace holds "You do not have permission to access this resource." in
that page's collapsed More Info block, which textContent reads. The
poll now judges the denial text first, then the Keycloak auth URL, and
only then treats the callback URL as a handoff in progress. The loose
"403" and "forbidden" matches go, since a reached admin page can
contain either.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 13:47:22 +02:00
kevinveenbirkenbachandClaude Opus 4.8 4ace141939 fix(web-app-pihole): drop redundant sso-proxy provider_ca_files task
Under self_signed TLS the shared sso-proxy template (web-app-keycloak) now both bind-mounts the platform CA to CA_TRUST.cert_container (sso_proxy/container.yml.j2) and points provider_ca_files at it (oauth2-proxy-keycloak.cfg.j2), gated on the same condition as this task. pihole's lineinfile added a SECOND provider_ca_files (the wrapper-injected /tmp path, which is skipped for the distroless oauth2-proxy image), producing 'toml: key provider_ca_files is already defined' so the sidecar crash-looped and never converged. The task is redundant and its path less reliable than the template's explicit bind mount, so remove it and the now-unused PIHOLE_SSO_PROXY_CA_CONTAINER_PATH.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 16:47:34 +02:00
kevinveenbirkenbachandClaude Opus 4.8 6df91fb0c2 fix(web-app-pihole): conform compose template to lookups + disable unused email
Route image/volumes/networks through the container_image, container_volumes, compose_volumes and *_networks lookups (was a raw image ref, an inline service volumes block, and the deprecated compose_volumes pipe form); add meta/volumes.yml as the volume source and drop the four now-unused PIHOLE_IMAGE/VERSION/VOLUME vars. Pi-hole sends no mail, so the email service is pinned enabled=false/shared=false (dynamic-flag nocheck) and dropped from the variant matrix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 03:46:12 +02:00
Prageeth Panicker 408026bf7f fix(pihole): trust self-signed platform CA for sso-proxy OIDC discovery
oauth2-proxy (quay.io/oauth2-proxy/oauth2-proxy) is a distroless image
with no /bin/sh, so the platform's CA-trust wrapper (with-ca-trust.sh,
applied by compose_ca.py for services with a shell) is skipped for this
container. Go binaries ignore SSL_CERT_FILE/REQUESTS_CA_BUNDLE and use
only the OS system cert pool, so on self-signed TLS setups oauth2-proxy
fails OIDC discovery against Keycloak with
'x509: certificate signed by unknown authority'. nginx then falls back
to pihole's native /admin/login instead of redirecting to Keycloak,
breaking SSO entirely in CI and on any self-signed deployment.

Fix: append provider_ca_file to the rendered sso-proxy config after
web-app-keycloak/tasks/sso_proxy.yml renders it and before compose up
runs. oauth2-proxy loads this CA explicitly for the OIDC provider
connection, bypassing the system cert pool entirely.

Scoped to this role: avoids touching the shared
oauth2-proxy-keycloak.cfg.j2 template (would affect every
flavor: oauth2 role platform-wide). No-op on production
(TLS_MODE=letsencrypt).
2026-06-24 03:46:11 +02:00
Prageeth Panicker 3e964ffd31 fix(web-app-pihole): address reviewer feedback - SSO/native password, split tests, remove schema 2026-06-24 03:46:10 +02:00
Prageeth Panicker 2746654d36 fix(web-app-pihole): migrate to v9.x SSO pattern and fix compose_volumes 2026-06-24 03:46:10 +02:00
Prageeth Panicker 88c19badda fix(web-app-pihole): remove duplicate TEST_E2E_PLAYWRIGHT_WAIT_ENABLED constant
Already defined in test-e2e-playwright/defaults/main.yml.
HTTP wait accepts 100-499 range including oauth2-proxy 403.
2026-06-24 03:46:10 +02:00
Prageeth Panicker 97529ef784 fix(web-app-pihole): fix oauth2-proxy deployment and javascript injection
- Fix oauth2.enabled: replace Jinja2 group_names expression with literal true
- Set oauth2.shared: false to deploy role-local oauth2-proxy instance
- Add allowed_groups for RBAC administrator access control
- Add javascript service for logout button injection
- Remove variant 1 (standalone mode) - pihole always requires Keycloak
- Delete compose.override.yml.j2 (--ssl-insecure-skip-verify no longer needed)
- Fix javascript.js.j2: wrap redirect in DOMContentLoaded to fix DOM timing
- Add TEST_E2E_PLAYWRIGHT_WAIT_ENABLED: false for oauth2-protected app
2026-06-24 03:46:10 +02:00
Prageeth Panicker e3b76e81c0 fix(web-app-pihole): address reviewer feedback and fix CI failures
- tasks/01_core.yml: set docker_compose_flush_handlers: true, remove manual flush_handlers task
- tasks/01_setup.yml: add wait for oauth2-proxy port to fix HTTP 500 in CI wait check
- meta/services.yml: use NETWORK_PUBLIC_DNS_RESOLVERS SPOT for upstream_dns
- vars/main.yml: remove default from upstream_dns lookup, join list with semicolon
2026-06-24 03:46:09 +02:00
Prageeth Panicker 5b716c15c6 fix(web-app-pihole): remove duplicate TEST_E2E_PLAYWRIGHT_WAIT_ENABLED constant
Variable is already defined platform-wide in test-e2e-playwright/defaults/main.yml.
Redefining it in vars/main.yml violates the project-wide constant uniqueness rule.
2026-06-24 03:46:09 +02:00
Prageeth Panicker b6ff073136 fix(web-app-pihole): fix playwright logout test, remove duplicate oauth2-proxy block, add playwright wait flag
- Update logout test to navigate directly to oauth2/sign_out endpoint with Keycloak logout redirect
- Remove duplicate oauth2-proxy service definition from compose.yml.j2 (was causing duplicate key error)
- Add TEST_E2E_PLAYWRIGHT_WAIT_ENABLED: false to vars/main.yml (oauth2-proxy returns 403 before redirect)
2026-06-24 03:46:09 +02:00
Prageeth Panicker f4c68301e4 fix(web-app-pihole): fix config path for upstream_dns lookup 2026-06-24 03:46:09 +02:00
Prageeth Panicker 0c91412727 fix(web-app-pihole): add variants, javascript injection, fix oauth2 DNS, update playwright tests 2026-06-24 03:46:09 +02:00
Prageeth Panicker 2c1d0cbd28 fix(web-app-pihole): restore PIHOLE_VOLUME_DATA and PIHOLE_VOLUME_DNSMASQ vars 2026-06-24 03:46:09 +02:00
Prageeth Panicker 3baaa1a948 fix(web-app-pihole): fix CI lint and integration test failures 2026-06-24 03:46:09 +02:00
Prageeth Panicker 470118494a fix(web-app-pihole): migrate to meta/services.yml, fix domain resolution, disable native password 2026-06-24 03:46:09 +02:00
Prageeth Panicker 786bda0bfb fix(web-app-pihole): fix compose template, RBAC group, playwright env and wait flag 2026-06-24 03:46:09 +02:00
Prageeth Panicker 3112bb6402 fix(web-app-pihole): fix CI lint failures
- Add tasks/01_core.yml with run_once guard (test_service_core_first_task_run_once)
- Update tasks/main.yml to load 01_core.yml with run_once guard
- Add '# noqa: shared' comment on oauth2 config (test_service_shared_consistency)
- Remove unused PIHOLE_PORT variable from vars/main.yml (test_variable_usage)
2026-06-24 03:46:08 +02:00
Prageeth Panicker 561db31693 feat(web-app-pihole): add Pi-hole role with OAuth2/Keycloak RBAC
- Deploy Pi-hole as web app with NGINX proxy and OAuth2 protection
- Only web-app-pihole-administrators group can access the dashboard
- DNS port 53 (TCP/UDP) exposed for network-wide ad blocking
- Upstream DNS configurable per inventory (default: Cloudflare 1.1.1.1)
- Redis session store for OAuth2 proxy
- Timezone from HOST_TIMEZONE platform variable
- Port bindings use DOCKER_BIND_HOST platform variable
- Register subnet 192.168.102.240/28 in networks
- Register ports 8070 (http) and 16493 (oauth2) in ports
- Playwright tests: oauth2 protection, admin login, biber denied (3/3 passing)

Known limitations:
- Pi-hole v6 gravity blocklist requires manual setup via admin UI
- Internal *.infinito.example DNS forwarding to CoreDNS planned as follow-up
2026-06-24 03:46:08 +02:00