.env.example 5.8 KB

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