Version 1.0.0

The CameraRisk monitor.

One file of JavaScript, no dependencies, for Node.js 18 or later or Docker. It checks the cameras you add on your own network and reports only whether each one answered. Read it before you run it.

$ node camerarisk-agent.mjs test"Front door" (K7Q2M9XDPA): answers (12 ms). Stream: video track found."Driveway" (P4W8N2RTHE): answers (9 ms). Stream: the stream refused the user name and password."Garage" (Q3J6V1XKMB): did not answer: no answer within 2 seconds.Nothing was sent to CameraRisk.
Example output for three cameras. test checks them from your computer and sends nothing; run does the same about once a minute and reports only the result.

01Verify

Check the download.

The SHA-256 of each file. A match proves the download is complete and unchanged since it left this site; it cannot protect against a compromised site, so read the file too.

FileSHA-256
camerarisk-agent.mjs50ae7d4d14061d8958d3db20be0800c1db898c70894dd36805fe392ae7097e44
camerarisk-agent.Dockerfilec082666b9dd7fac47fc024183b670e6d287b03a9149efb7ac824f5a68d13bdac
compose.yaml74827a39ee1370d2328e7b5b5ad9519c5fc5c900114c9ac909c6cd10525cc4d1

Linux

Checks every file you downloaded, and says OK for each.

Terminal
curl -fsSLO https://camerarisk.com/agent/camerarisk-agent.mjs
curl -fsSLO https://camerarisk.com/agent/SHA256SUMS.txt
sha256sum --check --ignore-missing SHA256SUMS.txt

macOS

Compare the result with the line for the file above.

Terminal
shasum -a 256 camerarisk-agent.mjs

Windows

Compare the result with the line for the file above.

PowerShell
Get-FileHash camerarisk-agent.mjs -Algorithm SHA256

02Set up

Pair it, add cameras, start it.

Get a pairing code on your monitoring page first. It works once, for 15 minutes.

Live monitoring is not open yet. The monitor’s test command already works on your own network, and we can email you once, when Live Watch opens. Ask for that email.

  1. Pair

    Terminal
    node camerarisk-agent.mjs pair ABCD-EFGH --name "Home monitor"
  2. Add a camera

    In a terminal it asks for the name, the camera’s address on your network, the stream path and port from its manual, and the sign-in (the password is not shown as you type). Or use flags, with the password on standard input:

    Terminal
    node camerarisk-agent.mjs add
    printf %s "$CAMERA_PASSWORD" | node camerarisk-agent.mjs add --name "Front door" \
      --host 192.168.1.20 --port 554 --path /stream1 --username viewer --password-stdin
  3. Test, without sending anything

    Terminal
    node camerarisk-agent.mjs test
  4. Run

    Terminal
    node camerarisk-agent.mjs run

    Cameras appear on your monitoring page after the first report. Other commands: list, remove, version, help.

03Keep it running

On a Pi, a NAS or a computer that stays on.

Raspberry Pi or Linux (systemd)

With camerarisk-agent.mjs in your home folder, paired and with cameras added as your own user. Logs: journalctl -u camerarisk-agent -f

Terminal
sudo tee /etc/systemd/system/camerarisk-agent.service >/dev/null <<EOF
[Unit]
Description=CameraRisk monitor
Wants=network-online.target
After=network-online.target

[Service]
User=$USER
ExecStart=$(command -v node) $HOME/camerarisk-agent.mjs run
Restart=always
RestartSec=30
NoNewPrivileges=yes

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now camerarisk-agent

A NAS or any Docker host

The image runs as the unprivileged node user; the config stays in the named volume. Cameras with .local names: use their IP addresses, or add --network host, because mDNS does not reach Docker’s default network.

Terminal
docker build -f camerarisk-agent.Dockerfile -t camerarisk-agent .
docker run --rm -it -v camerarisk-agent:/config camerarisk-agent pair ABCD-EFGH
docker run --rm -it -v camerarisk-agent:/config camerarisk-agent add
docker run -d --name camerarisk-agent --restart unless-stopped \
  -v camerarisk-agent:/config camerarisk-agent

An always-on Mac or Windows computer

Docker Desktop works as above. Without Docker, leave it running in a terminal, or start it at login with your system’s scheduler. A computer that sleeps stops reporting, and you get a “monitor stopped reporting” email.

Terminal
node camerarisk-agent.mjs run

04Configuration

Where things are, and what results mean.

Config file
~/.camerarisk/agent.json, or the path in CAMERARISK_CONFIG. It holds the monitor’s key and your cameras with their passwords, so it is written readable by your user only (mode 0600), and narrowed again if anyone widens it.
Server
https://camerarisk.com. CAMERARISK_ORIGIN changes it (https only).
Cameras
Up to 10 per monitor, and up to 5 monitors per account. Your plan decides how many CameraRisk watches: 1 as a connection test, 3 with Live Watch. The others show as not monitored.
Addresses
Private networks only: 10.x, 172.16–31.x, 192.168.x, 100.64–127.x, 169.254.x, 127.x, IPv6 unique-local and link-local, and names ending in .local, .home.arpa, .lan or .internal that resolve to those.
CodeMeaning
timeoutNo answer within 2 seconds (5 for the stream)
refusedConnection refused: nothing answers on that port
unreachableNo route to the camera from the monitor
name_not_resolvedIts .local name did not resolve
not_privateIts name resolved outside your network, so it was not contacted
network_errorA network error on the monitor’s computer
not_rtspThat port did not answer as an RTSP stream
bad_responseAn answer the monitor could not read
redirectThe stream pointed elsewhere; the monitor does not follow it
auth_requiredThe stream needs a user name and password
auth_failedThe stream refused the user name and password
no_videoThe stream described no video track
rtsp_errorThe stream answered with an error

05Update or remove

Leave nothing behind.

Update

Download the new file, check it against the new SHA256SUMS.txt, replace the old one, and restart the monitor. The config stays.

Terminal
sudo systemctl restart camerarisk-agent

Uninstall

Stop it, then delete the config: it holds your camera passwords. Then remove the monitor on your monitoring page: its key stops working and its cameras’ history is deleted.

Terminal
sudo systemctl disable --now camerarisk-agent
sudo rm /etc/systemd/system/camerarisk-agent.service
rm -r ~/.camerarisk camerarisk-agent.mjs

# or, with Docker
docker rm -f camerarisk-agent
docker volume rm camerarisk-agent

Email me when it opensHow monitoring works