Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Caddy L4 cannot close non-SMTP probes on 25 and 587 without stalling banner-first clients

Aperta Adatta ai principianti
#410 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva

Direzione di ricerca

Parti da deploy/k8s/caddy/Caddyfile, righe 30-48: la modifica consiste nel rimuovere i matcher @x http e @x tls e la loro route close su :25 e :587 in modo che quelle porte effettuino il proxy incondizionatamente, secondo la conclusione dell'issue. Verifica incrociato il comportamento dichiarato di caddy-l4 (layer4/routes.go ErrMatchingTimeout e il guard di fallback senza matcher) rispetto alla configurazione che rimuovi, e registra l'esito della missione secondaria dell'issue #409. Completato significa che il Caddyfile non contiene più matcher data su 25/587 e che la nota del piano riflette che il filtraggio a livello di proxy deve provenire da CrowdSec/nginx/HAProxy invece.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement real sec

The planned Caddy close rules for non-SMTP probes drop every real SMTP client. Step 2 of #409 (@x http and @x tls plus close on 25 and 587) cannot ship as written.

What I measured

A layer4 data matcher before the proxy route makes caddy-l4 read the first bytes of the client before it forwards the connection. A router with a matcher that still needs data skips the matcherless fallback. Real SMTP clients wait for the banner, so no bytes arrive. The 3 s matching_timeout hits, and the server closes the connection instead of proxying it.

I built Caddy v2.11.7 with github.com/mholt/caddy-l4 and ran the planned config in front of a banner-first backend:

:18025 {
	@http http
	@tls tls
	route @http @tls {
		close
	}
	route {
		proxy 127.0.0.1:18026
	}
}
Client Result
Passive client, waits for the banner (all real SMTP clients) closed after 3.00 s, no banner
HTTP probe closed immediately
TLS probe closed after 3.00 s
Pre-greet EHLO (10+ bytes on one line) proxied, got the banner

caddy-l4's RouteList.Compile returns nil on ErrMatchingTimeout (layer4/routes.go). Server.handle closes every connection it returns nil for (layer4/server.go). The matcherless fallback route is skipped while an earlier matcher reports ErrConsumedAllPrefetchedBytes (layer4/routes.go, the len(route.matcherSets) == 0 guard). No ordering saves the connection.

What follows

Keep :25 and :587 proxying unconditionally. The non-SMTP probe cost stays. The app-level guard from this work is what bounds it: per-IP connection limits in Redis, a deny set, and RELAY_PROXY_PROTOCOL_TIMEOUT. If proxy-level filtering is still wanted later, it needs a different tool. CrowdSec with a firewall bouncer, or nginx or HAProxy in front.

side quest: sec @x http/@x tls close routes on 25 and 587 drop every banner-first SMTP client. Cannot be implemented in caddy-l4 as planned. [deploy/k8s/caddy/Caddyfile:L30-L48]

Work reference: codingjoe/relay#409, branch codingjoe-mx-msa-connect-abuse-protection.

Lingua principale
Python
Stelle
4
Fork
0
Merge medio
2h 40m
PR unite (30g)
163

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codingjoe/relay

Tutte le issue di codingjoe/relay

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.