From 2535344f3d57cd3e12b779cebc08cc3151dd69ef Mon Sep 17 00:00:00 2001 From: "K. Isom" Date: Sun, 4 Oct 2026 21:07:38 -0700 Subject: [PATCH] Restrict the robot's service ports to the USB link Audio (4713), MCP (8765) and the face webhook (8766) are accepted only on usb0 from 10.55.0.1 and dropped on every other interface, Wi-Fi included. SSH is left open on all interfaces for V2, by the owner's decision. Tested on the Pi with throwaway listeners: 8765 answers over usb0 and is unreachable over Wi-Fi, while a control port answers on both. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01AFN8nRRCiDiMN7ChBpHJhs --- CONTEXT.md | 6 ++++-- pi/nftables-robot.nft | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CONTEXT.md b/CONTEXT.md index 1570822..bc16a93 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -88,8 +88,10 @@ printed enclosure, speakers. Work until those arrive is limited to what the Pi, ## Next -1. Finish package 0b: nftables rewrite (accept 4713/8765 only on `usb0` from `10.55.0.1`), Wi-Fi-off - boot test, replug recovery, NixOS snippet in `host/nixos/`. +1. Finish package 0b: Wi-Fi-off boot test, replug recovery, serial login check, NixOS snippet in + `host/nixos/`, and make the firewall load at boot. A new Omarchy host with a GPU (runs the local + model "ornith") arrives this week: it needs only `host/omarchy/robot-usb-link.sh` and its SSH key + added to the Pi. 2. Audio (package 1; needs the `wm8960-soundcard` overlay and a reboot), camera (package 3), then the rest of the packages in `HANDOFF.md`. diff --git a/pi/nftables-robot.nft b/pi/nftables-robot.nft index a0abd95..c52aa84 100644 --- a/pi/nftables-robot.nft +++ b/pi/nftables-robot.nft @@ -1,6 +1,7 @@ #!/usr/sbin/nft -f -# Only your Omarchy machine may reach the robot's audio (4713) and MCP (8765) ports. -# Everything else, SSH included, is left alone. __HOST_IP__ is filled in by install.sh. +# The robot's audio (4713), MCP (8765) and face webhook (8766) ports are reachable only over the +# USB link, and only from the host at 10.55.0.1. Every other interface, Wi-Fi included, is dropped. +# SSH and everything else are left alone: that policy is the owner's call. table inet robot delete table inet robot @@ -9,7 +10,7 @@ table inet robot { chain input { type filter hook input priority 0; policy accept; iif "lo" accept - ip saddr __HOST_IP__ tcp dport { 4713, 8765 } accept - tcp dport { 4713, 8765 } drop + iifname "usb0" ip saddr 10.55.0.1 tcp dport { 4713, 8765, 8766 } accept + tcp dport { 4713, 8765, 8766 } drop } }