docs
cairnobs.org Demo Source
Esc

What it watches · 11 of 14

Cloudflare

Your Cloudflare zones read with a read-only API token: load balancer pools and origins, SSL mode, edge certificates, 5xx rates, unusual blocking, and DNS records that changed when nobody said so.

1 min read

obs-beacond reads Cloudflare itself every five minutes, with a read-only API token. The Cloudflare page appears once it's set up, and the network map gains a Cloudflare box with its pools in front of your hosts.

Set it up

Make an API token in Cloudflare's dashboard with read permissions only (Zone, SSL and Certificates, Load Balancers, DNS and Analytics, read), put it in a file only obs-beacond can read (root:obs-beacon, 0640), and:

cloudflare:
  token_file: /etc/obs-beacon/cloudflare-token
  # zones: [example.org, example.com]     # default: every zone the token can read
  # ssl_mode: strict                      # what every zone's SSL mode should be
  # ssl_mode_zones: {legacy.example.com: full}

The token file is read again on every poll, so you can replace it without a restart.

What's judged

What Alert
A load balancer pool has no healthy origin Critical
An enabled origin fails its pool's health check in any region Warning, on that origin's host
A zone's SSL mode isn't ssl_mode (or its ssl_mode_zones entry) Warning
An edge certificate isn't active Warning
An edge certificate ends within 14 / 3 days Warning / critical
5xx answers are 5% / 25% of a zone's last 15 minutes, and at least 20 Warning / critical, naming the busiest host
Cloudflare's security blocked or challenged at least 100 requests in 15 minutes, and 10 times the day before's average Warning
A zone's DNS records changed since the last accepted set Warning, until the change is undone or accepted
The API can't be read for 3 polls in a row Warning; the last good reading stays on screen

Each threshold has a setting: cert_warn_days, cert_critical_days, error_warn_pct, error_critical_pct, error_min, block_min, block_factor, and every for how often it polls.

DNS drift. The first time Cairn OBS sees a zone, its records become the baseline. A record added, removed or changed after that warns until an admin presses Accept on the Cloudflare page, which is in the audit log, or the change is undone. With a database the baseline survives restarts, so a change made while obs-beacond was down is still caught.

Blocking counts requests Cloudflare's security refused at the edge (block and the challenges), not ones it let through, and not a site's own 403s. Cloudflare's status page is shown, never alerted on.