Start
How the parts connect#
This page shows which parts can talk to each other and which are kept apart on purpose. Come back to it whenever you're unsure whether something should be reachable.
Solid arrow = allowed. Dashed arrow ending in × = blocked.
1. Getting into the server#
flowchart TB
NET(("The internet"))
WIFI["A device on your<br/>home Wi-Fi"]
TS["Your devices on Tailscale<br/>(home or away)"]
subgraph SRV["Home server"]
SSH["SSH<br/>port 22"]
SMB["File sharing<br/>port 445"]
AI["AI model<br/>127.0.0.1:8095"]
end
NET -. "router forwards nothing" .-x SRV
WIFI -- "allowed" --> SSH
WIFI -. "blocked by firewall" .-x SMB
TS -- "allowed" --> SSH
TS -- "allowed" --> SMB
TS -. "not directly" .-x AI
2. Inside the server#
flowchart TB
YOU["You, logged in with SSH"]
subgraph SRV["Home server"]
AG["Agent system<br/>127.0.0.1:8097<br/>(your account)"]
subgraph AIACC["'ai' account"]
AI["AI model<br/>127.0.0.1:8095"]
end
SMB["File sharing"]
F[("/srv/files")]
B[("/srv/backup")]
end
NET(("The internet"))
YOU -- "SSH tunnel" --> AI
YOU -- "SSH tunnel" --> AG
AG -- "asks" --> AI
SMB --> F
F -- "nightly backup" --> B
AI -. "blocked" .-x NET
AI -. "can't read" .-x F
Who can reach what#
| From | To | Allowed? | Why |
|---|---|---|---|
| The internet | anything on the server | No | The router forwards nothing to the server |
| A device on your home Wi-Fi | SSH (port 22), .local name (5353) |
Yes | The firewall allows these two (Chapter 12; only from your home network range after Chapter 29) |
| A device on someone else's network (café, work) | SSH | No (after Chapter 29) | SSH is allowed only from home and Tailscale |
| A device on your home Wi-Fi | File sharing (445) | No | Not allowed in the firewall. Use Tailscale, or add the optional rule in Chapter 16 |
| Your devices on Tailscale | SSH, file sharing | Yes | Tailscale lets its own traffic through (Chapter 14) |
| Any other computer, even on Tailscale | AI model, agent system | No | They only listen on 127.0.0.1, which means "this computer only" |
| You, through an SSH tunnel | AI model, agent system | Yes | The tunnel makes your request arrive from inside the server (Chapter 23) |
| Agent system | AI model | Yes | Both are on the same computer |
| Any other computer | Cockpit dashboard (9090) | No | Listens on 127.0.0.1 only (Chapter 32) |
| You, through an SSH tunnel | Cockpit dashboard | Yes | Same tunnel method as the AI |
| Someone guessing SSH logins | SSH | Banned after 5 failures | Fail2ban (Chapter 31) |
AI model (the ai account) |
The internet | No | Blocked by the network guard (Chapter 22) |
| AI model | Your shared files in /srv/files |
No | The ai account can only read its own model folder |
| Server | The internet (outgoing) | Yes | Needed for updates and Tailscale |
| Backup job | /srv/files → /srv/backup |
Yes | Runs nightly as the system (Chapter 17) |
What 127.0.0.1 means#
127.0.0.1 (also called localhost or loopback) is every computer's address for itself. A program listening there can't be reached from the network at all, not even from your own Mac. That's why the AI parts use it.
flowchart LR
subgraph SRV["Server"]
P["Program on the server"] -- "127.0.0.1:8095" --> M["AI model"]
end
O["Any other computer"] -. "127.0.0.1 always means itself" .-x M
The one way in for the AI: an SSH tunnel#
flowchart LR
B["Browser on your Mac<br/>http://127.0.0.1:18095"] --> T["ssh -L tunnel<br/>(encrypted)"]
T --> S["Server: arrives<br/>as 127.0.0.1"] --> M["AI model :8095"]
The tunnel only exists while the ssh -L command is running in a terminal window. Close the window and the door closes too. Chapter 23 shows the commands.
Things to remember#
- Never add port forwarding on your router. Everything here is designed to work without it.
- Docker ignores the firewall. If you run containers later, publish their ports on
127.0.0.1or the Tailscale address only. - Separate accounts keep parts apart: your user (
alex), the system (root) and the AI (ai) can't read each other's private folders.