Fix: closing the web admin port to the internet also blocked Caddy
Confirmed live: a bare `ufw delete allow <port>` closes it on every interface, including the caddy_net bridge — Caddy's own request to host.docker.internal:PORT is ordinary INPUT-chain traffic as far as UFW is concerned, not something that bypasses it just because the source is a local container. Closing the port outright silently took Caddy's reverse-proxy path down with it. Added ufw_allow_from_caddy_net() to scope the port to caddy_net's own subnet instead of leaving it fully closed — reachable from Caddy, still closed to the public internet. Wired into both asterisk-digital-ocean.sh and asterisk.sh in place of the plain delete. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015X1jRGHwrvovz2qkhKfDZi
This commit is contained in:
@@ -187,6 +187,24 @@ you. No-ops if UFW is already active or not installed. Always allows SSH
|
||||
first (reading the real port from `sshd_config` in case it's non-default)
|
||||
before enabling, so this can't lock out the session running the installer.
|
||||
|
||||
### Closing a port to the internet without also closing it to Caddy
|
||||
|
||||
```bash
|
||||
ufw_allow_from_caddy_net PORT [PROTO] # PROTO defaults to tcp
|
||||
```
|
||||
|
||||
When `CADDY_SERVICE_MODE` is `"local"` (see above) and you `ufw delete
|
||||
allow` a port because Caddy fronts it now, don't stop there — UFW rules
|
||||
apply to *all* interfaces unless scoped, and Caddy's own request to
|
||||
`host.docker.internal:PORT` is ordinary INPUT-chain traffic arriving over
|
||||
the `caddy_net` bridge, not the public internet. A bare `ufw delete allow`
|
||||
blocks that too and silently breaks the service (confirmed live: closing
|
||||
the web admin port outright took Caddy down with it). Call
|
||||
`ufw_allow_from_caddy_net` right after the `delete` to re-open the port
|
||||
scoped to just `caddy_net`'s subnet — reachable from Caddy, not from the
|
||||
internet. See `services/asterisk-digital-ocean.sh` and
|
||||
`services/asterisk.sh` for the pattern.
|
||||
|
||||
### README generation
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user