Files
housecarl/deploy/systemd/housecarl.service
abrown38andClaude Opus 5.5 34292eeebb Build Housecarl 0.1.0: the nftables firewall manager
Zones, address sets (IPv4 and IPv6 mixed, dynamic sets with timeouts) and
services, ordered rules in the early, input, forward and output chains,
port forwards with hairpin NAT and IPv6 pinholes, source NAT, redirects,
and switchable built-ins (loopback, conntrack, ICMPv6, antispoofing, MSS
clamping, DHCPv6 client, flowtable). Every change is validated, checked
with nft -c and applied in one transaction to Housecarl's own table,
inet housecarl; changes made over the network roll back unless
confirmed, and the confirmed ruleset is loaded at boot by
housecarl-ruleset.service. An empty configuration applies nothing.

Also: hit counters and the drop log (nflog), 'hc import' of an existing
nftables ruleset and 'hc takeover', the hc CLI, the REST API and the web
UI, users, scoped tokens (sets:write:NAME), the audit log, the web UI's
certificate through Jarl, Debian packages, docs, unit tests with real
nft 1.1.3, and an e2e test with real traffic (71 checks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 07:57:14 +01:00

64 lines
2.0 KiB
Desktop File

# Housecarl: keeps the firewall's nftables ruleset; its REST API and web UI.
# Installed as /etc/systemd/system/housecarl.service (see docs/install.md).
[Unit]
Description=Housecarl firewall manager (with web UI and API)
Documentation=file:///usr/local/share/doc/housecarl/README.md
# The confirmed ruleset is already in force from housecarl-ruleset.service.
After=housecarl-ruleset.service network-online.target
Wants=network-online.target
[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/local/bin/housecarld --config /etc/housecarl/housecarl.yaml serve
# SIGHUP rereads the TLS certificate.
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=2s
User=housecarl
Group=housecarl
UMask=0027
# /var/lib/housecarl: the database and the confirmed ruleset (ruleset.nft).
StateDirectory=housecarl
StateDirectoryMode=0750
ConfigurationDirectory=housecarl
ConfigurationDirectoryMode=0750
# /run/housecarl: the local API socket (housecarl.sock), for root and the
# housecarl user.
RuntimeDirectory=housecarl
RuntimeDirectoryMode=0750
# Sandboxing: housecarld writes only its own state.
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
NoNewPrivileges=yes
# The only privilege housecarld gets: changing nftables (it runs nft) and
# reading logged packets (nfnetlink_log), both CAP_NET_ADMIN.
CapabilityBoundingSet=CAP_NET_ADMIN
AmbientCapabilities=CAP_NET_ADMIN
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
ProtectClock=yes
ProtectHostname=yes
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
LockPersonality=yes
MemoryDenyWriteExecute=yes
# AF_NETLINK: nftables, logged packets, the interfaces and their addresses.
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallErrorNumber=EPERM
[Install]
WantedBy=multi-user.target
# 'systemctl restart housecarld' works too (the daemon's binary is housecarld).
Alias=housecarld.service