server-audit.sh: a UFW rule to the server's own address counts as firewalled
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 62/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- bash
- Ambito
- security
Direzione di ricerca
Start in server-audit.sh at ufw_rule_fields and ufw_port_access, where a UFW To column is parsed and matched only against a port, a profile or Anywhere. Run tests/audit-ufw-ports.sh first; its cases "whole protocol to one destination address" and "rule with an IPv6 destination address" currently expect none. Done when a rule to one of the server's own addresses counts as exposed for the sockets listening there, a rule to an unowned address still counts as none, and the tests reflect this.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Milestone Next patch release · Priority medium · Size S · Depends on nothing · Agent-ready: an agent can pick it up
What happens
The audit's "Exposed TCP ports" check (ufw_port_access in server-audit.sh) matches a UFW rule only when its To column is a port, a profile or Anywhere. A rule with a destination address, such as
sudo ufw allow to 203.0.113.10 port 80 proto tcp
shows 203.0.113.10 80/tcp in To. That matches no port, so port 80 is listed as firewalled, even when 203.0.113.10 is the server's own public address and the port is open to the internet. The same happens for a whole protocol to one address (192.168.1.50/tcp) and for an IPv6 destination (2001:db8::1 2222/tcp).
Expected
A rule to one of the server's own addresses counts like a rule to Anywhere for the sockets that listen on that address (or on all addresses). A rule to an address the server does not have opens nothing, as today.
Where
server-audit.sh:ufw_rule_fieldsandufw_port_access.tests/audit-ufw-ports.sh: the cases "whole protocol to one destination address" and "rule with an IPv6 destination address" expectnonetoday, and should change with the fix.
Found during the review of #161 (issue #78). It is not a regression: main behaves the same. Servers set up only by server-prep are not affected, since its firewall step adds rules without a destination address.
Fix
-
ufw_rule_fields: split a To value that starts with a destination address (203.0.113.10 80/tcp,192.168.1.50/tcp,2001:db8::1 2222/tcp) into the address and the port spec, so the port spec is matched as today. - Read the server's own addresses once, in the main shell (
ip -o addr show), likeufw_cache_appsdoes for profiles, becauseufw_port_accessruns in$(...). -
ufw_port_access: take the socket's listening address as an extra argument. A rule to one of the server's own addresses matches likeAnywherewhen the socket listens on that address or on all addresses (0.0.0.0,::,*). A rule to an address the server does not have still matches nothing. The source and interface rules stay as they are (any/restricted). -
tests/audit-ufw-ports.sh: change the two cases that record today's behaviour ("whole protocol to one destination address", "rule with an IPv6 destination address (issue #162)"), and add cases for a rule to an address the server does not have (none) and a rule to the server's address from one source (restricted). -
CHANGELOG.mdline under### Fixed.
How to verify
bash -n server-audit.sh && shellcheck -S warning server-audit.sh
bash tests/audit-ufw-ports.sh
bash tests/exit-status.sh
# test server only: a port open to the server's own public address
sudo ufw allow to <server-public-ip> port 8080 proto tcp
python3 -m http.server 8080 &
sudo ./server-audit.sh --json a.json # 8080 is listed under internet-exposed, not firewalled
🤖 Automated by Claude Code (review-fixer routine). A maintainer reviews before anything is merged.
- Lingua principale
- Shell
- Stelle
- 2
- Fork
- 3
- Merge medio
- 2g 14m
- PR unite (30g)
- 47
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di exceev-consulting/server-prep
-
area: docs bug claude documentation good first issue priority: low size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
exceev-consulting/server-prep#225 ·
I maintainer di solito rispondono entro 2 giorni
-
area: preconfig bug claude priority: medium size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
exceev-consulting/server-prep#224 ·
I maintainer di solito rispondono entro 2 giorni
-
claude enhancement priority: low size: S
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
exceev-consulting/server-prep#222 ·
I maintainer di solito rispondono entro 2 giorni
-
e2e flake: boot fails on debian-13 when its genericcloud image is missing from SHA512SUMSForse già presa @exceev-claude l’ha presa 1 giorno fa. Apertaarea: ci bug claude priority: high size: S
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
exceev-consulting/server-prep#212 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
server-audit.sh: flag world-writable directories in /etc such as /etc/dokploy (GHSA-qxjv-6cvh-32c6)Apertaarea: audit claude enhancement panel: dokploy priority: high security size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
exceev-consulting/server-prep#211 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di exceev-consulting/server-prep
Issue simili
-
bot-found documentation priority: P3
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
madenvel/KalinkaPlayer#602 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/kernels#1006 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 94/100
I maintainer di solito rispondono entro 2 giorni
-
severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
luainkernel/lunatik#2594 ·
I maintainer di solito rispondono entro 1 giorno