Hi,

Attached is a new port, sysutils/deadman, a dead man's switch built
from the base system: jobs "ping" a URL of their own when they run, and
deadman sends mail when the pings stop. httpd(8) and slowcgi(8) take
the pings, cron(8) runs the checks and smtpd(8) sends the mail, so
there is no daemon and no database. I wrote it, and would maintain the
port.

This is a bit like the very excellent service that healthchecks.io
provides (no affiliation, just a happy user). I wanted to do the same
thing without depending on an external service, so I wrote this.

For full disclosure: I wrote deadman, and this port, using an AI
assistant (Claude), as the AUTHORS sections of its manual pages say.
I know that is not a universally-admirable thing to do. I am being
up-front about it.

For what it's worth, one of the things I used Claude to do was to
attack the code with aggressive reviews modelled on as many different
reviews by OpenBSD contributors as I could find. This led to changes
that I think were positive. If you're curious, the agent's context
and the release history is visible at github.com/ableyjoe/deadman.

From pkg/DESCR:

  deadman is a dead man's switch: jobs ping a URL of their own when
  they run, and deadman sends mail when the pings stop. It does the
  core of what healthchecks.io does, with the base system: httpd(8)
  and slowcgi(8) take the pings, cron(8) runs the checks, and
  smtpd(8) sends the mail. There is no daemon and no database.

  Each check has a period and a grace time, and is new, up, late or
  down. A job can also report that it has started, so that a run
  that hangs counts as down, or that it has failed.

  The ping recorder is static and runs in httpd's chroot. It accepts
  only well-formed tokens, and can do nothing but set the modification
  time of a file that deadman made for a configured check. The
  checker needs no privileges: it runs as its own user, from that
  user's crontab. Both use pledge(2) and unveil(2).

Notes:

- It needs a _deadman user. I have used 906, the next free ID in
  infrastructure/db/user.list today:

  906 _deadman          _deadman        sysutils/deadman

- deadman.cgi goes in /var/www/cgi-bin, statically linked, since
  slowcgi(8) runs it in httpd's chroot; the rest goes under
  /usr/local, using @cwd in the packing list as www/cgit does.

- The package makes /etc/deadman.conf (root:_deadman, 0640, since the
  tokens in it are capabilities), /var/www/deadman and /var/db/deadman
  with @sample. deadman refuses a configuration that is not root's,
  that its group or others can write, or that others can read.

- make test runs 94 regression tests; on OpenBSD they run under
  pledge and unveil, so a missing promise shows up as a failure.

- DEBUG_PACKAGES is set, and the packing list is as update-plist
  writes it.

Built and tested on OpenBSD 8.0/amd64 with the 8.0 ports tree: make
test, make package, make port-lib-depends-check and portcheck are all
clean, and I am running the package on my own server.

Comments and derisive howls of laughter are all welcome. Hi to Theo
if he's watching.


Joe

Attachment: deadman-port.tgz
Description: Binary data

Reply via email to