Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#410 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発

調査の方向性

deploy/k8s/caddy/Caddyfile の30〜48行から着手する: この変更は、issue の結論に基づき、:25 と :587 における @x http / @x tls マッチャーとそれらの close ルートを削除し、これらのポートが無条件にプロキシするようにすることだ。削除する設定に対して、caddy-l4 の記載された挙動(layer4/routes.go の ErrMatchingTimeout とマッチャーなしフォールバックのガード)を照合し、issue #409 のサブクエストの結果を記録する。完了の意味は、Caddyfile に 25/587 上の data マッチャーが含まれておらず、プロキシレベルでのフィルタリングは代わりに CrowdSec/nginx/HAProxy から来る必要があることを計画ノートが反映していることだ。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
4
フォーク
0
平均マージ
2時間 30分
マージ済み PR(30日)
165

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codingjoe/relay のほかの issue

codingjoe/relay の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。