From 88b268fc52d3c48f4f0f63a2f7268ee311bf8425 Mon Sep 17 00:00:00 2001 From: funman300 Date: Sat, 7 Nov 2026 17:46:37 -0700 Subject: [PATCH] Restrict anonymous Matomo reports to LAN --- deploy/LAN_ACCESS.md | 14 ++++++++++++++ deploy/ingress-analytics.yaml | 2 ++ deploy/kustomization.yaml | 1 + deploy/matomo-lan-only.yaml | 9 +++++++++ 4 files changed, 26 insertions(+) create mode 100644 deploy/LAN_ACCESS.md create mode 100644 deploy/matomo-lan-only.yaml diff --git a/deploy/LAN_ACCESS.md b/deploy/LAN_ACCESS.md new file mode 100644 index 0000000..1f5297c --- /dev/null +++ b/deploy/LAN_ACCESS.md @@ -0,0 +1,14 @@ +# LAN-only anonymous Matomo reports + +The analytics ingress is restricted to `10.10.40.0/24`. Matomo still requires +authentication unless its anonymous user is explicitly granted access. + +To enable passwordless, read-only reports for the tracked site: + +1. Sign in to Matomo as a superuser. +2. Open **Administration → System → Users → Manage access**. +3. For the intended site, grant the `anonymous` user **View** access only. + +Do not grant `Write`, `Admin`, or `Superuser` access to the anonymous user. The +Traefik allowlist keeps the reports reachable only from the trusted LAN; it does +not replace Matomo's own account authentication for administration. diff --git a/deploy/ingress-analytics.yaml b/deploy/ingress-analytics.yaml index 22be5ba..6321d29 100644 --- a/deploy/ingress-analytics.yaml +++ b/deploy/ingress-analytics.yaml @@ -6,6 +6,8 @@ metadata: annotations: cert-manager.io/cluster-issuer: letsencrypt-prod traefik.ingress.kubernetes.io/router.entrypoints: websecure + # Anonymous Matomo report access is view-only and restricted to the trusted LAN. + traefik.ingress.kubernetes.io/router.middlewares: solitaire-matomo-lan-only@kubernetescrd spec: ingressClassName: traefik rules: diff --git a/deploy/kustomization.yaml b/deploy/kustomization.yaml index 40599dc..169445c 100644 --- a/deploy/kustomization.yaml +++ b/deploy/kustomization.yaml @@ -14,6 +14,7 @@ resources: - matomo-deployment.yaml - matomo-service.yaml - ingress-analytics.yaml +- matomo-lan-only.yaml # CI updates this block automatically via `kustomize edit set image`. # The image name here matches the `image: solitaire-server` stub in deployment.yaml. diff --git a/deploy/matomo-lan-only.yaml b/deploy/matomo-lan-only.yaml new file mode 100644 index 0000000..db38792 --- /dev/null +++ b/deploy/matomo-lan-only.yaml @@ -0,0 +1,9 @@ +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: matomo-lan-only + namespace: solitaire +spec: + ipAllowList: + sourceRange: + - 10.10.40.0/24