.env.example 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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
  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. JOB_RECOMPUTE_MAX_RUNTIME_SECONDS=240
  54. JOB_RECOMPUTE_MAX_ROWS_PER_TICK=5000
  55. JOB_AUDIT_RETENTION_DAYS=180
  56. JOB_GEOIP_REFRESH_INTERVAL_DAYS=7
  57. # Manual blocks / allowlist evaluator
  58. # In-process cache TTL for the CidrEvaluator. Mutations invalidate explicitly,
  59. # so this only matters for cross-replica visibility (per replica is fine).
  60. CIDR_EVALUATOR_TTL_SECONDS=60
  61. # Distribution endpoint
  62. # Per-policy blocklist cache TTL. Mutations to policies / manual_blocks /
  63. # allowlist invalidate explicitly; this is the cross-replica window.
  64. BLOCKLIST_CACHE_TTL_SECONDS=30
  65. # GeoIP / ASN enrichment
  66. # Three pluggable MMDB providers — pick one. The on-disk paths below are
  67. # provider-agnostic; the refresh-geoip job atomic-replaces them with the
  68. # selected provider's files.
  69. # - dbip (default, no auth required, CC BY 4.0 — UI shows attribution)
  70. # - maxmind (opt-in, requires MAXMIND_LICENSE_KEY)
  71. # - ipinfo (opt-in, requires IPINFO_TOKEN — UI shows attribution)
  72. GEOIP_ENABLED=true
  73. GEOIP_PROVIDER=dbip
  74. GEOIP_COUNTRY_DB=/data/geoip/country.mmdb
  75. GEOIP_ASN_DB=/data/geoip/asn.mmdb
  76. MAXMIND_LICENSE_KEY=
  77. IPINFO_TOKEN=
  78. # CORS — origin of the ui container (or future SPA frontend)
  79. UI_ORIGIN=http://localhost:8080
  80. # Rate limiting (public API)
  81. API_RATE_LIMIT_PER_SECOND=60
  82. # -----------------------------------------------------------------------------
  83. # ui container
  84. # -----------------------------------------------------------------------------
  85. # (APP_ENV / LOG_LEVEL above are reused; the ui reads its own copies of those.)
  86. UI_SECRET= # 32-byte hex; signs session cookies
  87. PUBLIC_URL=http://localhost:8080
  88. # Where the ui finds the api (internal docker network DNS)
  89. API_BASE_URL=http://api:8081
  90. # OIDC (Entra ID) — lives in ui only
  91. OIDC_ENABLED=true
  92. OIDC_ISSUER=https://login.microsoftonline.com/<tenant>/v2.0
  93. OIDC_CLIENT_ID=
  94. OIDC_CLIENT_SECRET=
  95. OIDC_REDIRECT_URI=https://reputation.example.com/oidc/callback
  96. # Local admin — lives in ui only
  97. LOCAL_ADMIN_ENABLED=true
  98. LOCAL_ADMIN_USERNAME=admin
  99. # Generate with: php -r "echo password_hash('s3cret', PASSWORD_ARGON2ID);"
  100. LOCAL_ADMIN_PASSWORD_HASH=
  101. # Optional BCP 47 locale fallback for date/time formatting (e.g. "de-CH",
  102. # "en-GB"). The browser's locale wins; this is appended as a fallback so
  103. # JavaScript's Intl.DateTimeFormat picks something sensible if the
  104. # browser's preference isn't supported. Empty = browser-only.
  105. UI_LOCALE=