homek8s/apps/base/osint/app-deployment.yaml
Sirius DevOps bc942e2571 registry(auth): require auth for image pulls (audit F11)
Forgejo 16 mints an anonymous ("ghost user") registry token on /v2/token and
grants it Read on every package regardless of repo visibility, so all 18 app
images were world-downloadable — including images of private repos
(siriusdevops-site, phs-site, sirius-growth-*, sgs-leadgen).

* FORGEJO__service__REQUIRE_SIGNIN_VIEW=true: /v2/token answers UNAUTHORIZED
  to anonymous clients, anonymous manifests get 401. This is the documented
  switch in routers/api/packages/container (Authenticate) and
  services/context/package.go (determineAccessMode). Side effect: the Forgejo
  web UI/API becomes login-only for anonymous visitors.
* imagePullSecrets: [forgejo-pull] on all 18 workloads that pull from the
  registry (osint, piedmont, sirius-growth, siriusdevops). The
  kubernetes.io/dockerconfigjson Secret is per-namespace and out of band
  (never in git); docs/registry-pull-auth.md documents why, how to recreate
  it, and the verification commands. No containerd-level credential.
2026-11-27 00:15:20 -05:00

109 lines
3.4 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: osint-app
namespace: osint
labels:
app: osint-app
spec:
replicas: 1
selector:
matchLabels:
app: osint-app
template:
metadata:
labels:
app: osint-app
spec:
imagePullSecrets:
- name: forgejo-pull
tolerations:
- key: dedicated
operator: Exists
effect: PreferNoSchedule
nodeSelector:
kubernetes.io/hostname: siriussec
initContainers:
# Wait for Postgres before alembic runs (the entrypoint migrates).
- name: wait-for-db
image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-54897b49bc57
imagePullPolicy: IfNotPresent
command:
- python
- -c
- |
import os, socket, sys, time
host, port = os.environ.get("DB_HOST", "osint-db"), int(os.environ.get("DB_PORT", "5432"))
deadline = time.time() + 300
while time.time() < deadline:
try:
with socket.create_connection((host, port), timeout=3):
print("postgres is reachable"); sys.exit(0)
except OSError:
time.sleep(3)
sys.exit("postgres did not become reachable in 300s")
containers:
- name: app
image: forgejo.siriusdevops.com/sirius/osint-dashboard:amd64-54897b49bc57
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8000
name: http
envFrom:
- configMapRef:
name: osint-env
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: osint-db
key: password
# Single-admin auth (app/auth.py). optional: true on purpose — a
# missing Secret must not block startup; the app then fails closed
# (admin routes 403 "admin auth not configured") while the public
# read-only HUD still serves.
- name: ADMIN_USER
valueFrom:
secretKeyRef:
name: osint-admin
key: ADMIN_USER
optional: true
- name: ADMIN_PASSWORD_HASH
valueFrom:
secretKeyRef:
name: osint-admin
key: ADMIN_PASSWORD_HASH
optional: true
- name: ADMIN_SESSION_SECRET
valueFrom:
secretKeyRef:
name: osint-admin
key: ADMIN_SESSION_SECRET
optional: true
readinessProbe:
httpGet:
path: /api/health
port: 8000
initialDelaySeconds: 10
periodSeconds: 15
failureThreshold: 6
livenessProbe:
httpGet:
path: /api/health
port: 8000
initialDelaySeconds: 90
periodSeconds: 30
failureThreshold: 5
volumeMounts:
- name: snapshots
mountPath: /data/snapshots
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: 1Gi
volumes:
- name: snapshots
persistentVolumeClaim:
claimName: osint-camera-snapshots