# Integrations

# Integrations

Drillmark depends on a handful of external services. Each is opt-in except Bunyip, which is required.

## Bunyip / mokosh-server (required)

- **What it enables:** every signed-in user. Drillmark has no local login.
- **Configure:** `OIDC_ISSUER`, `OIDC_AUDIENCE`, `OIDC_CLIENT_ID`, `OIDC_SCOPES`, and `OIDC_JWKS_URL` (usually derived from the issuer). Optionally set `BUNYIP_URL` to surface a "manage your account" link in Settings, and `BUNYIP_STATUS_CLIENT_ID` / `BUNYIP_STATUS_CLIENT_SECRET` to enable the machine-credential path for the provider-status aggregator. See [configuration](/docs/drillmark/configuration).
- **If unreachable:** the api refuses to boot. The SPA shows a sign-in error and offers no local fallback.

## Mokosh REST surface (optional)

- **What it enables:** organization sync (`/v1/orgs`) so the Organizations screen offers a Bunyip-federated create action instead of the local-create form. Also powers the `OrgSyncStatus` `Synced` / `Stale` / `Disabled` state surfaced in the UI.
- **Configure:** `MOKOSH_API_URL`, usually the same host as `OIDC_ISSUER`.
- **If unreachable:** the UI shows `OrgSyncStatus::Disabled` and falls back to local organization management.

## IMAP providers

Drillmark polls one mailbox per data source. Any IMAP-compliant provider works; the data-source create form knows the host / port defaults for Google (`imap.gmail.com:993`), Microsoft 365 (`outlook.office365.com:993`), and Yahoo (`imap.mail.yahoo.com:993`).

- **Password auth:** the IMAP password is encrypted with `ENCRYPTION_KEY` (AES-256-GCM) before it reaches `data_sources.encrypted_password`.
- **OAuth refresh tokens:** Google and Microsoft can also be authenticated with a stored refresh token. The ciphertext lives on `data_sources.oauth_refresh_token_enc` under the same key. The Admin > Settings tab holds the OAuth provider configuration.
- **If unreachable:** the data source is marked failed for the run; the next scheduled poll retries. Drillmark does not drop the source.

## JMAP (optional)

The backend ships a JMAP client that a data source can use in place of IMAP. Operator verification across providers is thinner than for IMAP, so test against your specific provider before relying on it.

## SMTP for alerts (required when any detector is active)

- **What it enables:** alert delivery to `ADMIN_EMAIL` and any per-channel override on a tenant.
- **Configure:** `SMTP_HOST`, `SMTP_PORT`, `SMTP_SECURITY` (`starttls`, `tls`, or `none`), `SMTP_USERNAME`, `SMTP_PASSWORD`, `SMTP_FROM_ADDRESS`, `ADMIN_EMAIL`.
- **Non-routable recipients:** addresses on `example.com`, `.invalid`, `.localhost`, or `.test` are written to `TRANSACTIONAL_OUTBOX_DIR` instead of being sent. Useful in dev and CI.
- **If unreachable:** detected alerts still land in `alerts_sent`, but dispatch fails. The jobs history records the failure so operators can see what did not go out.

## Geolocation (IP2Location LITE, optional)

- **What it enables:** country / region / city enrichment visible on the Countries page and in dashboard widgets. Also the `BlockedCountryTraffic` alert detector.
- **Configure:** download an IP2Location LITE DB11 binary file and set `IP2LOCATION_DB_PATH` to its absolute path inside the api container.
- **If unset:** the geolocation job does not run. No country data appears in the UI; the blocked-country detector produces nothing.

## Reverse proxy

Any proxy that terminates TLS and can reach `web:80` and `api:8080` works. The sample `compose.yml` uses Traefik v3 with the `cert-cloudflare` resolver. Operators replacing Traefik usually pick nginx or Caddy as a shared gateway; see [installation](/docs/drillmark/installation).
