Documentation
¶
Overview ¶
Package iamserver exports the IAM Beego server startup logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnforceSandboxOriginGuard ¶ added in v1.2.12
func EnforceSandboxOriginGuard()
EnforceSandboxOriginGuard runs at boot. If SANDBOX_GLOBAL_OTP is set, the configured origin MUST be on the sandbox allowlist or IAM panics. This prevents copy-paste of devnet manifests to mainnet from silently disabling MFA across every account. See finding A in red review 2026-04-30.
func Init ¶ added in v1.2.4
func Init() int
Init runs the full IAM bootstrap for the STANDALONE iamd server (config, DB, controllers, filters, background loops) but does NOT bind the HTTP listener — Run adds that. Standalone contract unchanged: it reaps any old instance on the HTTP port and starts the LDAP/RADIUS listeners. Returns the configured HTTP port from app.conf.
func InitEmbed ¶ added in v1.31.17
func InitEmbed() (err error)
InitEmbed runs the IAM bootstrap for IN-PROCESS embedding inside a parent binary (hanzoai/cloud), returning an error instead of panicking so the embedding subsystem can degrade to fail-closed health-only rather than crash every co-resident subsystem (KMS, o11y, …). It is Init WITHOUT the standalone-daemon side effects that are wrong or dangerous in a shared multi-subsystem process:
- NO StopOldInstance — the reaper shells `lsof` (panics on distroless) and would SIGKILL whatever holds :8000 on a shared netns.
- NO LDAP/RADIUS listeners — they bind unmanaged network sockets (RADIUS: an ephemeral UDP port with an empty shared secret) with no teardown.
- NO export/os.Exit — an embed must never terminate its parent.
- NO HTTP listener (same as Init) — the parent serves web.BeeApp.Handlers.
The parent obtains the routed handler via web.BeeApp.Handlers and must also register the Beego session manager (web.Run does this; the embed path skips it, so the parent wires it explicitly).
func Run ¶
func Run()
Run starts the IAM Beego server. This is the body of the original main().
Sessions use the beego `memory` provider. Multi-pod IAM is intentionally not supported — every cluster runs IAM at a single replica and per-org persistent state lives in SQLite under DATA_DIR (replicated by Base Network quasar when that flips on). There is no external cache.
Types ¶
This section is empty.