os-nginx: Expand Trusted Proxies network aliases when generating nginx configuration

オープン
#5,782 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
54/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
nginx, php

調査の方向性

Start by locating the os-nginx code that generates set_real_ip_from directives for Trusted Proxies and trace how it resolves a Networks alias that references a URL Table alias. Check how the current PF table entries can be read when nginx configuration is generated or reloaded. Done means each supported entry produces a valid IP or CIDR directive and nginx configuration validation succeeds.

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

説明

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

When a Networks alias references a URL Table (IPs) alias, selecting the Networks alias as the nginx plugin's Trusted Proxies generates an invalid nginx configuration.

The URL Table contains Cloudflare's IPv4 and IPv6 proxy CIDR ranges, and the corresponding PF table is correctly populated. However, the generated nginx configuration contains a directive such as:

set_real_ip_from Cloudflare_Proxy_IPs_Table;

nginx expects an IP address or CIDR range in set_real_ip_from, not a PF alias or table name. Consequently, nginx configuration validation fails with the following error:

nginx: [emerg] host not found in set_real_ip_from "Cloudflare_Proxy_IPs_Table" in /usr/local/etc/nginx/nginx.conf:1146

To Reproduce

  1. Create a URL Table (IPs) alias containing Cloudflare's proxy IP ranges.
  2. Create a Networks alias that references the URL Table alias.
  3. Configure an nginx virtual server to use the Networks alias as its Trusted Proxies.
  4. Apply or reload the nginx configuration.
  5. Observe that the generated configuration references the alias name instead of actual IP addresses or CIDR ranges.
  6. Run nginx -T and observe that configuration validation fails.

Expected behavior

The nginx plugin should expand supported network aliases into their actual IP addresses and CIDR ranges when generating its configuration. For example, it could retrieve the current entries from the corresponding PF table using an equivalent of pfctl -t <table_name> -T show and generate valid set_real_ip_from directives for those entries.

Expanding the current table contents when generating or reloading the nginx configuration would be sufficient. Automatically regenerating the configuration whenever the URL Table changes is not required.

Screenshots

Not applicable.

Environment

  • OPNsense: 26.7.6_3-amd64
  • os-nginx: 1.36_5
  • Architecture: amd64

Additional context

This affects the use of Cloudflare proxy IP ranges with nginx's real-IP functionality. Maintaining a separate static Networks alias containing all Cloudflare CIDRs works around the problem, but requires manual updates when Cloudflare changes its published ranges.

Existing issue #3471 discusses support for additional alias types in Trusted Proxies. This report concerns a related but distinct failure: a Networks alias is accepted by the GUI, but referencing a URL Table alias causes the generated nginx configuration to be invalid.

主要言語
PHP
スター
1.2k
フォーク
926
平均マージ
1日 10時間
マージ済み PR(30日)
25

環境構築

はじめの一歩

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

opnsense/plugins のほかの issue

opnsense/plugins の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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