Steward 0.1.0 (in development): a DHCPv4 server with a web UI, API and CLI
Subnets served per interface, pools, reservations, options at three levels, leases in SQLite saved before the ACK, ping and decline conflict checks, validated changes with history and undo, users and tokens, an audit log, a Kea importer, a sandboxed systemd unit and Debian packages. Tested with real udhcpc and dhcpcd clients in Docker (scripts/e2e.sh). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
3c0808591f
111 files changed
+17851
No files matched your search
@@ -0,0 +1,16 @@
|
||||
Package: steward-cli
|
||||
Version: @VERSION@
|
||||
Architecture: @ARCH@
|
||||
Maintainer: @MAINTAINER@
|
||||
Installed-Size: @SIZE@
|
||||
Section: net
|
||||
Priority: optional
|
||||
Description: command line client for Steward, the DHCP server
|
||||
steward is the command line client for Steward servers (stewardd):
|
||||
subnets, pools, reservations, options, leases and DHCP activity, the
|
||||
history of changes with undo, users and tokens, and importing Kea.
|
||||
It talks to stewardd's REST API with an API token, or, on the server
|
||||
itself, to stewardd's local socket.
|
||||
.
|
||||
Install this package alone to manage Steward from another machine; the
|
||||
steward package (the server) depends on it.
|
||||
@@ -0,0 +1,21 @@
|
||||
Package: steward
|
||||
Version: @VERSION@
|
||||
Architecture: @ARCH@
|
||||
Maintainer: @MAINTAINER@
|
||||
Installed-Size: @SIZE@
|
||||
Depends: systemd, steward-cli (= @VERSION@)
|
||||
Section: net
|
||||
Priority: optional
|
||||
Description: DHCPv4 server with a web UI, a REST API and a CLI
|
||||
Steward is a DHCPv4 server: subnets served per network interface, pools,
|
||||
reservations and options, with leases kept in SQLite. It is configured
|
||||
through a web UI, a REST API and the steward command line client. Every
|
||||
change is validated as a whole before it is used, and recorded in a
|
||||
history where it can be undone. Users and API tokens have permissions,
|
||||
and every change is audited. It can import a Kea configuration and its
|
||||
leases.
|
||||
.
|
||||
This package is the server: stewardd (as the systemd service steward)
|
||||
with its daily backup timer. The steward CLI comes from steward-cli,
|
||||
which can also be installed on its own on other machines. stewardd isn't
|
||||
started on a first install: see /usr/share/doc/steward/docs/install.md.
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# Steward: runs after the package's files are in place.
|
||||
set -e
|
||||
|
||||
if [ "$1" = configure ]; then
|
||||
# The steward system user and Steward's directories: /etc/steward,
|
||||
# /var/lib/steward and /var/backups/steward.
|
||||
systemd-sysusers steward.conf
|
||||
systemd-tmpfiles --create steward.conf || true
|
||||
|
||||
# An example configuration on the first install; an existing one is
|
||||
# never touched.
|
||||
if [ ! -e /etc/steward/steward.yaml ]; then
|
||||
/usr/bin/stewardd config --example > /etc/steward/steward.yaml.dpkg-new
|
||||
chown root:steward /etc/steward/steward.yaml.dpkg-new
|
||||
chmod 0640 /etc/steward/steward.yaml.dpkg-new
|
||||
mv /etc/steward/steward.yaml.dpkg-new /etc/steward/steward.yaml
|
||||
fi
|
||||
|
||||
# The daily database backup (steward-backup.timer) is on by default. An
|
||||
# administrator's 'systemctl disable steward-backup.timer' is remembered
|
||||
# by deb-systemd-helper and kept across upgrades. Before 'stewardd init'
|
||||
# the backup skips itself (there is no database yet).
|
||||
if command -v deb-systemd-helper >/dev/null 2>&1; then
|
||||
deb-systemd-helper unmask steward-backup.timer >/dev/null || true
|
||||
if deb-systemd-helper --quiet was-enabled steward-backup.timer; then
|
||||
deb-systemd-helper enable steward-backup.timer >/dev/null || true
|
||||
else
|
||||
deb-systemd-helper update-state steward-backup.timer >/dev/null || true
|
||||
fi
|
||||
elif [ -z "$2" ] && [ -d /run/systemd/system ]; then
|
||||
systemctl enable steward-backup.timer >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload || true
|
||||
if systemctl is-enabled --quiet steward-backup.timer 2>/dev/null; then
|
||||
systemctl start steward-backup.timer || true
|
||||
fi
|
||||
# An upgrade restarts a running stewardd (its database is upgraded
|
||||
# when it starts). A first install starts nothing: Steward needs
|
||||
# 'stewardd init' first.
|
||||
if [ -n "$2" ] && systemctl is-active --quiet steward.service; then
|
||||
systemctl restart steward.service || echo "steward: restarting stewardd failed; see 'journalctl -u steward'" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
echo "Steward is installed. Next: create the database and start it, as described"
|
||||
echo "in /usr/share/doc/steward/docs/install.md:"
|
||||
echo " sudo -u steward stewardd init && sudo systemctl enable --now steward"
|
||||
echo "Stop any other DHCP server first (Kea, dnsmasq, isc-dhcp-server): only one"
|
||||
echo "can listen on an interface's port 67. 'steward import kea' brings Kea's setup over."
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# Steward: runs after the package's files are removed.
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
remove|purge)
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload || true
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# The backup timer's enabled state (see postinst): masked while the
|
||||
# package is removed, forgotten on purge.
|
||||
if command -v deb-systemd-helper >/dev/null 2>&1; then
|
||||
case "$1" in
|
||||
remove)
|
||||
deb-systemd-helper mask steward-backup.timer >/dev/null || true
|
||||
;;
|
||||
purge)
|
||||
deb-systemd-helper purge steward-backup.timer >/dev/null || true
|
||||
deb-systemd-helper unmask steward-backup.timer >/dev/null || true
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Even a purge keeps Steward's data: the database in /var/lib/steward holds
|
||||
# the configuration and the leases. Remove it by hand when you no longer
|
||||
# need it.
|
||||
if [ "$1" = purge ]; then
|
||||
echo "steward: kept /etc/steward, /var/lib/steward and /var/backups/steward;"
|
||||
echo "remove them by hand if unused."
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Steward: runs before the package's files are removed (also on upgrades).
|
||||
set -e
|
||||
|
||||
# On removal (not on upgrade) stop stewardd and the backup timer and remove
|
||||
# stewardd's boot-time link (postrm deals with the timer's). Clients keep
|
||||
# their addresses until their leases run out.
|
||||
if [ "$1" = remove ] && [ -d /run/systemd/system ]; then
|
||||
systemctl stop steward.service steward-backup.timer steward-backup.service 2>/dev/null || true
|
||||
systemctl disable steward.service 2>/dev/null || true
|
||||
if ! command -v deb-systemd-helper >/dev/null 2>&1; then
|
||||
systemctl disable steward-backup.timer 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user