Docker & Headless Hardening
headless-phone builds a first-class Docker environment straight into the kernel (kernel/headless.fragment) and Debian 13 rootfs (INSTALL_DOCKER=1).
Docker Engine Out of the Box
Section titled “Docker Engine Out of the Box”Every release image ships with docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, and docker-compose-plugin configured with /etc/apt/sources.list.d/docker.sources so sudo apt update && sudo apt upgrade keeps Docker current on-device.
- Kernel features baked in (
=y): Full container namespaces (PID_NS,USER_NS,IPC_NS,UTS_NS,NET_NS,SYSVIPC), unified cgroups v2 (systemd.unified_cgroup_hierarchy=1,CGROUP_BPF,CGROUP_PIDS,CFS_BANDWIDTH), OverlayFS,nftables/iptables-nft+ IPVS + IPv4/IPv6 NAT,BRIDGE_NETFILTER,VXLAN,MACVLAN,IPVLAN, andSECCOMP_FILTER. - Non-root Docker access: The default user (
pixel, or your customcloud-initadmin user) is automatically added to thedockergroup.
Verify Docker health anytime:
docker info --format 'Cgroup={{.CgroupDriver}} v{{.CgroupVersion}} Storage={{.Driver}} Kernel={{.KernelVersion}}'docker compose versionExposing Phone Hardware to Containers Safely
Section titled “Exposing Phone Hardware to Containers Safely”Rather than passing --privileged, prefer either host IPC bridges (like Frigate’s ZMQ TPU bridge and loopback RTSP publisher) or narrow device passthrough:
| Capability | Recommended Container Pattern |
|---|---|
| Edge TPU / Cameras / MFC | Keep tpu-ctl serve or camera-ctl in a host systemd unit and bind-mount a 0600 Unix socket (or loopback TCP) into an unprivileged container. |
| ARM64 KVM virtual machines | Pass --device /dev/kvm (/dev/kvm is 0660 root:kvm). |
| USB serial / Zigbee / Thread dongles | Pass --device /dev/serial/by-id/... (plugged into your USB-C dock/hub). |
| Unprivileged ICMP ping in containers | Already enabled host-wide via /etc/sysctl.d/90-headless-phone.conf (net.ipv4.ping_group_range = 0 2147483647). |
Headless Server Hardening Checklist
Section titled “Headless Server Hardening Checklist”The base image already locks the root password (passwd -l root), sets PermitRootLogin no and KbdInteractiveAuthentication no, strips SSH host keys and /etc/machine-id before flashing, and enables a 30-second hardware watchdog. For internet-facing or production LAN deployments, follow this checklist:
1. Lock Down SSH to Keys Only
Section titled “1. Lock Down SSH to Keys Only”If you didn’t pass --disable-password-auth at flash time, add your public key first, verify key login in a second terminal, and then disable password authentication via an early drop-in (OpenSSH uses first-match-wins, so 00-* overrides both 50-cloud-init.conf and 90-headless-phone.conf):
sudo tee /etc/ssh/sshd_config.d/00-key-only.conf >/dev/null <<'EOF'PasswordAuthentication noEOFsudo sshd -t && sudo systemctl reload sshsudo sshd -T | grep -i passwordauthentication # should print: passwordauthentication noAlso change or lock the default pixel password (passwd pixel or sudo passwd -l pixel if you don’t need serial ttyGS0 password login).
2. Enable a Docker-Safe nftables Host Firewall
Section titled “2. Enable a Docker-Safe nftables Host Firewall”nftables is preinstalled and kernel-supported.
Instead, confine host-input rules to a dedicated table (table inet headless_host) that never flushes Docker’s tables or touches the forward hook:
table inet headless_hostflush table inet headless_host
table inet headless_host { chain input { type filter hook input priority 0; policy drop;
iif "lo" accept ct state established,related accept ct state invalid drop
# ICMP / ICMPv6 (ping, PMTU, IPv6 neighbor discovery) ip protocol icmp accept ip6 nexthdr icmpv6 accept
# SSH + mDNS tcp dport 22 accept udp dport 5353 accept
# Optional: uncomment if running Frigate NVR (HTTPS UI + WebRTC) # tcp dport { 8971, 8555 } accept # udp dport 8555 accept }}Validate syntax before loading, then apply with a dedicated oneshot unit ordered after docker.service:
sudo mkdir -p /etc/nftables.d# (write /etc/nftables.d/headless-host.nft above)sudo nft -c -f /etc/nftables.d/headless-host.nftsudo nft -f /etc/nftables.d/headless-host.nft[Unit]Description=Load Docker-safe headless-phone host input firewallAfter=network-pre.target docker.service
[Service]Type=oneshotRemainAfterExit=yesExecStart=/usr/sbin/nft -f /etc/nftables.d/headless-host.nftExecReload=/usr/sbin/nft -f /etc/nftables.d/headless-host.nftExecStop=/usr/sbin/nft delete table inet headless_host
[Install]WantedBy=multi-user.targetsudo systemctl daemon-reloadsudo systemctl enable --now headless-firewall.service3. Monitor Power & Thermals with Prometheus
Section titled “3. Monitor Power & Thermals with Prometheus”Combine power-metrics with a systemd timer writing atomically to prometheus-node-exporter’s textfile collector:
[Unit]Description=Export headless-phone ODPM and battery metrics for Prometheus
[Service]Type=oneshotExecStart=/usr/local/sbin/power-metrics --interval 5 --prom-file /var/lib/prometheus/node-exporter/headless_power.prom[Unit]Description=Collect headless-phone ODPM power metrics every 30s
[Timer]OnBootSec=30sOnUnitActiveSec=30s
[Install]WantedBy=timers.targetsudo systemctl daemon-reloadsudo systemctl enable --now headless-power-prom.timer4. Keep Unattended Updates Clean & Safe
Section titled “4. Keep Unattended Updates Clean & Safe”- Debian & Docker security updates: Install
unattended-upgrades(sudo apt install unattended-upgrades) or runsudo apt update && sudo apt upgradeperiodically. - Kernel &
headless-phoneoverlay updates: Runos-upgrade checkandsudo os-upgrade apply --release latest --dry-runbefore applying over SSH. See On-Device OTA Updates.