[FEAT] Default site returns 200 for unknown paths, so nginx-botsearch never matches

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, nginx
領域
devops, security

調査の方向性

まずサンプル設定 default.conf を見つけ、その try_files ディレクティブを確認してください。デフォルトのサイトが / をどのように配信するか、提案された =404 フォールバックがその動作を維持するかを確認してください。不明なパスが404を返し、/ が引き続きランディングページを配信すれば完了です。issueにはテストが指定されていないため、サンプル設定で両方のケースを確認してください。

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

説明

no-issue-activity
Is this a new feature request?
  • I have searched the existing issues
Wanted change

Hi,

the default site should return 404 for paths that don't exist. Right now it falls back to /index.html and returns 200 for everything.

Reason for change

I wondered why fail2ban never banned the scanners hitting my server. The nginx-botsearch jail only matches requests with a 404:

failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) \/<block> \S+\" 404 .+$

But the default site has

try_files $uri $uri/ /index.html /index.htm /index.php$is_args$args;

so every unknown path gets the landing page with 200:

"GET /.ssh/id_rsa HTTP/1.1" 200 1345 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
"GET /%2egitconfig HTTP/2.0" 200 1345 "-" "curl/8.7.1"

In my access log that happened 5282 times, and the jail matched only 21 of 373440 lines. My default.conf is the unchanged sample (2026/03/07).

Proposed code change
try_files $uri $uri/ =404;

/ still shows the index.html. If the fallback is there on purpose (php apps in /config/www), maybe add a comment in the sample that nginx-botsearch doesn't work for the default site then.

主要言語
Dockerfile
スター
3.8k
フォーク
274
平均マージ
25分
マージ済み PR(30日)
1

環境構築

はじめの一歩

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

linuxserver/docker-swag のほかの issue

linuxserver/docker-swag の issue をすべて見る

似ている issue

DevOps の issue をもっと見る

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

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