Skip to content
MouseWerkPublic

About

Self-hosted Linux, Podman and Caddy control plane for RHEL and Debian/Ubuntu

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OpsPulse

Self-hosted control plane for a single Linux server: Podman containers and quadlets, Caddy, systemd units and the journal, host telemetry, update and reboot radar, firewall and SELinux status, SSH sessions and failed logins, cron/backup heartbeats, a TLS certificate radar, config-drift watching, an internal file drop, a webhook relay and an append-only audit log.

Built and tested for the RHEL family (RHEL, Rocky Linux, AlmaLinux, Fedora Server) and Debian/Ubuntu. The user interface is in German.

Architecture

            Browser ── HTTPS ── Caddy ── 127.0.0.1:7480
                                           │
 ┌─────────────────────────────────────────┴───────────────────────┐
 │ opspulse-server  (rootless Podman container, no capabilities)   │
 │  web UI (embedded) · REST/SSE API · SQLite (WAL) · workers      │
 └───────┬───────────────────────────────┬─────────────────────────┘
         │ podman.sock (Podman API)      │ /run/opspulse/agent.sock
         ▼                               ▼  typed JSON frames, no shell strings
     Podman                  opspulse-agent  (systemd service, root, hardened)
                             systemd/D-Bus · journalctl · caddy · dnf/apt
                             firewalld/ufw/nftables · SELinux · login1
  • opspulse-server never touches the host directly. Everything privileged goes through the agent.
  • opspulse-agent has no network port. It accepts only the typed requests defined in crates/shared/src/protocol.rs; identifiers (unit names, user names, quadlet files, paths) are validated while the frame is decoded. External programs run with a fixed argument list, an empty environment, a timeout and an output cap. Writing actions are off until allow_mutations = true.
  • Every change (config, unit action, Caddy reload, login) lands in a hash-chained audit log that the database refuses to update or delete.
Path Contents
crates/shared IPC protocol, validated names, framing
crates/agent host agent
crates/server server, migrations in crates/server/migrations
frontend React 19, TypeScript, Vite, Tailwind CSS v4
design design concept, tokens, mockups
deploy quadlet, systemd unit, agent config example, install script
docs/api.md API reference
docs/kalzit.md dashboard export (Kalzit HTTP JSON source, Prometheus)

Installation

Requirements: Podman 4.4 or newer (quadlets), crun, systemd. Run everything as root from a checkout of this repository.

RHEL, Rocky Linux, AlmaLinux, Fedora

dnf install -y git podman crun policycoreutils-python-utils
git clone https://github.com/MouseWerk/opspulse.git && cd opspulse
deploy/install.sh --build

SELinux stays enforcing. What the script and the files do about it:

  • The data volume is mounted with :Z (private label container_file_t for this container only).

  • The container reaches two host sockets (Podman API and agent). container_t may not connectto host domains, so the quadlet sets SecurityLabelDisable=true for this one container. It still runs rootless, read-only, without capabilities and with no-new-privileges. If you prefer to keep the label, load a small module instead and remove that line:

    module opspulse 1.0;
    require { type container_t; type container_runtime_t; type unconfined_service_t; class unix_stream_socket connectto; }
    allow container_t container_runtime_t:unix_stream_socket connectto;
    allow container_t unconfined_service_t:unix_stream_socket connectto;
    

    checkmodule -M -m -o opspulse.mod opspulse.te && semodule_package -o opspulse.pp -m opspulse.mod && semodule -i opspulse.pp

  • The agent binary is relabelled with restorecon after installation. If you keep the Caddyfile in a non-default place, give it the right type: semanage fcontext -a -t httpd_config_t '/srv/caddy(/.*)?' && restorecon -R /srv/caddy. The agent runs restorecon -F after every file it writes.

  • Shared volumes for several containers use :z (lower case) instead of :Z.

Updates are read with dnf check-update and dnf updateinfo --security (dnf4 and dnf5); the reboot check uses dnf needs-restarting -r and compares the running with the newest kernel. The firewall view reads firewalld (zones, services, ports, rich rules); auth logs come from the journal with /var/log/secure as fallback.

Debian, Ubuntu

apt-get install -y git podman crun uidmap dbus-user-session
git clone https://github.com/MouseWerk/opspulse.git && cd opspulse
deploy/install.sh --build

Updates come from apt list --upgradable (security updates are those from a *-security suite), the reboot check reads /var/run/reboot-required and .pkgs. The firewall view shows ufw and nftables; auth logs come from the journal with /var/log/auth.log as fallback. AppArmor needs no extra rules.

What install.sh does

  1. creates the group opspulse and the user opspulse (subuids, linger),
  2. builds the image (--build) or uses --image, and copies the agent binary out of it,
  3. installs /usr/local/bin/opspulse-agent, /etc/opspulse/agent.toml (read only, with the UID of the service user in allowed_peer_uids) and opspulse-agent.service,
  4. enables the user's Podman socket, creates the Podman secret opspulse-secret-key,
  5. installs ~opspulse/.config/containers/systemd/opspulse.container and starts it.

The first admin account is admin; its start password is printed once to the log:

journalctl --user -M opspulse@ -u opspulse | grep 'initial admin'

You must set a new password at the first login.

Hosts without internet access

OpsPulse needs no internet connection at runtime: the web interface, fonts and editor are part of the binary, and nothing is loaded from a CDN (npm run check:offline in frontend/ checks the build).

Each release carries a complete offline bundle, opspulse-offline-<version>-x86_64.tar.gz: the container image, deploy/ with install.sh, and INSTALL-OFFLINE.md with the steps for Podman and Docker. Copy it to the host, then:

tar -xzf opspulse-offline-v0.2.1-x86_64.tar.gz && cd opspulse-offline-v0.2.1-x86_64
sha256sum -c SHA256SUMS
sudo deploy/install.sh --image-archive opspulse-image.tar

The image alone is attached as opspulse-image-<version>.tar.gz (docker load / podman load read it directly). To build it yourself on a connected machine:

podman build -t localhost/opspulse:latest -f Containerfile .
podman save -o opspulse.tar localhost/opspulse:latest
deploy/install.sh --image-archive opspulse.tar   # on the offline host

The agent binary is taken out of the image, so the offline host needs neither Rust nor Node. Update and security checks then report what the local mirror (dnf/apt) offers; without a mirror the lists stay empty instead of failing.

Reverse proxy

The container publishes only 127.0.0.1:7480. A Caddy site in front of it:

ops.example.internal {
	reverse_proxy 127.0.0.1:7480
}

With HTTPS in front keep OPSPULSE_COOKIE_SECURE=true and OPSPULSE_TRUST_PROXY=true. For direct HTTP access (only inside a VPN), set OPSPULSE_COOKIE_SECURE=false and publish on the VPN address, never on 0.0.0.0: published container ports bypass ufw and firewalld.

Configuration

Server (environment)

Variable Default Meaning
OPSPULSE_SECRET_KEY (required) 32 bytes, base64; encrypts notification credentials
OPSPULSE_LISTEN 0.0.0.0:7480 listen address in the container
OPSPULSE_DATA_DIR /data SQLite file and file-drop storage
OPSPULSE_AGENT_SOCKET /run/opspulse/agent.sock
OPSPULSE_PODMAN_SOCKET /run/podman/podman.sock Unix socket or tcp://host:port (e.g. a read-only socket proxy); empty disables the container module
OPSPULSE_PUBLIC_URL (from Host header) base for ping URLs and short links
OPSPULSE_COOKIE_SECURE true
OPSPULSE_TRUST_PROXY false use X-Forwarded-For/-Proto from the proxy in front
OPSPULSE_READ_ONLY false disables every action that changes the host
OPSPULSE_ADMIN_USERNAME / OPSPULSE_ADMIN_PASSWORD admin / random first account, only if there is none
OPSPULSE_MAX_UPLOAD_MB 1024 file-drop limit
OPSPULSE_SESSION_IDLE_HOURS 12
OPSPULSE_LOG, OPSPULSE_LOG_FORMAT info, json

Agent (/etc/opspulse/agent.toml)

See deploy/agent.toml.example. The important switches:

  • allow_mutations: off by default. Unit actions, Caddy apply, quadlet writes and daemon-reload are refused until you turn it on.
  • unit_allowlist: units that may be started, stopped, restarted or reloaded.
  • quadlet_users: users whose rootless quadlets and user units the agent may touch.
  • drift_paths: files the config-drift watcher may read.

opspulse-agent --config /etc/opspulse/agent.toml --check-config validates the file.

Heartbeats

Every heartbeat has a secret ping URL:

# success
curl -fsS -m 10 --retry 3 -o /dev/null https://ops.example.internal/api/v1/ping/<uuid>
# start (enables runtime measurement), failure, exit code with log excerpt
curl -fsS https://ops.example.internal/api/v1/ping/<uuid>/start
curl -fsS https://ops.example.internal/api/v1/ping/<uuid>/fail
backup.sh > /tmp/backup.log 2>&1; curl -fsS --data-binary @/tmp/backup.log https://ops.example.internal/api/v1/ping/<uuid>/$?

For cron jobs, deploy/opspulse-ping sends the exit code and never fails the job itself:

install -m 0755 deploy/opspulse-ping /usr/local/bin/opspulse-ping
# crontab: run the job, then report its exit code
0 3 * * * /usr/local/bin/backup.sh; /usr/local/bin/opspulse-ping <uuid> $?

Set OPSPULSE_PING_BASE if OpsPulse is not on 127.0.0.1:7480. A job that reboots the host must ping before systemctl reboot.

Containers managed by Docker

OpsPulse speaks the Docker-compatible API, so it can also watch and control a Docker host. Do not mount the Docker socket: it grants root. Put a filtering proxy in front of it. deploy/docker-socket-proxy.cfg allows exactly what OpsPulse needs: reading containers (list, details, stats, logs) and start, stop and restart. Create, delete, exec, kill, images, networks and volumes are refused. The stock POST=1 switch of the proxy image would allow all of those.

install -m 0644 deploy/docker-socket-proxy.cfg /etc/opspulse/docker-socket-proxy.cfg
docker run -d --name opspulse-sockproxy --restart unless-stopped -p 127.0.0.1:2375:2375 \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v /etc/opspulse/docker-socket-proxy.cfg:/usr/local/etc/haproxy/haproxy.cfg.template:ro \
  tecnativa/docker-socket-proxy
# server: OPSPULSE_PODMAN_SOCKET=tcp://127.0.0.1:2375 (container with Network=host)

For read-only access remove the control line from the proxy config, or set OPSPULSE_READ_ONLY=true.

Development

cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

cd frontend
npm ci
npm run dev            # proxies /api to 127.0.0.1:7481
npm run build          # typecheck, lint, production build into dist/
npm test               # unit tests (style guards)
npm run check:offline  # fails if the build references an external host

The server embeds frontend/dist at compile time; build the frontend first.

Distribution and SELinux tests

tools/distro-test/run.sh <static agent> runs the agent in throwaway containers against Rocky Linux 9 (dnf4), Fedora 42 (dnf5), Ubuntu 24.04 (apt) and a live firewalld. tools/selinux-vm/run.sh <static agent> boots the official Rocky Linux 9 cloud image with SELinux enforcing in QEMU (inside a container, needs /dev/kvm) and compares the agent's SELinux status, file contexts and systemd access with sestatus, ausearch and ls -Z. Neither installs anything on the host.

Layout tests

npm run test:e2e drives Chromium through every screen at six widths (360 to 1920 px) in both themes: console and network errors, horizontal scrolling, overlapping elements, hover over every control (tooltips inside the viewport, no layout shift), focus rings, truncated text without full text, dialogs, drawers, the command palette and toasts. It needs a running server and an admin login; it creates its own test data (prefix e2e-) and removes it afterwards, and it never presses a button that changes the host.

npx playwright install chromium
OPSPULSE_E2E_URL=http://127.0.0.1:7481 OPSPULSE_E2E_USER=admin OPSPULSE_E2E_PASSWORD=... npm run test:e2e

Run it against a server with OPSPULSE_READ_ONLY=true.

License

OpsPulse is free software under the GNU Affero General Public License v3.0 or later. If you run a modified version as a network service, you must offer its source code to its users.

About

Self-hosted Linux, Podman and Caddy control plane for RHEL and Debian/Ubuntu

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages