Deploy to valhalla / deploy (push) Has been cancelled
Homarr-labs stores state under /appdata; the old compose mapped empty paths and lost the dashboard on redeploy. TB-006 batch 1 adds Caddy forward_auth for 12 admin UIs with API and webhook bypasses.
55 lines
2.2 KiB
Python
55 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Apply TB-006 batch 1 proxy providers via authentik ORM (run: ak shell < script)."""
|
|
from authentik.core.models import Application
|
|
from authentik.flows.models import Flow
|
|
from authentik.outposts.models import Outpost, OutpostType
|
|
from authentik.providers.proxy.models import ProxyMode, ProxyProvider
|
|
|
|
AUTHZ = Flow.objects.get(slug="default-provider-authorization-implicit-consent")
|
|
INVALID = Flow.objects.get(slug="default-provider-invalidation-flow")
|
|
|
|
SITES = [
|
|
("homelab-portainer", "portainer", "Portainer", "https://portainer.ginnoir.com"),
|
|
("homelab-code", "code", "code-server", "https://code.ginnoir.com"),
|
|
("homelab-registry-ui", "registry-ui", "Registry UI", "https://registry-ui.ginnoir.com"),
|
|
("homelab-vault", "vault", "Vault", "https://vault.ginnoir.com"),
|
|
("homelab-minio", "minio", "MinIO Console", "https://minio.ginnoir.com"),
|
|
("homelab-homarr", "homarr", "Homarr", "https://homarr.ginnoir.com"),
|
|
("homelab-uptime", "uptime", "Uptime Kuma", "https://uptime.ginnoir.com"),
|
|
("homelab-backup", "backup", "Kopia", "https://backup.ginnoir.com"),
|
|
("homelab-gitea", "gitea", "Gitea", "https://gitea.ginnoir.com"),
|
|
("homelab-dbx", "dbx", "DBX", "https://dbx.ginnoir.com"),
|
|
("homelab-bookstack", "bookstack", "BookStack", "https://docs.ginnoir.com"),
|
|
("homelab-plane", "plane", "Plane", "https://plane.ginnoir.com"),
|
|
]
|
|
|
|
providers = []
|
|
for pname, slug, aname, host in SITES:
|
|
provider, _ = ProxyProvider.objects.update_or_create(
|
|
name=pname,
|
|
defaults={
|
|
"mode": ProxyMode.FORWARD_SINGLE,
|
|
"external_host": host,
|
|
"authorization_flow": AUTHZ,
|
|
"invalidation_flow": INVALID,
|
|
"intercept_header_auth": True,
|
|
},
|
|
)
|
|
Application.objects.update_or_create(
|
|
slug=slug,
|
|
defaults={
|
|
"name": aname,
|
|
"provider": provider,
|
|
"meta_launch_url": host,
|
|
"policy_engine_mode": "any",
|
|
},
|
|
)
|
|
providers.append(provider)
|
|
print(f"ok {slug} -> {host}")
|
|
|
|
outpost = Outpost.objects.get(name="authentik Embedded Outpost")
|
|
outpost.type = OutpostType.PROXY
|
|
outpost.providers.set(providers)
|
|
outpost.save()
|
|
print(f"outpost providers: {outpost.providers.count()}")
|