1
0

.env.example 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # =============================================================================
  2. # IRDB — IP Reputation Database — environment configuration
  3. # =============================================================================
  4. # Copy this file to `.env` and fill in the blanks.
  5. # Generate 32-byte hex secrets with: openssl rand -hex 32
  6. # =============================================================================
  7. # -----------------------------------------------------------------------------
  8. # Shared (consumed by both api and ui containers)
  9. # -----------------------------------------------------------------------------
  10. # IRDB-format service token. The api uses this to authenticate the ui's
  11. # calls; the ui presents it on every API request together with
  12. # X-Acting-User-Id. Format: irdb_svc_<32 base32 chars>. Generate one with:
  13. # docker compose run --rm -T api php -r 'require "/app/vendor/autoload.php";
  14. # echo (new App\Domain\Auth\TokenIssuer())->issue(App\Domain\Auth\TokenKind::Service);'
  15. UI_SERVICE_TOKEN=
  16. # -----------------------------------------------------------------------------
  17. # api container
  18. # -----------------------------------------------------------------------------
  19. APP_ENV=production # development | production
  20. LOG_LEVEL=info
  21. # Database
  22. DB_DRIVER=sqlite # sqlite | mysql
  23. DB_SQLITE_PATH=/data/irdb.sqlite
  24. DB_MYSQL_HOST=
  25. DB_MYSQL_PORT=3306
  26. DB_MYSQL_DATABASE=
  27. DB_MYSQL_USERNAME=
  28. DB_MYSQL_PASSWORD=
  29. # OIDC role mapping (defaults applied if no group mapping matches)
  30. OIDC_DEFAULT_ROLE=viewer # viewer | none
  31. # Reputation engine
  32. SCORE_RECOMPUTE_INTERVAL_SECONDS=300
  33. SCORE_REPORT_HARD_CUTOFF_DAYS=365
  34. # Internal jobs
  35. INTERNAL_JOB_TOKEN= # 32-byte hex (api refuses to boot if shorter than 32 hex chars)
  36. # Comma- or whitespace-separated CIDR list of sources allowed to reach
  37. # /internal/*. Empty (the default) means loopback-only (127.0.0.1/32 +
  38. # ::1/128). The bundled `compose.scheduler.yml` shares the api's network
  39. # namespace, so its calls hit loopback and need no extra entries.
  40. # Production topologies that genuinely need extra sources (host cron on
  41. # a private bridge, etc.) list them here AND mirror them into the api
  42. # Caddyfile's @internal matcher.
  43. INTERNAL_CIDR_ALLOWLIST=
  44. # Comma- or whitespace-separated CIDR list of trusted reverse-proxy IPs
  45. # whose `X-Forwarded-For` header Caddy should honour for REMOTE_ADDR
  46. # rewriting. Default (loopback-only) means no XFF rewriting from any
  47. # real client. Set to your reverse proxy's CIDR (e.g. "10.0.0.5/32") if
  48. # the api sits behind one — required for accurate audit-log source IPs.
  49. # SEC_REVIEW F25: never include broad RFC1918 ranges in deployments
  50. # where untrusted neighbours can reach the api on the same docker bridge.
  51. TRUSTED_PROXIES=
  52. # HSTS header value — applied prod-only by both Caddyfiles. Default is
  53. # 1 year + subdomains, NO preload (preload-listing is a one-way
  54. # commitment; browser preload removals take months). Operators who
  55. # want to apply for the HSTS preload list at https://hstspreload.org/
  56. # set:
  57. # HSTS_HEADER="max-age=31536000; includeSubDomains; preload"
  58. # SEC_REVIEW F60.
  59. HSTS_HEADER=
  60. JOB_RECOMPUTE_MAX_RUNTIME_SECONDS=240
  61. JOB_RECOMPUTE_MAX_ROWS_PER_TICK=5000
  62. JOB_AUDIT_RETENTION_DAYS=180
  63. JOB_GEOIP_REFRESH_INTERVAL_DAYS=7
  64. # Manual blocks / allowlist evaluator
  65. # In-process cache TTL for the CidrEvaluator. Mutations invalidate explicitly,
  66. # so this only matters for cross-replica visibility (per replica is fine).
  67. CIDR_EVALUATOR_TTL_SECONDS=60
  68. # Distribution endpoint
  69. # Per-policy blocklist cache TTL. Mutations to policies / manual_blocks /
  70. # allowlist invalidate explicitly; this is the cross-replica window.
  71. BLOCKLIST_CACHE_TTL_SECONDS=30
  72. # GeoIP / ASN enrichment
  73. # Three pluggable MMDB providers — pick one. The on-disk paths below are
  74. # provider-agnostic; the refresh-geoip job atomic-replaces them with the
  75. # selected provider's files.
  76. # - dbip (default, no auth required, CC BY 4.0 — UI shows attribution)
  77. # - maxmind (opt-in, requires MAXMIND_LICENSE_KEY)
  78. # - ipinfo (opt-in, requires IPINFO_TOKEN — UI shows attribution)
  79. GEOIP_ENABLED=true
  80. GEOIP_PROVIDER=dbip
  81. GEOIP_COUNTRY_DB=/data/geoip/country.mmdb
  82. GEOIP_ASN_DB=/data/geoip/asn.mmdb
  83. MAXMIND_LICENSE_KEY=
  84. IPINFO_TOKEN=
  85. # CORS — origin of the ui container (or future SPA frontend)
  86. UI_ORIGIN=http://localhost:8080
  87. # Rate limiting (public API)
  88. API_RATE_LIMIT_PER_SECOND=60
  89. # Public API docs viewer.
  90. # `false` (default): /api/docs and /api/v1/openapi.yaml are not
  91. # registered — Slim returns 404 — so the OpenAPI spec doesn't leak
  92. # the full admin/internal route surface to unauthenticated callers.
  93. # Set `true` for open APIs / dev environments where the menu is
  94. # meant to be public. SEC_REVIEW F68.
  95. API_DOCS_PUBLIC=false
  96. # -----------------------------------------------------------------------------
  97. # ui container
  98. # -----------------------------------------------------------------------------
  99. # (APP_ENV / LOG_LEVEL above are reused; the ui reads its own copies of those.)
  100. PUBLIC_URL=http://localhost:8080
  101. # Where the ui finds the api (internal docker network DNS)
  102. API_BASE_URL=http://api:8081
  103. # OIDC (Entra ID) — lives in ui only
  104. OIDC_ENABLED=true
  105. OIDC_ISSUER=https://login.microsoftonline.com/<tenant>/v2.0
  106. OIDC_CLIENT_ID=
  107. OIDC_CLIENT_SECRET=
  108. OIDC_REDIRECT_URI=https://reputation.example.com/oidc/callback
  109. # Local admin — lives in ui only
  110. LOCAL_ADMIN_ENABLED=true
  111. LOCAL_ADMIN_USERNAME=admin
  112. # Generate with: php -r "echo password_hash('s3cret', PASSWORD_ARGON2ID);"
  113. LOCAL_ADMIN_PASSWORD_HASH=
  114. # Optional BCP 47 locale fallback for date/time formatting (e.g. "de-CH",
  115. # "en-GB"). The browser's locale wins; this is appended as a fallback so
  116. # JavaScript's Intl.DateTimeFormat picks something sensible if the
  117. # browser's preference isn't supported. Empty = browser-only.
  118. UI_LOCALE=
  119. # How often (seconds) the UI re-validates the cached user role/identity
  120. # against `GET /api/v1/admin/me`. Lower = faster propagation of Entra
  121. # group changes and explicit user-disable actions; higher = fewer api
  122. # calls per active user. Default 300 (5 min).
  123. UI_SESSION_REVALIDATE_SECONDS=300