HardenKitDocs
Guides

Watch a server

Rescan a server or repository on a schedule with hardenkit watch, and get an alert in Slack, Discord or a webhook when a vulnerability is new or starts being exploited.

A scan in CI only sees what you deploy today. A server nobody has deployed to in months keeps its old packages, and nothing tells you when one of them starts being exploited. hardenkit watch rescans it on a schedule and alerts you when something changes.

hardenkit watch /srv/app                        # scan now, then every 24 hours
hardenkit watch --every 6h /srv/app nginx:1.27  # several targets, every 6 hours
hardenkit watch --once /srv/app                 # one pass, then exit (cron, systemd timers)

Targets are what hardenkit scan accepts: directories and container images. The default is the current directory.

What triggers an alert

Each pass compares every target with its saved results from the last pass.

ChangeMeaning
NewA finding at or above the alert priority that was not there before
RaisedA finding that was there at a less urgent priority and is now at or above the alert priority
ResolvedA finding at or above the alert priority that is gone. It is listed in an alert, but never causes one

The alert priority is fix_soon unless you change it with --alert-on, so by default you hear about FIX NOW and FIX SOON. A vulnerability that is added to CISA's Known Exploited Vulnerabilities list moves to FIX NOW, which makes it a raised finding: that is the alert that matters most.

The first run for a target alerts on everything at or above the alert priority and says it is the first run. When nothing is new or raised, no message is sent and one line saying so goes to standard output.

Alerts cover vulnerabilities only. The AI-stack, Kubernetes and GitHub Actions checks are not part of alerts in this version.

Where alerts go

A summary of every alert always goes to standard output. Add one or both of these to send it somewhere:

FlagEnvironment variableWhat it does
--slack URLHARDENKIT_SLACK_WEBHOOKSends a message to a Slack incoming webhook
--webhook URLHARDENKIT_WATCH_WEBHOOKSends the alert as JSON to any address you choose

The Slack message format also works for Discord (add /slack to the Discord webhook address) and Mattermost.

Webhook addresses are secrets. They are never printed, and errors name only the host. Prefer the environment variables over the flags: other users on the machine can see flags in the process list.

Run it every day

systemd

/etc/systemd/system/hardenkit-watch.service:

[Unit]
Description=HardenKit Watch
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
StateDirectory=hardenkit
EnvironmentFile=/etc/hardenkit/watch.env
ExecStart=/usr/local/bin/hardenkit watch --once --state /var/lib/hardenkit/watch.json /srv/app

/etc/systemd/system/hardenkit-watch.timer:

[Unit]
Description=Run HardenKit Watch every day

[Timer]
OnCalendar=daily
RandomizedDelaySec=1h
Persistent=true

[Install]
WantedBy=timers.target

Put the webhook address in /etc/hardenkit/watch.env, readable by root only:

HARDENKIT_SLACK_WEBHOOK=https://hooks.slack.com/services/...

Then turn it on:

systemctl daemon-reload
systemctl enable --now hardenkit-watch.timer

Cron

HARDENKIT_SLACK_WEBHOOK=https://hooks.slack.com/services/...
17 6 * * * /usr/local/bin/hardenkit watch --once /srv/app

Flags

FlagWhat it does
--every DURATIONTime between runs. The default is 24h, the minimum 10m
--onceRun one pass and exit
--alert-on PRIORITYThe least urgent priority that alerts: fix_now, fix_soon (the default), plan or backlog
--state FILEWhere the last results are kept. The default is ~/.local/state/hardenkit/watch.json
--slack URLSend each alert to a Slack incoming webhook
--webhook URLSend each alert as JSON to an address
--report-to URLAlso send every scan to a HardenKit dashboard. Needs --project and HARDENKIT_TOKEN
--project IDThe dashboard project the reports belong to

--ignore-unfixed, --images, --no-db, --no-nvd, --no-ai, --no-k8s and --no-actions work as they do for hardenkit scan.

When something fails

If a scan fails, the error goes to standard error, the saved results for that target stay as they were, and the other targets are still scanned. If an alert cannot be delivered, the results are not saved, so the next pass sends it again.

With --once the exit code is 0 when every scan and every alert worked, also when alerts were sent, and 2 otherwise. Without --once the command runs until it is stopped, and then exits 0.

The webhook's JSON

--webhook gets one request per target that has something new or raised:

{
  "version": 1,
  "host": "web-1",
  "target": "/srv/app",
  "time": "2026-01-02T03:04:05Z",
  "first_run": false,
  "new": [
    {
      "id": "CVE-2023-44487",
      "package": "golang.org/x/net",
      "version": "0.1.0",
      "fixed_in": "0.17.0",
      "priority": "fix_now",
      "severity": "MEDIUM",
      "kev": true,
      "epss": 0.9321
    }
  ],
  "raised": [],
  "resolved": [],
  "summary": { "fix_now": 1, "fix_soon": 0, "plan": 0, "backlog": 12 }
}

new, raised and resolved are always lists of the same finding objects. fixed_in is empty when there is no fix yet, kev says whether the vulnerability is on CISA KEV, and epss is a probability from 0 to 1 or null. A raised finding also has previous_priority. summary counts all of the target's current findings. Any 2xx answer counts as delivered. version changes only if a field is removed or changes meaning.

A team dashboard

hardenkit watch is complete on its own. A hosted dashboard that shows every server and repository of a team in one view is in development and not open yet; join the waitlist to hear when it is.

When it opens, --report-to sends each scan to it. A report holds the host name, the target's name, the number of packages, and each finding's ID, package name and version, fixed version, priority and scores. It never holds source code, file contents or the paths of files inside the target.

On this page