Files
opengenesislinkserver/doc/OpenGenesisLINK/SYS_API_FOUNDATION_GEN1.md
T

4.8 KiB
Raw Blame History

OpenGenesisLINK Generation 1 — SYS.API foundation

New opt-in ROBUST module: `sys.api.dll`. The existing `OGL.API.dll`, its API routes, tokens and scopes remain intact. Future SYS.API business functions will be specified separately.

Architecture

  • The ROBUST ServiceList loads `SysApiConnector` from `sys.api.dll`.
  • Internal service: `http://127.0.0.1:8851` (loopback only).
  • Public access: `https://YOUR_DOMAIN:8850` through a valid Let's Encrypt TLS reverse proxy (such as Nginx). Never expose plaintext on public 8850.
  • The UI uses the exact OGL mascot supplied by the operator, resized to a 500px WebP asset, plus animated particles, light beams, responsive holographic design.
  • Every instance needs a distinct internal port.

ROBUST configuration

Within the existing ServiceList, the connector is installed alongside the legacy API.

[SysApi]
Enabled = true
InternalPort = 8851
PublicPort = 8850
PublicOrigin = "https://YOUR_DOMAIN:8850"
SecretDirectory = "/etc/oglwebinterface"

Distributed templates set Enabled=false until deliberately configured. On a Linux server the ROBUST service account must have permission to write the protected secret directory.

Portal token — first start

The module generates 64 cryptographically random bytes, persisted in `/etc/oglwebinterface/.env` as `OGL_SYSAPI_PORTAL_TOKEN`. It sets the directory 0700 and the file 0600; existing tokens survive restarts. Invalid or symlinked files fail closed. Tokens never appear in the UI, application logs or query strings.

The Stadtportal backend will need the same token delivered through a separate secure administrator-controlled provisioning step; the module cannot safely modify an unknown remote portal's environment automatically. Use `Authorization: Bearer ` only on backend requests. This new foundation has one token, no OAuth scopes for machine-to-machine calls; individual future actions will still need explicit server-side authorization and audit.

Web administration

Avatar username/password are checked against ROBUST's existing user and authentication services. Only active accounts with UserLevel >= 200 can log into the dashboard. Valid credentials below level 200 receive 403 Access Denied – Keine Berechtigung. Admin sessions use random one-hour HttpOnly/SameSite cookies, Secure behind trusted HTTPS proxy, CSRF and origin controls, rate limiting, and revalidation of UserLevel on each request.

Initial endpoints:

  • GET /v1/health (minimal public status)
  • GET /api/v1/portal/ping (portal token)
  • GET /api/v1/portal/capabilities (portal token)
  • GET /api/admin/overview (admin avatar session)

No destructive privileged API functions are exposed yet. Legacy World API remains unchanged.

Let's Encrypt — mandatory prerequisites

A domain/FQDN and successful ACME validation are REQUIRED before public TLS can be enabled. Let's Encrypt cannot issue a certificate on TCP/8850 alone. HTTP-01 uses public TCP/80, where the production ROBUST already listens; DNS-01 needs a DNS provider challenge, and TLS-ALPN needs TCP/443. Do NOT stop production ROBUST or expose unencrypted 8850 to perform issuance.

Use the HTTPS gateway that already terminates the city's portal TLS, or configure a routed ACME HTTP-01 webroot challenge, or an automated DNS-01 provider. With valid certificates installed at `/etc/letsencrypt/live/YOUR_DOMAIN/{fullchain.pem,privkey.pem}`, use `tools/ops/sys-api-nginx-8850.conf.example` and verify `nginx -t`. Enable the certbot or equivalent ACME renew timer and a deploy hook to reload nginx after renewal. The DLL never reads private certificate keys. The public proxy must replace Host with 127.0.0.1:8851, X-Forwarded-Host with YOUR_DOMAIN:8850 and X-Forwarded-Proto with https.

Tests

python3 tools/ci/verify_sys_api_foundation.py
dotnet build addons/SysApi/sys.api.csproj -c Release
dotnet run --project tools/ci/SysApiSmoke/SysApiSmoke.csproj -c Release

Smoke covers UserLevel 199 vs 200, revoked permissions, invalid credentials, bearer token, secret persistence, CSP, official mascot embedding and origin checks. Production activation and public certificate issuance require the operator's actual FQDN and an acceptance test.

Automated ACME installer (after choosing a domain)

Once the FQDN, ACME email and externally reachable HTTP-01 webroot are configured, the root-only helper tools/ops/sys-api-tls-install.sh <fqdn> <email> <webroot> verifies the HTTP-01 route, obtains the official Let’s Encrypt certificate via certbot, applies the Nginx 8850 TLS template, validates Nginx, and enables the certbot renewal timer plus a reload hook. It refuses to proceed if external TCP/80 does not return the challenge. It does not change or stop ROBUST TCP/80. If HTTP-01 cannot be routed, issue through DNS-01 at your trusted gateway instead. Never publish 8851 or use a self-signed cert for production.