This commit is contained in:
Mateusz Gruszczyński committed 2026-11-26 11:02:46 +01:00
1 parent aa0a271a1c
commit f38a2b9e5e
38 files changed
+1098 -160

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# RustProxy source and documentation maintenance # RustProxy source and documentation maintenance
Current source version: **0.42.1**. The Cargo package and binary are named `rust-proxy`. Current source version: **0.42.2**. The Cargo package and binary are named `rust-proxy`.
Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior. Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior.
+8
View File
@@ -2,6 +2,14 @@
Release history focused on **features, settings, default behavior, compatibility and fixes**. Changes to internal code structure and preliminary performance experiments are intentionally omitted. Historical descriptions reflect their respective releases; consult the current documentation for the settings available in the latest release. Release history focused on **features, settings, default behavior, compatibility and fixes**. Changes to internal code structure and preliminary performance experiments are intentionally omitted. Historical descriptions reflect their respective releases; consult the current documentation for the settings available in the latest release.
## 0.42.2 — Generic FastCGI/CGI hosting and Apache compatibility
- **Legacy Apache access rules:** compile and enforce `Order`, `Allow from` and `Deny from` for `all`, IP addresses and CIDR networks (IPv4/IPv6), including `Deny from all`, rather than rejecting them independent of Strict mode. This preserves access restrictions. Unsupported security and handler constructs still fail closed; non-security unsupported directives remain warnings when Strict is off.
- **Panel:** clarify that turning Strict mode off does not disable security rules. Show per-Web-Service skipped .htaccess directives with file and line from the compiled configuration; diagnostics are also logged as warnings.
- **Universal FastCGI handlers:** Web Services support `php.handler=php_fpm` (default for existing configurations), `fcgiwrap` (external CGI runner), or `fastcgi` (generic responder). Socket/loopback TCP endpoint, executable extensions, `SCRIPT_NAME` public mount prefix, PATH_INFO, streaming bodies and bounded headers/timeouts are configurable independently per Web Service or shared profile. Verified Vhost Basic Auth identity can populate `REMOTE_USER` and `AUTH_USER`; reserved CGI identity and script parameters are never accepted as untrusted custom overrides. A CGI-only Web Service refuses raw static file delivery. No application-specific filesystem or URL paths are hard-coded.
- **Popular `.htaccess` migration rules:** add `Redirect`, `RedirectMatch`, and bounded `<Files>` / `<FilesMatch>` access-control blocks. Access control is enforced on direct script paths and index files rather than skipped. Unsafe/unknown authentication or execution rules remain fail-closed.
- **Docs and compatibility:** add a generic [FastCGI / CGI guide](docs/FASTCGI.md) with PHP + CGI + static routing examples and an Angie/Nginx-to-RustProxy mapping; update the panel, EN/PL labels, Reader, OpenAPI and regression tests. Existing `php` JSON and profile IDs remain valid. These source changes still require Cargo compilation and real PHP-FPM/fcgiwrap integration tests before production deployment.
## 0.42.1 — HTTP policy scenarios and editor improvements ## 0.42.1 — HTTP policy scenarios and editor improvements
- **Scenario presets:** the shared HTTP policy editor replaces the two standalone Vary preset buttons with a searchable, grouped catalog of 40 practical scenarios built from 54 rules. Recipes cover header cleanup, CORS, browser security, private/signed/preview requests, cache TTL/grace and revalidation, event streams, access filters, redirects, path rewrites, maintenance, backend selection and transaction diagnostics. Descriptions, setup notes and rule previews show each recipe's effect; configurable or sensitive additions start disabled. Location scope offers 39 scenarios because `pre_route` rewriting precedes location selection. Adding a scenario appends uniquely identified draft rules; saving the containing form activates enabled rules. - **Scenario presets:** the shared HTTP policy editor replaces the two standalone Vary preset buttons with a searchable, grouped catalog of 40 practical scenarios built from 54 rules. Recipes cover header cleanup, CORS, browser security, private/signed/preview requests, cache TTL/grace and revalidation, event streams, access filters, redirects, path rewrites, maintenance, backend selection and transaction diagnostics. Descriptions, setup notes and rule previews show each recipe's effect; configurable or sensitive additions start disabled. Location scope offers 39 scenarios because `pre_route` rewriting precedes location selection. Adding a scenario appends uniquely identified draft rules; saving the containing form activates enabled rules.
Generated
+1 -1
View File
@@ -1914,7 +1914,7 @@ dependencies = [
[[package]] [[package]]
name = "rust-proxy" name = "rust-proxy"
version = "0.42.1" version = "0.42.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"arc-swap", "arc-swap",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "rust-proxy" name = "rust-proxy"
version = "0.42.1" version = "0.42.2"
edition = "2021" edition = "2021"
rust-version = "1.99.1" rust-version = "1.99.1"
description = "RustProxy - independent reverse proxy with local administration" description = "RustProxy - independent reverse proxy with local administration"
+1 -1
View File
@@ -15,7 +15,7 @@
| --- | --- | | --- | --- |
| Reverse proxy | HTTP/HTTPS backends, HTTP/1.1, HTTP/2 and H2C upstreams, load balancing, health checks, connection reuse, WebSockets, custom locations, retries and error fallbacks | | Reverse proxy | HTTP/HTTPS backends, HTTP/1.1, HTTP/2 and H2C upstreams, load balancing, health checks, connection reuse, WebSockets, custom locations, retries and error fallbacks |
| Frontends | HTTP, HTTPS, HTTP/2, HTTP/3 (QUIC), named listeners, exact and wildcard domains, redirects, optional post-quantum TLS key exchange | | Frontends | HTTP, HTTPS, HTTP/2, HTTP/3 (QUIC), named listeners, exact and wildcard domains, redirects, optional post-quantum TLS key exchange |
| Web Server | Static sites and downloads, `try_files`, rewrites, `.htaccess` subset, byte ranges, precompressed files, PHP-FPM | | Web Server | Static sites and downloads, `try_files`, rewrites, `.htaccess` subset, byte ranges, precompressed files, external PHP-FPM, CGI via fcgiwrap and generic FastCGI responders |
| Certificates | PEM import, ACME HTTP-01 and DNS-01 (Cloudflare, OVH, RFC 2136), automatic renewal, external Certbot files, hot reload | | Certificates | PEM import, ACME HTTP-01 and DNS-01 (Cloudflare, OVH, RFC 2136), automatic renewal, external Certbot files, hot reload |
| Access | IP/CIDR, DNS/DDNS and country rules, ACL profiles, rate limits, method and Content-Type policies, Basic Auth, Tinyauth, Authelia, authentik, OIDC | | Access | IP/CIDR, DNS/DDNS and country rules, ACL profiles, rate limits, method and Content-Type policies, Basic Auth, Tinyauth, Authelia, authentik, OIDC |
| Delivery | Shared memory and disk cache, `Cache-Status`, purge/ban, gzip/Brotli/Zstandard compression, asset minification | | Delivery | Shared memory and disk cache, `Cache-Status`, purge/ban, gzip/Brotli/Zstandard compression, asset minification |
+37 -36
View File
@@ -1,13 +1,13 @@
61bf40a0572889dc8b0dda9eae4e93e44b0de9364b3c798106c85700ffb37c23 .dockerignore 61bf40a0572889dc8b0dda9eae4e93e44b0de9364b3c798106c85700ffb37c23 .dockerignore
4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example 4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example
0a5e87541831edca0e7164c6469dba01a8a7053ab14dbfb8019c83e4db10edc2 .gitignore 0a5e87541831edca0e7164c6469dba01a8a7053ab14dbfb8019c83e4db10edc2 .gitignore
1b9b764f579ce64485c2b2c9b0d717eb1875ac0c2aa86df2a24bcce16456ac54 AGENTS.md 3c4638dc086333b8383c5bc77fe967b790075439f5e7a8257e5dd0dd4cf4233b AGENTS.md
f0b2ce9432c0c742bb528941a1b394ebd245822b2e3ec909d9e5cb56787a53b6 CHANGELOG.md b446765161f494e1e07196bcec6f6edcc8e42216bed8b8ad6dfc58a0136eb89e CHANGELOG.md
aaf6d97af6fe4dc5a983fbc347934a50f20ce12beee6ffb9c681ec353794166f Cargo.lock c28d825120a878684b511b1a6a4f372aced5098ed7b9bec8b318c4ec3fb1cbf4 Cargo.lock
1249af090f77e46e1cb1bb5bc2fcf22be7781b86fc9fccf626dc73e5b6e7c75f Cargo.toml 3ac98730af5caa39f81d28f4a4f7f14710fbb53d625794dd5704e65afebe4d8e Cargo.toml
788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile 788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile
0d96a4ff68ad6d4b6f1f30f713b18d5184912ba8dd389f86aa7710db079abcb0 LICENSE 0d96a4ff68ad6d4b6f1f30f713b18d5184912ba8dd389f86aa7710db079abcb0 LICENSE
6889fb8bc1edbb5aae65ec7a799270e2028ad6625f8c38488f3cb25d437e8c6c README.md b3f2518300e2e057eed893b290140da0f01db4c31740fc8e6d69254f4b7ae22b README.md
da8311e3db945290666324a2f24bf4521b365272d7ac3f862ded1be993eea646 UPDATE_CHECK.toml da8311e3db945290666324a2f24bf4521b365272d7ac3f862ded1be993eea646 UPDATE_CHECK.toml
120609370b79e192c9a2a72c1706225aa5da06c5806efa26a010b733e120322b build.rs 120609370b79e192c9a2a72c1706225aa5da06c5806efa26a010b733e120322b build.rs
95ececaba550a4bcfd6754073877ba0633373b1e1451521b9ac905a51e8ca6eb deploy/README.md 95ececaba550a4bcfd6754073877ba0633373b1e1451521b9ac905a51e8ca6eb deploy/README.md
@@ -45,10 +45,11 @@ bfe96dd91dfc6e07918a662d98b036f12ceb011a5aa8381b3778bd0c964b19ab docs/CACHE.md
51d34823d139ff3b0b8e1cf1a31850746be5ed7da847a2cca51be36fd5f7733a docs/CACHE_TEMPLATE_LIBRARY.md 51d34823d139ff3b0b8e1cf1a31850746be5ed7da847a2cca51be36fd5f7733a docs/CACHE_TEMPLATE_LIBRARY.md
31285f000cf725d018a926023fe608fec983b959053f7a55e0954b962a8bc20c docs/CERTIFICATES.md 31285f000cf725d018a926023fe608fec983b959053f7a55e0954b962a8bc20c docs/CERTIFICATES.md
81df6715e2f07617fe0bbb0960c4d5bdac28cf665ce7297fa3768118e6ab28ba docs/CONFIGURATION.md 81df6715e2f07617fe0bbb0960c4d5bdac28cf665ce7297fa3768118e6ab28ba docs/CONFIGURATION.md
209664f5937d88c857aab2db3ced9fdfc264b526671ef59b999a00c5d7678aa3 docs/CUSTOM_LOCATIONS.md 966a1c49274c45568cf2b34158900524471f50d796d227a02db49c57941cc808 docs/CUSTOM_LOCATIONS.md
16d4510e38d43c3bbde9b7dab7af3aeb0cb837dc2f1956cfaad7a9a11bea3bfc docs/DASHBOARD.md 16d4510e38d43c3bbde9b7dab7af3aeb0cb837dc2f1956cfaad7a9a11bea3bfc docs/DASHBOARD.md
53cb0ce7db5ce25e4c2381de3a6e875d212deeed08861da63050de6c51a442bd docs/DOCKER_DISCOVERY.md 53cb0ce7db5ce25e4c2381de3a6e875d212deeed08861da63050de6c51a442bd docs/DOCKER_DISCOVERY.md
f42182261c07849fe3a19be72cc71305175ce33524bdaf791ed8d66656d96e2b docs/FEATURES.md 6b575c6c1c7e01b252bbbf441ab100745dace3799f70fd65b840cba4681d1c08 docs/FASTCGI.md
e7c5ec82c5a0ec336fa7e88835f82925bb75f213975309853a3d748b28f1b6b2 docs/FEATURES.md
f7bb59821e0d6c45ae2a1789086fd9dab33d91c0ceae784ae68f64bd13b5f496 docs/HEADLESS.md f7bb59821e0d6c45ae2a1789086fd9dab33d91c0ceae784ae68f64bd13b5f496 docs/HEADLESS.md
bce732d845c23ad677ae811e7529b9322ab41d04ca808e04087d0f76bccd9309 docs/INSTALL.md bce732d845c23ad677ae811e7529b9322ab41d04ca808e04087d0f76bccd9309 docs/INSTALL.md
3268808766ad66263e465f251dce18cff2e7ede355638dc2b0975870b1a5eead docs/LOAD_BALANCING.md 3268808766ad66263e465f251dce18cff2e7ede355638dc2b0975870b1a5eead docs/LOAD_BALANCING.md
@@ -56,9 +57,9 @@ bce732d845c23ad677ae811e7529b9322ab41d04ca808e04087d0f76bccd9309 docs/INSTALL.m
3b889851ba3405247861391aefbcfcaa5a96cf9b09b3e0e0e412ec2f54e11b1a docs/MIGRATION.md 3b889851ba3405247861391aefbcfcaa5a96cf9b09b3e0e0e412ec2f54e11b1a docs/MIGRATION.md
48105c4303401aa99ffff00d3ebaf3024535a492a4a7b883c6803e4732b37434 docs/MONITORING.md 48105c4303401aa99ffff00d3ebaf3024535a492a4a7b883c6803e4732b37434 docs/MONITORING.md
6d3937088eeb67a9f690d44ebe0b6e660b68116dbf69091ac7816bdc52cec2b6 docs/PERFORMANCE.md 6d3937088eeb67a9f690d44ebe0b6e660b68116dbf69091ac7816bdc52cec2b6 docs/PERFORMANCE.md
d5894c07c68ec4230987767198434abee13b0e525842fea21bcbe752fa82742b docs/PHP_FPM.md a8fdd52601f45a19fd194e27d6ce40aaf57603e88633f8d7040775599494e124 docs/PHP_FPM.md
45ce24998bda40e60f34756bef29616114aec9fd5cdd5e1aed692ff2371a3af1 docs/POLICY.md 45ce24998bda40e60f34756bef29616114aec9fd5cdd5e1aed692ff2371a3af1 docs/POLICY.md
28f4c4faa850dc13e9431eeec2a3c776f227f6839d071dc0baeab7e50c3faa38 docs/README.md e41b45ff1f980be556d866d7ebb619ab5b455dccf3683519e937e0fb418fbc99 docs/README.md
e90842a75459ddb5892334f66a4139d9301280b4d0c17077d211749bd7c90d80 docs/RESPONSE_DELIVERY.md e90842a75459ddb5892334f66a4139d9301280b4d0c17077d211749bd7c90d80 docs/RESPONSE_DELIVERY.md
95ab4786792d5920a2e109b7d196838057f24b512a69d713fb5884dc75c84339 docs/SCREENSHOTS.md 95ab4786792d5920a2e109b7d196838057f24b512a69d713fb5884dc75c84339 docs/SCREENSHOTS.md
3a48184b36d225757fc5e2d22c629f89bfe5d4007ff087f0be0ce02a5fb04c28 docs/SECURITY.md 3a48184b36d225757fc5e2d22c629f89bfe5d4007ff087f0be0ce02a5fb04c28 docs/SECURITY.md
@@ -70,7 +71,7 @@ c4407cbd70d181e87f64e8d1736624d7b8b59a04b915ad3464f0e1f16d474e99 docs/TRANSPORT
4a5534b628c18f4e83c67c6136b60969c884391fbe55cc6bd4f2354711d8ffb7 docs/VCL_SUPPORT_MATRIX.md 4a5534b628c18f4e83c67c6136b60969c884391fbe55cc6bd4f2354711d8ffb7 docs/VCL_SUPPORT_MATRIX.md
382e084a1f9e35627ccb43eaf451c18fb6d0cc752397c2178108d71de592a931 docs/VCL_TRAFFIC_COOKBOOK.md 382e084a1f9e35627ccb43eaf451c18fb6d0cc752397c2178108d71de592a931 docs/VCL_TRAFFIC_COOKBOOK.md
181444ea2c28171ed89ead25dcfc60ee6bd05f7b01c1a49d8248a307dc9be7a4 docs/VHOSTS.md 181444ea2c28171ed89ead25dcfc60ee6bd05f7b01c1a49d8248a307dc9be7a4 docs/VHOSTS.md
495c9977cb24995acb8cc846bd18cedc3957ab262c5134362bb0e9c9d2246680 docs/WEB_SERVER.md 720d4bf8ba2bfd502de98fa2fc9df97d7155e36f10e7106238646fed8a5f19ff docs/WEB_SERVER.md
42822b1c9801bcadb0e2d785cb91883ca2df1da141222631f153030c95f5e197 docs/images/about.png 42822b1c9801bcadb0e2d785cb91883ca2df1da141222631f153030c95f5e197 docs/images/about.png
deff2393a987ac7102179dc85b48baf2c4a3882291bb8c7c584d760cc497c631 docs/images/api.png deff2393a987ac7102179dc85b48baf2c4a3882291bb8c7c584d760cc497c631 docs/images/api.png
74df8228ea6283004b3e87b4d297e43637371eb4a700b69c7248114c8670777a docs/images/cache.png 74df8228ea6283004b3e87b4d297e43637371eb4a700b69c7248114c8670777a docs/images/cache.png
@@ -136,8 +137,8 @@ e9cbb0224c4a3d23a6019ba557e0cd568c1ad5e1582ff1e335fb7d99b7a1055d integrations/r
3f092a9ab80221eddd67be4d1a776acbc6e04c1eb6011b588280c28e83b2582f integrations/routeros-oci-build/build-routeros-oci.sh 3f092a9ab80221eddd67be4d1a776acbc6e04c1eb6011b588280c28e83b2582f integrations/routeros-oci-build/build-routeros-oci.sh
3f267cafa16006e5456ade78ee2d5fae02cc7ce747839523068ffd8d7c98798a integrations/routeros-oci-build/docker-entrypoint.sh 3f267cafa16006e5456ade78ee2d5fae02cc7ce747839523068ffd8d7c98798a integrations/routeros-oci-build/docker-entrypoint.sh
ae2ee2887fcba096d0de25edcc18faa1ffec35759274518db1bf6d6982f7176c langs/README.md ae2ee2887fcba096d0de25edcc18faa1ffec35759274518db1bf6d6982f7176c langs/README.md
fd79669fb238461aac1953c3103770b58eb4e405a48a164eada45e85d27ab085 langs/en_US.json 15cd8725e17d0f9ce60423574ed7405f68f25697247987cae048ddda71eb2075 langs/en_US.json
96f0f4349d4f524bcba80ee11ce2ce568dc5fca98910f8958007179ea3f6deb7 langs/pl_pl.json 4947f1cbff86adb68ad840cae65a27f5ad553fc0273af2b3fbea974509a32191 langs/pl_pl.json
38773ed251a8c24af353f4744e498ae2bc7d4151df7927e942c4ac223f6008e1 make_zip.py 38773ed251a8c24af353f4744e498ae2bc7d4151df7927e942c4ac223f6008e1 make_zip.py
e830d37dd1f81a4b0aa7d535f5bba69e34e433b0fd99cc8ee0b296786c32379a migrations/0002_admin.sql e830d37dd1f81a4b0aa7d535f5bba69e34e433b0fd99cc8ee0b296786c32379a migrations/0002_admin.sql
20112cc82192098b8d602f1c4f7ca08712e9e1366c845fabb92753187c370d35 migrations/0003_certificate_renewals.sql 20112cc82192098b8d602f1c4f7ca08712e9e1366c845fabb92753187c370d35 migrations/0003_certificate_renewals.sql
@@ -203,7 +204,7 @@ f73678bfa4c4f92779cf4e8ae2feb37419de320fb1b53111c982539d5761dbcf src/admin/aler
11f1501574e4042fab7a97f18a19c8a69856e157933a56baaf4c7cc9d2da9a8c src/admin/config_sections.rs 11f1501574e4042fab7a97f18a19c8a69856e157933a56baaf4c7cc9d2da9a8c src/admin/config_sections.rs
c51f725075b5c4fc3fb7fb8b8b5f73987bff698a400e8950e968068b97a77631 src/admin/dashboard_presets.rs c51f725075b5c4fc3fb7fb8b8b5f73987bff698a400e8950e968068b97a77631 src/admin/dashboard_presets.rs
aae1ca0e70d987830bd63948d431f54302083148177c1b551565be12df7fe771 src/admin/documentation.rs aae1ca0e70d987830bd63948d431f54302083148177c1b551565be12df7fe771 src/admin/documentation.rs
4191044a22ec0013937dda3241837b2ac9a03b615717f09996566de7eb1a22d3 src/admin/documentation/documents.rs ea34f2681a8077b7630dba9c35bc9e0f3711c5d5027c2803c44f5d84a0b3e2cb src/admin/documentation/documents.rs
f9b2c8fe62cc92d7693e46145b2543b12dd6d4943fe2d52c67ed6958d4af83de src/admin/documentation/tests.rs f9b2c8fe62cc92d7693e46145b2543b12dd6d4943fe2d52c67ed6958d4af83de src/admin/documentation/tests.rs
1ce779b84aa8f47bdb3c34f83593c1f2f06d2235f0319847096cfcd035434168 src/admin/file_log_search.rs 1ce779b84aa8f47bdb3c34f83593c1f2f06d2235f0319847096cfcd035434168 src/admin/file_log_search.rs
2805c7d1c08fed6a54711b8b5d51078ba8c2daecae431b6c7c39fe0345b6cecc src/admin/file_logs.rs 2805c7d1c08fed6a54711b8b5d51078ba8c2daecae431b6c7c39fe0345b6cecc src/admin/file_logs.rs
@@ -211,7 +212,7 @@ f9b2c8fe62cc92d7693e46145b2543b12dd6d4943fe2d52c67ed6958d4af83de src/admin/docu
e2253599b5e39510946729920d240711403a3889cc495eb49824296228f1d080 src/admin/file_logs_query.rs e2253599b5e39510946729920d240711403a3889cc495eb49824296228f1d080 src/admin/file_logs_query.rs
1594c8666991c1d07487a6a718211ef404cf49114721960f7e119bb7f605e3d2 src/admin/logging_api.rs 1594c8666991c1d07487a6a718211ef404cf49114721960f7e119bb7f605e3d2 src/admin/logging_api.rs
781fd5f176dd8f2372f75bd90edcf160708e2d0a8d6a115ba4b283c0cd49eb2d src/admin/mod.rs 781fd5f176dd8f2372f75bd90edcf160708e2d0a8d6a115ba4b283c0cd49eb2d src/admin/mod.rs
c0780d0016315050b7d487f48a55a056b1a58ac013d02f2a3ef30c7c73ddd527 src/admin/openapi.json 7db46bdbef37c8295d7aee2c0d9150ccd51c30ca6fd2af9f859785766b8e926d src/admin/openapi.json
9f8842cdec27d703d1795dd6eb37d9420e9f5a2e56a0df93278c92bace5d1f4c src/admin/operations.rs 9f8842cdec27d703d1795dd6eb37d9420e9f5a2e56a0df93278c92bace5d1f4c src/admin/operations.rs
257d93a29d0bda96462bcf695aba8d0ec0f9412c379e066ec46ae8ee034e3a53 src/admin/panel_assets.rs 257d93a29d0bda96462bcf695aba8d0ec0f9412c379e066ec46ae8ee034e3a53 src/admin/panel_assets.rs
f5127855c2994d052678865df36d703b74f4a0afc633daf7718b10da18d26e37 src/admin/panel_content.rs f5127855c2994d052678865df36d703b74f4a0afc633daf7718b10da18d26e37 src/admin/panel_content.rs
@@ -223,10 +224,10 @@ ea202c67d9acb7614046f153beecdff10d5822b3d5627eaf2ebda33954b36474 src/admin/pref
62ecbae5dee00aeeca3eb806e2605372471dfab971cde8f66f11e711df8fcea1 src/admin/public/mod.rs 62ecbae5dee00aeeca3eb806e2605372471dfab971cde8f66f11e711df8fcea1 src/admin/public/mod.rs
7a00e4ab943f74d2b1bdcbfab7f9cd3f584e9f59536b4aca6c4c31f5f5508d12 src/admin/public/tests.rs 7a00e4ab943f74d2b1bdcbfab7f9cd3f584e9f59536b4aca6c4c31f5f5508d12 src/admin/public/tests.rs
6930b4f4b45257772b321b20a9becdf9bc4610274852948ba38c2d0cdf02dfaf src/admin/refresh_preferences.rs 6930b4f4b45257772b321b20a9becdf9bc4610274852948ba38c2d0cdf02dfaf src/admin/refresh_preferences.rs
7a680e100aec9ad68b360ed23d364e755915b6a810cacbd82890e8d99856187f src/admin/router.rs 8df90dffdbdb14e068d26f2a81801a76c69ec0bb65a9d13a4cae7bdf367be6cd src/admin/router.rs
fba52102e77ca8871a42f97c91be8f10a9aa4f997868652d550fff3fbd41b66e src/admin/session.rs fba52102e77ca8871a42f97c91be8f10a9aa4f997868652d550fff3fbd41b66e src/admin/session.rs
1c4d04b14a508fca7537f54e660124f4dae1964b48d7bd3b878ec4faa7156805 src/admin/status.rs 1c4d04b14a508fca7537f54e660124f4dae1964b48d7bd3b878ec4faa7156805 src/admin/status.rs
9b5bc1a439c5e5611c47732fe86097877b50b09b10a0838d9813314ea6232d0c src/admin/status_live.rs bac2116e9a7d5f19a112565e1483787ff6102f489bed0cb3b0b3e2102ddd3edb src/admin/status_live.rs
c20f214e2ec2a14d8a88d07a63a27d9396a7a6bf9446f6ee31dbd77b12e4b585 src/admin/status_system.rs c20f214e2ec2a14d8a88d07a63a27d9396a7a6bf9446f6ee31dbd77b12e4b585 src/admin/status_system.rs
ea1d0b8ff69157215f9358f0de35b91462ab2bf1fb97f9ce9b37846d0432c56b src/admin/tail.rs ea1d0b8ff69157215f9358f0de35b91462ab2bf1fb97f9ce9b37846d0432c56b src/admin/tail.rs
b4bcfb9fc989d5586ca3d82e8b5777c306e9a6720f9ec011d09bd786db9faf49 src/admin/tests.rs b4bcfb9fc989d5586ca3d82e8b5777c306e9a6720f9ec011d09bd786db9faf49 src/admin/tests.rs
@@ -301,7 +302,7 @@ e6c4d91d1542d0a5b47bb8736f9539d43a6713df5a473b635519d5b7eac2eb9c src/admin/web/
0a5fff35555153f59d4346933030a67b6e1a8768cee7a47cfa2fcf1a2c564f63 src/admin/web/favicon.svg 0a5fff35555153f59d4346933030a67b6e1a8768cee7a47cfa2fcf1a2c564f63 src/admin/web/favicon.svg
e0f0b302092ced1c84ef7e99864984444f0e9d4e3b7d85e74d3507d566952a7f src/admin/web/file-logs.js e0f0b302092ced1c84ef7e99864984444f0e9d4e3b7d85e74d3507d566952a7f src/admin/web/file-logs.js
85f54ce519140a38e31fb1b3d5974585748d7162f0499aa63703c1db56334b2c src/admin/web/host404.js 85f54ce519140a38e31fb1b3d5974585748d7162f0499aa63703c1db56334b2c src/admin/web/host404.js
2fd6a462dc2d66d617052cbfffba24086809fa7b2650b17982180907f1b5a889 src/admin/web/index.html 31a45d496f39bec083a13b7ce68989cc3af25926aa313f4defb5ae09d87007da src/admin/web/index.html
be9999a001c59630963d60539e860b59999dcf74c5ff0087b12a6fb69b4e7bd2 src/admin/web/integrations.js be9999a001c59630963d60539e860b59999dcf74c5ff0087b12a6fb69b4e7bd2 src/admin/web/integrations.js
7a12f020fc587205694978ab41b660e9a80487d413fbf6e34fc525eabc58308f src/admin/web/login-keys.json 7a12f020fc587205694978ab41b660e9a80487d413fbf6e34fc525eabc58308f src/admin/web/login-keys.json
ac9f667273918e18406df06cb2613c923f50a88897693a03a18f500e22dc6ec2 src/admin/web/login.html ac9f667273918e18406df06cb2613c923f50a88897693a03a18f500e22dc6ec2 src/admin/web/login.html
@@ -329,8 +330,8 @@ b3239e67901f1796d7a974ade0796f2e3590ff8064628a5629b78c7f6ce2f32e src/admin/web/
8c3da49973c62333559b0e3588c02beb0b425c025eac5cfa82a1bb968f70d9dd src/admin/web/vhosts/rates.js 8c3da49973c62333559b0e3588c02beb0b425c025eac5cfa82a1bb968f70d9dd src/admin/web/vhosts/rates.js
fafb4f9e8f123c93a5277052a375a9d2dd8f986322abd17f2206c16f0c37df06 src/admin/web/vhosts/render.js fafb4f9e8f123c93a5277052a375a9d2dd8f986322abd17f2206c16f0c37df06 src/admin/web/vhosts/render.js
90684f1bfb0e079438654e1f8c5b9ee1b4f74e49126a82c88768f3ae209a1875 src/admin/web/vhosts/routing.js 90684f1bfb0e079438654e1f8c5b9ee1b4f74e49126a82c88768f3ae209a1875 src/admin/web/vhosts/routing.js
683b6506989d6ca9f3a0b1da7c1c931dce3ea3fbcb95dd9c56b038ac9a1c977c src/admin/web/web-server-profiles.js b78d058deabc6a238560222bfdf131df3812407f73bdd000279df273b5d5dfc9 src/admin/web/web-server-profiles.js
f9854526ff1567de47ecb02af872bca6e13c0adb984ad5ef0c256e5fdbb3902e src/admin/web/web-server.js c373850916ed66250583ebafa960e5c2a22ff3d0c63610ec61a1d16810bf5b17 src/admin/web/web-server.js
36f11beed56711640bb56bb6f452bf76dec2ce4be6a57e8abc19560af477c870 src/alerts.rs 36f11beed56711640bb56bb6f452bf76dec2ce4be6a57e8abc19560af477c870 src/alerts.rs
2d40c2cb32d7365df0c9cd6c8cb6f0483c7a799786c648f4836a0d9740c6c5ef src/auth/files/mod.rs 2d40c2cb32d7365df0c9cd6c8cb6f0483c7a799786c648f4836a0d9740c6c5ef src/auth/files/mod.rs
b2f948bcc3dbd24952c7b1b02d41d06757f49f0c38a78caf51f8f8a687d8480d src/auth/files/tests.rs b2f948bcc3dbd24952c7b1b02d41d06757f49f0c38a78caf51f8f8a687d8480d src/auth/files/tests.rs
@@ -360,7 +361,7 @@ ded4f445eec1caacd92fb1546f9eaeba1bc35fd164deb4d3142a64d0e9e261d9 src/balance/mo
5f9419176d5b927f8376d39b7dc4a6adf37b975835fedb35d82e7d6a2bb052fd src/balance/pool_selection.rs 5f9419176d5b927f8376d39b7dc4a6adf37b975835fedb35d82e7d6a2bb052fd src/balance/pool_selection.rs
d789bf40cf9433e2fd16409d112210fe93154588b1ac9bddc9c7f78e1db14426 src/balance/pool_view.rs d789bf40cf9433e2fd16409d112210fe93154588b1ac9bddc9c7f78e1db14426 src/balance/pool_view.rs
a361c341932ffd186c0b21356c91ab1fe8043f5020d40798266d15ae896a114e src/balance/tests.rs a361c341932ffd186c0b21356c91ab1fe8043f5020d40798266d15ae896a114e src/balance/tests.rs
ae06d238b1451328c751a511476ef39c012f3a397393f939ca02f96ecd0119a6 src/basic_auth/mod.rs 4cecc5ad1631179afc0c76bffe461fb75efe91f8366d99a58bc8c68f65d492c9 src/basic_auth/mod.rs
9a8858b7ff461a4d961ba701ca3ed6eaec15c3f7f05eef8e0e30edc63617605a src/basic_auth/tests.rs 9a8858b7ff461a4d961ba701ca3ed6eaec15c3f7f05eef8e0e30edc63617605a src/basic_auth/tests.rs
d9c44f9be9e3855c2339d4867c164b35938474b0a970de887d3990f33779b03b src/cache/cache_regression_tests.rs d9c44f9be9e3855c2339d4867c164b35938474b0a970de887d3990f33779b03b src/cache/cache_regression_tests.rs
7def03ace07dc38a4806277d75b6ce673d33ddaaf1c4855fa0a3372be1cf9489 src/cache/cold.rs 7def03ace07dc38a4806277d75b6ce673d33ddaaf1c4855fa0a3372be1cf9489 src/cache/cold.rs
@@ -419,8 +420,8 @@ a3bd297d160b3bad25bb362de848f182b7ec9807943c5c4537dafbc2a1e299d8 src/config/mod
75839458ddbc7480ec4492a95eeb67b617ba7d62f7b67e7a767a3453b74dbcbc src/config/route_policy_tests.rs 75839458ddbc7480ec4492a95eeb67b617ba7d62f7b67e7a767a3453b74dbcbc src/config/route_policy_tests.rs
caf688a85edc57e92d9ab0cd480282d4a3ecffe210473cf7e3abaccf8c8cd7ce src/config/routing.rs caf688a85edc57e92d9ab0cd480282d4a3ecffe210473cf7e3abaccf8c8cd7ce src/config/routing.rs
4ba1998de8b8b7d43548d0a6708db59e05654c0ed5a999152885668246bd69d7 src/config/routing_conditions_tests.rs 4ba1998de8b8b7d43548d0a6708db59e05654c0ed5a999152885668246bd69d7 src/config/routing_conditions_tests.rs
29bdb73b679cf45ae0833b9b13ea86923690397c1a7a17c0ce364bc182bb2801 src/config/snapshot.rs fa835ba4bf063c373defd95e7b37e95d8a281cfa8b8595f4c1fc0cf3988af3a5 src/config/snapshot.rs
e79c79ffb6b8db04bf0e7581b217d3fd2cd88f23fc2b7e3874dca0eef19423bb src/config/tests.rs c56f696db4e37f5bbf7179e9a952aca8a89c81b4e479f9c79bb18a6f89cf5364 src/config/tests.rs
f35de0ee1516ece6bbfd2b2a7db7d1e0f5048b0ec47cf2a3765dffb799abfd93 src/config/transport_tests.rs f35de0ee1516ece6bbfd2b2a7db7d1e0f5048b0ec47cf2a3765dffb799abfd93 src/config/transport_tests.rs
a09f361d70510d6226f4dd6785e649c3dc01ccafc70a4c8b0dcd098e224129b7 src/db.rs a09f361d70510d6226f4dd6785e649c3dc01ccafc70a4c8b0dcd098e224129b7 src/db.rs
c290d0cb02dfa5d2c60ecabac1cfb20c8884e3d14cca1944906c6d8e677f1784 src/db/api_tokens.rs c290d0cb02dfa5d2c60ecabac1cfb20c8884e3d14cca1944906c6d8e677f1784 src/db/api_tokens.rs
@@ -519,7 +520,7 @@ ab27174e36fabe0b4e610a96be4a81de4b9d173ec60736ce5d6b51c1a8fa9826 src/proxy/forw
8beccb28fbee2a7d7df5991ce93a8610f7d92bd1d4abed8679b968861ebd8a1f src/proxy/forward/success_prepare.rs 8beccb28fbee2a7d7df5991ce93a8610f7d92bd1d4abed8679b968861ebd8a1f src/proxy/forward/success_prepare.rs
a91d0bdc5740beec921df50ad14a4e85de0a73d46c9626c9cfd37a7f8baca317 src/proxy/forward/upstream.rs a91d0bdc5740beec921df50ad14a4e85de0a73d46c9626c9cfd37a7f8baca317 src/proxy/forward/upstream.rs
03961ad0d386759ca2016d2dde37e124453514650d19a7feeaaa931f1ba81fc8 src/proxy/forward/vcl_policy_matrix_tests.rs 03961ad0d386759ca2016d2dde37e124453514650d19a7feeaaa931f1ba81fc8 src/proxy/forward/vcl_policy_matrix_tests.rs
ca4b59cee7eefaedcdb30f3b60ea982b9f4e1df6cf03b7580bd4a53bcbf18ca4 src/proxy/forward/web_source.rs 05c2f6762b96d72159704bcf67d22dd0242479244027da20ec4b339d9b0e5cc3 src/proxy/forward/web_source.rs
3df1cd933c77e5390066e0bf3a4671a053b97ec1948c4a4204004312a3572c9d src/proxy/forward_entry.rs 3df1cd933c77e5390066e0bf3a4671a053b97ec1948c4a4204004312a3572c9d src/proxy/forward_entry.rs
9b25f5e3ea4443a63ee6f45d12e1957dd316fe8e85325fc00ea416faaab1025a src/proxy/h2_graceful.rs 9b25f5e3ea4443a63ee6f45d12e1957dd316fe8e85325fc00ea416faaab1025a src/proxy/h2_graceful.rs
fc61c3f81d0bd8d91dab2a72267d497404e45e10e5cfc6000af16a254f888148 src/proxy/headers/authority_tests.rs fc61c3f81d0bd8d91dab2a72267d497404e45e10e5cfc6000af16a254f888148 src/proxy/headers/authority_tests.rs
@@ -534,7 +535,7 @@ a57ea795430bf52d550083fef759c739f3821217aac465c0024aa1565b0727d1 src/proxy/requ
16f9ed2ff51879095e6f1a818b03a76a03072b4c8c30d55201cb3d8bf229bf1d src/proxy/types.rs 16f9ed2ff51879095e6f1a818b03a76a03072b4c8c30d55201cb3d8bf229bf1d src/proxy/types.rs
15df425be6c7ad379920399e9f4674e126668157d64c67f5055a2b7931d8dc48 src/proxy/upstream_helpers.rs 15df425be6c7ad379920399e9f4674e126668157d64c67f5055a2b7931d8dc48 src/proxy/upstream_helpers.rs
02b56b5a7133e08ab47c9da0fdf1a807d054b2ff95efa0936a0c1d690474ce87 src/proxy/web_cache_revalidation/mod.rs 02b56b5a7133e08ab47c9da0fdf1a807d054b2ff95efa0936a0c1d690474ce87 src/proxy/web_cache_revalidation/mod.rs
5522456cc85948228250feac92308d53b130c4a7af98d24f669aca4dfe6999b6 src/proxy/web_cache_revalidation/tests.rs 22c715aeb5b41eded4dc285a352ebf9ff8875f1342d72c1bfaf54131d3317f1a src/proxy/web_cache_revalidation/tests.rs
3d591201595a3b1e928ded20a8736477a47e5acc3bcbde158f7c17547ce155ba src/proxy/websocket.rs 3d591201595a3b1e928ded20a8736477a47e5acc3bcbde158f7c17547ce155ba src/proxy/websocket.rs
aa58bacc35458ac615680e774a235191f80abf0db978b68095571fce94c2b502 src/proxy/websocket/handshake.rs aa58bacc35458ac615680e774a235191f80abf0db978b68095571fce94c2b502 src/proxy/websocket/handshake.rs
02eae55007334a289c974c0a050ebe9360822574e5982950245a18e1af05a9fc src/proxy/websocket/http2_tests.rs 02eae55007334a289c974c0a050ebe9360822574e5982950245a18e1af05a9fc src/proxy/websocket/http2_tests.rs
@@ -627,21 +628,21 @@ fc8af7342a3b147921e9040116af5dfe680b3df910db2416ada18198bbeea7df src/vhost/redi
5a5768740e9a486436f6bb4e285ed99fd445cabbc21f317a47dc32c1f7091385 src/vhost/tests.rs 5a5768740e9a486436f6bb4e285ed99fd445cabbc21f317a47dc32c1f7091385 src/vhost/tests.rs
34ffb202075c9fa720d2a23c6d901471655befe583a6335d778391d467cc8186 src/vhost/validation.rs 34ffb202075c9fa720d2a23c6d901471655befe583a6335d778391d467cc8186 src/vhost/validation.rs
8d1eff4b24f01d137414ef5419f75dd281879228adb70409645b11b3c78c20e9 src/web_server/config.rs 8d1eff4b24f01d137414ef5419f75dd281879228adb70409645b11b3c78c20e9 src/web_server/config.rs
9744e8c29ae72a4d9fbc9a76166a97f8292c4c312295ea40d1cb699e03d80a9d src/web_server/config/compile.rs 21b7872f9672d3a95647496977ca7c5dcde4c4c90d2f5f17260abf17ad24945b src/web_server/config/compile.rs
5ed79fa5b9c53f95ca200d89a9ba927dda816b61fbdf3b852bd3c9670e3d2d4f src/web_server/config/model.rs a4d394582f34ab16bb046780d4f755c6bbcc6afb497b03e277980750ab2e5f25 src/web_server/config/model.rs
a863ad1337fbc353c0f42caea4ac8b3644792e2aa08c37f992b7882b4b8dc6d5 src/web_server/config/validation.rs 9a3056d371219b7327d612b40b89587a0c30c7f8487386ba95e69050d0bdf11f src/web_server/config/validation.rs
86c744216d7132d8294a6e90ba9be5fd871646006313d1c62506d40c81db9b12 src/web_server/fastcgi.rs 86c744216d7132d8294a6e90ba9be5fd871646006313d1c62506d40c81db9b12 src/web_server/fastcgi.rs
54aa2dc94df97faabd4859a9dafe6a7cb1ba3337bfef5fa51a4432097a985d88 src/web_server/fastcgi/protocol.rs d15716d8fa0d722e3189367fd395cac71c2f2a178335120a74a01696abc7cc04 src/web_server/fastcgi/protocol.rs
fbaf972f9dd2842ec7df2878f0105c9ef4a877817f037f2332c4d5baabf2ead9 src/web_server/fastcgi/response.rs 6b24c3ed2249e7c0d29ab27a5bc8ea05527a2a0314ae067acd6035327db3e814 src/web_server/fastcgi/response.rs
92d2ab4d7ecb766bbc705f8eba94c1ca33347ffb84b36e0ad0eccfed5915473f src/web_server/filesystem.rs 92d2ab4d7ecb766bbc705f8eba94c1ca33347ffb84b36e0ad0eccfed5915473f src/web_server/filesystem.rs
d4fec3682532b0f2d11a0aefcd024f69fb623a39922ddb6c528a2d2de265347d src/web_server/htaccess.rs d4fec3682532b0f2d11a0aefcd024f69fb623a39922ddb6c528a2d2de265347d src/web_server/htaccess.rs
b4646f705e532f682d6152b6827cc7f4f915766ebcb4af89eba9950965673772 src/web_server/htaccess/model.rs 0b5060ea681bc35085511658d0d92d276aa39aa5c44cbab8b2adbdad84a05b8e src/web_server/htaccess/model.rs
a484113f2c1fea4e98a437acd8a28be6490d7e612f160a8728ceeaadd363f8ee src/web_server/htaccess/parse.rs 2f8b33e736a49f5518360bf2be433dfdb0641eb00474da83cf7f2d255d6184d5 src/web_server/htaccess/parse.rs
6e58e2674940bb0284035856fe9299a0555fee4c566de75e174deb373c3b164f src/web_server/htaccess/rewrite.rs 8dce3855a191fea50962cd7e1132335e422047c9c41e7f5e1b3b023e25675131 src/web_server/htaccess/rewrite.rs
8ca74d9cc4470045301f70eb4a9fbabd0dbfe74434429148d2230df9f996c06c src/web_server/htaccess/tests.rs 8ca74d9cc4470045301f70eb4a9fbabd0dbfe74434429148d2230df9f996c06c src/web_server/htaccess/tests.rs
7fe32af33b4d8e079ad724665aa1cfb62f6e98b9406b77168feaac55dac36137 src/web_server/metrics.rs 7fe32af33b4d8e079ad724665aa1cfb62f6e98b9406b77168feaac55dac36137 src/web_server/metrics.rs
0f74d1fad9bc20a5f2ea1753381459c072cd8068cb13e7dfbc74e33eb3ace593 src/web_server/mod.rs ee29a033d138001b9c304f28dbdf079031e58a0fd29d59c1834107be52a5fdbf src/web_server/mod.rs
e9ba6e09ba2c8f8a33410c219d5ea29214cc53e279a43b17c110d24f17a5a71d src/web_server/request.rs f27e483737d17c73200b227b2720bfd79333bfd6abbe34ed9f73906f373a8a4e src/web_server/request.rs
d98c80663847d6d83073df074ebff65952755415574708abcc153bd8d3adfaa9 src/web_server/response.rs d98c80663847d6d83073df074ebff65952755415574708abcc153bd8d3adfaa9 src/web_server/response.rs
b38a1c9e648e3606a534ebdf74f6315863a326c6de1ca8edc433abe9c1fed7b4 src/web_server/response/file.rs b38a1c9e648e3606a534ebdf74f6315863a326c6de1ca8edc433abe9c1fed7b4 src/web_server/response/file.rs
df87b67c75bbe58d7e077ed4c4cfa105ec680e89dd0c25af7dbd793d418a01ad src/web_server/response/file_body/mod.rs df87b67c75bbe58d7e077ed4c4cfa105ec680e89dd0c25af7dbd793d418a01ad src/web_server/response/file_body/mod.rs
@@ -649,8 +650,8 @@ e5f5fbe702f66bfcbcbc1d1f3cd3d89bdbb929bb86aed94868a2a06a4b9e59e3 src/web_server
7da903c1a69be0ae6b85772b3208c518679efa8ed9d3e98adb694483518156b6 src/web_server/response/headers.rs 7da903c1a69be0ae6b85772b3208c518679efa8ed9d3e98adb694483518156b6 src/web_server/response/headers.rs
2665d4eac9a6430d68224874784cb65d9b9d424353af77735caf044401d08cb4 src/web_server/routing.rs 2665d4eac9a6430d68224874784cb65d9b9d424353af77735caf044401d08cb4 src/web_server/routing.rs
9e584eb4455a18641c2c89f9e9725745c93f32877abf0f0f2fbea9e3d5ef38c3 src/web_server/security.rs 9e584eb4455a18641c2c89f9e9725745c93f32877abf0f0f2fbea9e3d5ef38c3 src/web_server/security.rs
b791762b4ab7a43c3be19df84e523faf3dfb4df055f66d02178f93edb60d2204 src/web_server/serve.rs 42937064cd38468b0c2e2f57b810bee9df9e6568e74d1ab3d805ea9a39259375 src/web_server/serve.rs
714418c86ab241020a561fcf662a8fe324a6a70cc2fd3a313c56d7939c14b9e8 src/web_server/tests.rs 951291172a80ab57205aa10dd95e2805d0afc82f86e3c46479c96962a3853c92 src/web_server/tests.rs
f00743af2cf4a5952caef7a1dcf68e7817b5599a252a9973e1c22045517c0b0e tests/fixtures/argon2id.json f00743af2cf4a5952caef7a1dcf68e7817b5599a252a9973e1c22045517c0b0e tests/fixtures/argon2id.json
9540e9a904455a2190c2d0a32b47b1345976e4c4618767ed2b55898d13da9987 tests/fixtures/balance_rendezvous_vectors.txt 9540e9a904455a2190c2d0a32b47b1345976e4c4618767ed2b55898d13da9987 tests/fixtures/balance_rendezvous_vectors.txt
affb5c728d2d2bd58807c080f22ac17575e06486c7cca38dc13cf58ad01873ae tests/fixtures/routing_conditions_cases.json affb5c728d2d2bd58807c080f22ac17575e06486c7cca38dc13cf58ad01873ae tests/fixtures/routing_conditions_cases.json
+1 -1
View File
@@ -93,4 +93,4 @@ If all you need is a different error **page body**, use **Vhost → Pages → In
## Not an Nginx configuration parser ## Not an Nginx configuration parser
The editor does not run arbitrary Nginx snippets, filesystem aliases, arbitrary `if` rules or per-location static roots. Configure static paths in a reusable Web Service, then assign that service to the location. Inspect [Vhosts](VHOSTS.md) and [Access](ACCESS.md) for the policies applied before connecting to the backend. The editor does not run arbitrary Nginx snippets, filesystem aliases, arbitrary `if` rules or per-location static roots. Configure static paths in a reusable Web Service, then assign that service to the location. For PHP, CGI and other FastCGI scripts, mount a dedicated Web Service with its own document root, backend socket, extensions and public `SCRIPT_NAME` prefix; see [FastCGI / CGI](FASTCGI.md). Inspect [Vhosts](VHOSTS.md) and [Access](ACCESS.md) for the policies applied before connecting to the backend.
+110
View File
@@ -0,0 +1,110 @@
# FastCGI and CGI applications in the Web Server
RustProxy 0.42.2 can serve executable application scripts through **existing external FastCGI backends**. It does not embed PHP, execute scripts in the RustProxy process, start a CGI worker, or parse Nginx/Angie configuration files. The routing and application settings are generic: they work with PHP sites, CGI control panels, monitoring tools, custom FastCGI applications, and other programs using compatible FastCGI responders.
## Supported backends
Select **Web Server → Web Service → PHP-FPM / FastCGI → Handler** (or edit a shared profile). The persisted field is `php.handler` for backwards compatibility; older `php` configurations still default to `php_fpm`.
| Handler (`php.handler`) | Use | Example `php.endpoint` | Example `php.extensions` |
|---|---|---|---|
| `php_fpm` | Existing PHP-FPM pool | `unix:/run/php/site.sock` | `php`, `phtml` |
| `fcgiwrap` | Existing CGI scripts executed by a separately running **fcgiwrap** service | `unix:/run/fcgiwrap.socket` | `cgi`, `pl` |
| `fastcgi` | Other compatible FastCGI responders (no CGI process launcher built into RustProxy) | `tcp:127.0.0.1:9001` | `fcgi` |
All handlers support Unix sockets (`unix:/absolute/path.sock`) and local TCP (`tcp:127.0.0.1:port` or `tcp:[::1]:port`). TCP is deliberately restricted to loopback. FastCGI must **not** be exposed on a public interface. The backend process must already be running, and the RustProxy service account must be able to connect to its socket. The configured `php.extensions` determine which *existing files* are executable; everything else follows static-file policy, except that a `fcgiwrap` Web Service deliberately refuses to serve ordinary files and directory listings to avoid leaking CGI source or adjacent configuration. PHP extensions can only be assigned to `php_fpm`; `PHP_VALUE` and `PHP_ADMIN_VALUE` are PHP-FPM-only.
The existing **PHP-FPM profiles** section also stores the new handler choices without changing existing profile IDs. Create a separate Web Service/profile for different document roots, handler types, sockets, or trust boundaries. Each Web Service has one FastCGI handler; combine several services under one domain with **Vhost → Custom locations** rather than attempting to paste Nginx `location` or `fastcgi_pass` directives.
## How paths are mapped
When a request is routed to a Web Service, RustProxy resolves the effective path **inside that service's `document_root`**. The path is validated and the script must exist as a regular file; symlinks are disallowed for FastCGI script execution. The FastCGI request contains:
| Parameter | Source and behavior |
|---|---|
| `SCRIPT_FILENAME` | Canonical Web Service document root plus the validated effective script path; never taken from an HTTP header or arbitrary custom FastCGI parameter. |
| `SCRIPT_NAME` | `php.script_name_prefix` + effective script path. Leave the prefix empty for normal mounts. Set it to the public URL prefix stripped/replaced by the Vhost location, such as `/portal/cgi-bin`. |
| `REQUEST_URI` | Original public path and query, for example `/portal/cgi-bin/status.cgi?view=1`. |
| `QUERY_STRING` / `REQUEST_METHOD` | Request query / method. Request bodies are streamed to FastCGI. |
| `PATH_INFO` | Optional remaining `/path/info` after the existing script filename, when `php.path_info=true`. |
| `REMOTE_ADDR` / `REMOTE_PORT` | Validated request client address / port. |
| `REMOTE_USER` / `AUTH_USER` | Only set when **Vhost Basic Auth** successfully authenticated the user; never copied from an unverified `REMOTE_USER` header. |
| `HTTP_AUTHORIZATION` | Forwarded only when authorized by Vhost credential-forwarding settings and `php.pass_authorization`; disable when not needed. |
| `HTTP_*` | Selected incoming headers, with hop-by-hop/unsafe headers removed. |
Custom FastCGI parameters (`php.custom_params`) are bounded static `NAME = value` pairs. Core CGI, identity, PHP control and `HTTP_*` parameters are **reserved** to avoid spoofing `SCRIPT_FILENAME`, `REMOTE_USER` and other security-sensitive values. Dynamic Nginx expressions (`$1`, `$remote_user`, `$http_authorization`) are **not** evaluated in custom parameters; equivalent core variables are generated by RustProxy. For private per-site values, prefer backend environment configuration over secrets in the RustProxy JSON configuration.
## Generic example: static assets, PHP and executable CGI on one HTTPS domain
Suppose an application is exposed as `https://portal.example.test/console/` with these filesystem paths and processes:
```text
/srv/apps/console/public/ # index.html, assets, PHP scripts
/srv/apps/console/cgi-bin/ # executable *.cgi scripts
unix:/run/php/console.sock # existing PHP-FPM pool
unix:/run/fcgiwrap.socket # existing fcgiwrap worker
```
Create **three reusable Web Services** (one safe default, one PHP/static application root and one isolated CGI root):
| Service ID | Document root | Handler | Extensions | Public `SCRIPT_NAME` prefix |
|---|---|---|---|---|
| `empty-default` | `/srv/www/empty` (empty directory) | Disabled | — | — |
| `console-web` | `/srv/apps/console/public` | `php_fpm`, endpoint `unix:/run/php/console.sock` | `php` | `/console` |
| `console-cgi` | `/srv/apps/console/cgi-bin` | `fcgiwrap`, endpoint `unix:/run/fcgiwrap.socket` | `cgi` | `/console/cgi-bin` |
For PHP/CGI services, enable FastCGI and set `symlink_policy=deny`. The PHP Web Service safely serves regular static files **and** invokes PHP-FPM for `.php`, including `index.php`. Set `console-web.index` to `index.php, index.html` and adjust `try_files` to the application's needs. Keep non-executable files out of the CGI root; use filesystem permissions and socket ownership to isolate each runtime. Enable `path_info` only if `/script.php/extra` or `/script.cgi/extra` is needed.
Create a **Vhost** bound to the HTTP and HTTPS listeners, select the appropriate certificate (RustProxy ACME or an imported certificate), enable **Force HTTPS** (and HTTP/2 if desired), and choose `empty-default` as the default Web Server source to avoid unintentionally exposing the application at unprefixed `/index.php` paths. Add these **Custom locations** (keep the CGI regex rule ahead of the fallback prefix rule):
| Match type | Path/pattern | Source | Path rewrite mode and value |
|---|---|---|---|
| `regex` | `^/console/cgi-bin/(.*\.cgi(?:/.*)?)$` | `console-cgi` | `regex` → `/$1` |
| `prefix` | `/console/` | `console-web` | `strip_prefix` |
| `exact` | `/` | Redirect to `/console/` (302) | Not applicable |
| `exact` | `/console` | Redirect to `/console/` (301) | Not applicable |
The exact and regex rules use Rust's `regex` syntax, not PCRE look-arounds. `strip_prefix` and `regex` rewrite values remove the public path prefix while preserving script names. For example, `GET /console/cgi-bin/health.cgi?x=1` is processed by `console-cgi` as `/health.cgi` with `SCRIPT_FILENAME=/srv/apps/console/cgi-bin/health.cgi`, `SCRIPT_NAME=/console/cgi-bin/health.cgi` and `REQUEST_URI=/console/cgi-bin/health.cgi?x=1`. Likewise, `GET /console/index.php` or `GET /console/` (with `index.php` configured) is executed by `console-web` through PHP-FPM; `/console/assets/style.css` is served statically from that same service. An additional regex PHP location can be configured if PHP scripts need a **different** root or socket; otherwise a separate PHP regex location is unnecessary. You may also replace `console-cgi` with a `fastcgi` responder service for a compatible standalone application.
**Protect access:** Enable **Vhost Basic Auth** if the application needs it, using the existing RustProxy credential settings (or another supported authentication provider; only verified Vhost Basic Auth currently maps to `REMOTE_USER`). Avoid publishing admin/CGI directories as static paths. `deny all` for hidden files can be implemented with Vhost ACL/location rules and optional `.htaccess` security rules. Server-level HTTPS, certificate renewal, IPv6 listeners and access/error logging are configured through RustProxy listeners/Vhosts/logs, not inside FastCGI settings.
## Migrating from Nginx / Angie
| Original directive | RustProxy equivalent |
|---|---|
| `listen 80` / `listen 443 ssl` / `http2 on` | Named HTTP / HTTPS listeners, HTTPS Vhost selection, HTTP/2 setting |
| `return 302 https://$host$request_uri` | Force HTTPS (RustProxy's configured HTTPS redirect status/semantics may differ from 302) |
| `server_name` | Vhost hostnames |
| `acme` / `$acme_cert_*` | Certificates → ACME certificate and Vhost certificate selection; not Angie variable import |
| `access_log` / `error_log` | RustProxy logs and monitoring settings |
| `auth_basic` / `auth_basic_user_file` | Vhost Basic Auth / credential management, not direct use of Angie `auth_basic_user_file` lines |
| `location =` with `return` | Exact Custom location with Redirect |
| `location /prefix/` / `alias` | Web Service `document_root` plus Custom location `strip_prefix` |
| `location ~ regex` / `rewrite ... break` | Regex Custom location with regex path rewrite |
| `include fastcgi_params` / `include fastcgi-php.conf` | RustProxy generates CGI/FastCGI core parameters; no Nginx `include` parser |
| `fastcgi_pass` | Web Service FastCGI endpoint: Unix or loopback TCP |
| `fastcgi_param SCRIPT_FILENAME` / `SCRIPT_NAME` | Document root, optional URL prefix, location rewrite; do **not** override with untrusted variables |
| `fastcgi_param REMOTE_USER`, `AUTH_USER` | Verified Vhost Basic Auth identity (when available) |
| `location ~ /\.` + `deny all` | Web Service hardening and explicit restrictive ACL/location rules |
**Not a full Nginx/Angie interpreter.** RustProxy does not accept raw `server { ... }` files, Nginx `include`, arbitrary runtime `fastcgi_param` expressions, or arbitrary system-level PHP/CGI process management. Translate the routing and authentication rules into the panel/API as above. Full location, rewrite and authentication behavior is documented in [Custom locations](CUSTOM_LOCATIONS.md), [Vhosts](VHOSTS.md) and [Access](ACCESS.md).
## Verification and troubleshooting
```bash
# Check HTTP -> HTTPS and the application's protected/redirect paths:
curl -I http://portal.example.test/console/
curl -Ik https://portal.example.test/console/
# Use appropriate test credentials, if Basic Auth is enabled:
curl -ik -u operator https://portal.example.test/console/cgi-bin/health.cgi
# Direct non-executable file requests under a CGI-only root must be forbidden:
curl -Ik https://portal.example.test/console/cgi-bin/config.txt
```
- **502 / 504:** inspect the external process, socket permissions, FastCGI stderr (bounded in logs) and timeouts. A Unix socket name alone does not start `fcgiwrap` or PHP-FPM.
- **403:** check route-to-Web-Service selection, file visibility, symlink policy, script extension allowlist, Vhost authentication and `.htaccess` protection. A CGI-only root intentionally returns 403 for non-executable files.
- **404:** verify regex location captures, replacement path, actual file under `document_root`, `index` and `try_files` (note that `try_files` candidates are evaluated inside the selected Web Service).
- **Incorrect `SCRIPT_NAME` / missing authentication identity:** confirm the public `script_name_prefix`, whether the Vhost location strips/replaces the prefix, Basic Auth success and forwarding settings.
- **Browser downloads a script:** verify the active Web Service and extension. RustProxy refuses to send known executable script extensions as static files when no matching handler is configured.
The new protocol paths are covered by source-level tests using a mock FastCGI responder. Before production use, run `./dev.sh check` and `./dev.sh test` with the project toolchain and exercise real PHP-FPM and fcgiwrap instances; mock responders cannot prove OS-level script execution.
+1 -1
View File
@@ -35,7 +35,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
- `try_files`, regex rewrites and a safe subset of Apache `.htaccess` rules. - `try_files`, regex rewrites and a safe subset of Apache `.htaccess` rules.
- Conditional requests (`ETag`, `Last-Modified`), byte ranges, precompressed `.br`/`.gz` sidecars and optional Linux `sendfile`. - Conditional requests (`ETag`, `Last-Modified`), byte ranges, precompressed `.br`/`.gz` sidecars and optional Linux `sendfile`.
- Symlink policy, attack-probe blocking and header hardening presets. - Symlink policy, attack-probe blocking and header hardening presets.
- PHP through external PHP-FPM with shared profiles, per-application pools and resource limits. - External FastCGI: PHP-FPM pools, CGI scripts via fcgiwrap, and generic FastCGI responders; Unix or loopback TCP endpoints, script allowlists, SCRIPT_NAME mount prefixes, PATH_INFO, bounded request/resource limits, Vhost location routing and shared profiles.
- Presets for single-page apps, WordPress and Roundcube. - Presets for single-page apps, WordPress and Roundcube.
![Web Server editor](images/web-server.png) ![Web Server editor](images/web-server.png)
+1 -1
View File
@@ -1,6 +1,6 @@
# PHP-FPM with Web Services # PHP-FPM with Web Services
RustProxy's Web Server supports **FastCGI** forwarding to an existing **PHP-FPM** pool for configured script extensions. RustProxy does not include a PHP interpreter or run the PHP application itself. RustProxy's Web Server supports **FastCGI** forwarding to an existing **PHP-FPM** pool for configured script extensions. For non-PHP CGI programs, fcgiwrap and other FastCGI responders, see the general [FastCGI guide](FASTCGI.md). RustProxy does not include a PHP interpreter or run the PHP application itself.
## Before enabling PHP ## Before enabling PHP
+1
View File
@@ -26,6 +26,7 @@ Guides for operating RustProxy: installation, publishing services, security, cer
- [Custom locations](CUSTOM_LOCATIONS.md) — path routing, request conditions (header, cookie, IP, method, country), whole-host rules, rewrites, local responses and error fallbacks. - [Custom locations](CUSTOM_LOCATIONS.md) — path routing, request conditions (header, cookie, IP, method, country), whole-host rules, rewrites, local responses and error fallbacks.
- [Load balancing](LOAD_BALANCING.md) — algorithms, consistent hashing by path/header/cookie/query/IP, location backend groups and the distribution simulator. - [Load balancing](LOAD_BALANCING.md) — algorithms, consistent hashing by path/header/cookie/query/IP, location backend groups and the distribution simulator.
- [Web Server](WEB_SERVER.md) — static sites, downloads, `try_files`, rewrites, `.htaccess` subset and error pages. - [Web Server](WEB_SERVER.md) — static sites, downloads, `try_files`, rewrites, `.htaccess` subset and error pages.
- [FastCGI and CGI](FASTCGI.md) — generic PHP-FPM, fcgiwrap and FastCGI responder configuration; Vhost mounts, scripts, identity, tests.
- [PHP-FPM](PHP_FPM.md) — PHP profiles, pool isolation and application examples. - [PHP-FPM](PHP_FPM.md) — PHP profiles, pool isolation and application examples.
- [HTTP transport and TLS](TRANSPORT.md) — HTTPS, HTTP/2, HTTP/3, WebSockets, backend protocols and post-quantum key exchange. - [HTTP transport and TLS](TRANSPORT.md) — HTTPS, HTTP/2, HTTP/3, WebSockets, backend protocols and post-quantum key exchange.
- [TCP/UDP Streams](STREAMS.md) — non-HTTP forwarding. - [TCP/UDP Streams](STREAMS.md) — non-HTTP forwarding.
+8 -4
View File
@@ -1,13 +1,13 @@
# Web Server — static sites, downloads and routing # Web Server — static sites, downloads and routing
The built-in Web Server serves local files and, optionally, passes PHP scripts to an **external PHP-FPM service**. A reusable **Web Service** is referenced by a Vhost or by a Custom location. Its files and PHP settings are not duplicated in the Vhost. The built-in Web Server serves local files and can forward executable scripts to **external PHP-FPM, fcgiwrap or generic FastCGI responders**. A reusable **Web Service** is referenced by a Vhost or by a Custom location. Its files and PHP settings are not duplicated in the Vhost.
## Create a Web Service ## Create a Web Service
1. Open **Web Server → New Web Service**. Choose an ID/name and an absolute document root readable by the RustProxy service account. 1. Open **Web Server → New Web Service**. Choose an ID/name and an absolute document root readable by the RustProxy service account.
2. Set index files (default `index.html`, `index.htm`), whether directory listing is allowed (off by default), MIME handling and download extensions. 2. Set index files (default `index.html`, `index.htm`), whether directory listing is allowed (off by default), MIME handling and download extensions.
3. Add `try_files`, rewrites and response headers only if your application requires them. VCL-style cache rules (including `pass` / `cookie_pass`) are **not** evaluated for Web Server sources; the static-extension Cookie option and the regular cache policy still apply to local files. 3. Add `try_files`, rewrites and response headers only if your application requires them. VCL-style cache rules (including `pass` / `cookie_pass`) are **not** evaluated for Web Server sources; the static-extension Cookie option and the regular cache policy still apply to local files.
4. Enable PHP only if you have a reachable, protected PHP-FPM endpoint; otherwise static files do not need any PHP runtime. 4. Enable FastCGI only if you have a reachable, protected external PHP-FPM pool, CGI runner or compatible FastCGI responder; otherwise static files do not need an executable runtime.
5. Save, create or edit a **Vhost**, select **Web Server** as source and choose the service ID. 5. Save, create or edit a **Vhost**, select **Web Server** as source and choose the service ID.
6. Test index files, static assets, missing files, direct directory access, downloads and headers. 6. Test index files, static assets, missing files, direct directory access, downloads and headers.
@@ -57,13 +57,17 @@ The editor supports common website presets to fill suggested fields; review thei
An optional bounded Apache-style `.htaccess` compatibility layer supports a **subset** of rules useful for migrations, not arbitrary Apache modules or dynamic directive execution. It can scan configured paths and enforce stricter handling of unsupported expressions. Prefer explicit `try_files`/rewrite/header controls when possible and test migrated sites. A real Apache configuration cannot be pasted unchanged into RustProxy. An optional bounded Apache-style `.htaccess` compatibility layer supports a **subset** of rules useful for migrations, not arbitrary Apache modules or dynamic directive execution. It can scan configured paths and enforce stricter handling of unsupported expressions. Prefer explicit `try_files`/rewrite/header controls when possible and test migrated sites. A real Apache configuration cannot be pasted unchanged into RustProxy.
With **Strict unsupported-directive mode disabled**, harmless unimplemented directives (such as `ErrorDocument` and unsupported `Options` tokens) are skipped and logged as warnings during Web Service validation/apply; inspect the server logs or expand **Skipped .htaccess directives** on the Web Service card for file/line locations. They do **not** become active Apache functionality. Unsupported security/handler syntax is still rejected to avoid unintentionally exposing protected content.
For common Apache 2.2 migrations, `Order deny,allow`, `Order allow,deny`, `Order mutual-failure`, `Allow from all` / `Deny from all`, and `Allow from` / `Deny from` explicit IP addresses or CIDR networks (IPv4/IPv6) are supported and **enforced** using the actual client IP. For instance, `Deny from all` blocks the affected directory, returning HTTP 403; it is not silently ignored. `Order allow,deny` denies unmatched clients by default, while `Order deny,allow` allows them by default. Hostname-based ACLs and other unsupported access/authentication constructs fail validation even with Strict disabled. Test allow/deny cases after migrating; legacy access rules are not a general Apache authorization emulator.
## Admin editor layout ## Admin editor layout
In **Web Server → Edit → Delivery**, static file delivery, dynamic compression and precompressed assets have separate sections. In **PHP-FPM**, profile/endpoint, request options, resource limits and FastCGI/php.ini overrides are grouped. Disabled local controls indicate that PHP is off or a shared profile owns those settings; selection and saved values behave as before. In **Web Server → Edit → Delivery**, static file delivery, dynamic compression and precompressed assets have separate sections. In **PHP-FPM**, profile/endpoint, request options, resource limits and FastCGI/php.ini overrides are grouped. Disabled local controls indicate that PHP is off or a shared profile owns those settings; selection and saved values behave as before.
## PHP and error responses ## FastCGI and error responses
A Web Service may enable PHP via a shared PHP-FPM profile or its own configuration. PHP is executed by the FPM service, not RustProxy, and must not be exposed as a raw Internet port. Use dedicated pools for different applications. See [PHP-FPM](PHP_FPM.md). A Web Service may use external PHP-FPM, fcgiwrap or another FastCGI responder via its local settings or an existing shared profile. RustProxy does not execute scripts itself. Combine multiple Web Services (distinct document roots, extensions and endpoints) using Vhost Custom locations; see the generic [FastCGI guide](FASTCGI.md). Existing PHP-FPM pool isolation rules continue to apply; see [PHP-FPM](PHP_FPM.md).
Missing static files return **HTTP 404 Not Found**, unreadable/blocked paths **403 Forbidden**, unsupported static methods **405 Method Not Allowed** (with `Allow: GET, HEAD`), and internal failures **500 Internal Server Error**. The built-in Web Server now uses the existing **application-style HTML error pages** for statuses with a bundled template (including 400, 403, 404, 500 and PHP-FPM gateway errors). Other generated error statuses, such as 405, use the shared styled HTML fallback. The regular built-in 502 is styled with RustProxy branding; auth-specific Tinyauth failure pages have their own wording and are served before any origin application is accessed. Neither internal filesystem paths nor `RustProxy: Web Server ...` diagnostics are included in the public body. Details for 5xx filesystem failures remain in server logs. Missing static files return **HTTP 404 Not Found**, unreadable/blocked paths **403 Forbidden**, unsupported static methods **405 Method Not Allowed** (with `Allow: GET, HEAD`), and internal failures **500 Internal Server Error**. The built-in Web Server now uses the existing **application-style HTML error pages** for statuses with a bundled template (including 400, 403, 404, 500 and PHP-FPM gateway errors). Other generated error statuses, such as 405, use the shared styled HTML fallback. The regular built-in 502 is styled with RustProxy branding; auth-specific Tinyauth failure pages have their own wording and are served before any origin application is accessed. Neither internal filesystem paths nor `RustProxy: Web Server ...` diagnostics are included in the public body. Details for 5xx filesystem failures remain in server logs.
+21 -15
View File
@@ -2079,7 +2079,7 @@
"webServiceTabMime": "MIME", "webServiceTabMime": "MIME",
"webServiceTabCacheHeaders": "Cache & headers", "webServiceTabCacheHeaders": "Cache & headers",
"webServiceTabDelivery": "Delivery", "webServiceTabDelivery": "Delivery",
"webServiceTabPhp": "PHP-FPM", "webServiceTabPhp": "FastCGI / PHP",
"webServiceTabSecurity": "Security", "webServiceTabSecurity": "Security",
"webServiceId": "Service ID", "webServiceId": "Service ID",
"webServiceName": "Name", "webServiceName": "Name",
@@ -2135,7 +2135,7 @@
"webServicePhpValuesInvalid": "PHP INI overrides must use one unique directive = value entry per line.", "webServicePhpValuesInvalid": "PHP INI overrides must use one unique directive = value entry per line.",
"webServicePhpDocsButton": "FastCGI syntax and safety", "webServicePhpDocsButton": "FastCGI syntax and safety",
"webServicePhpDocsTitle": "PHP-FPM / FastCGI configuration", "webServicePhpDocsTitle": "PHP-FPM / FastCGI configuration",
"webServicePhpDocsIntro": "RustProxy connects directly to an existing PHP-FPM pool. Prefer a Unix socket on the same host. TCP is accepted only on loopback and is not a public/network FastCGI transport.", "webServicePhpDocsIntro": "RustProxy connects to existing PHP-FPM pools, CGI runners such as fcgiwrap, or compatible FastCGI responders. Use a trusted Unix socket or a loopback-only TCP endpoint; never expose a FastCGI socket publicly.",
"webServicePhpDocsEndpointTitle": "Endpoint syntax", "webServicePhpDocsEndpointTitle": "Endpoint syntax",
"webServicePhpDocsEndpoint": "Use unix: plus full socket path, or tcp: plus a literal loopback IP and port. TCP hostnames/public addresses are rejected. Use distinct FPM sockets for applications with different PHP INI restrictions.", "webServicePhpDocsEndpoint": "Use unix: plus full socket path, or tcp: plus a literal loopback IP and port. TCP hostnames/public addresses are rejected. Use distinct FPM sockets for applications with different PHP INI restrictions.",
"webServicePhpDocsCustomTitle": "Custom FastCGI parameters", "webServicePhpDocsCustomTitle": "Custom FastCGI parameters",
@@ -2144,9 +2144,9 @@
"webServicePhpDocsValues": "These lines go into PHP_VALUE. Use the separate PHP_ADMIN_VALUE field for trusted administrative settings; neither one isolates workers sharing the same PHP-FPM pool.", "webServicePhpDocsValues": "These lines go into PHP_VALUE. Use the separate PHP_ADMIN_VALUE field for trusted administrative settings; neither one isolates workers sharing the same PHP-FPM pool.",
"webServicePhpDocsLimitsTitle": "Limits and headers", "webServicePhpDocsLimitsTitle": "Limits and headers",
"webServicePhpDocsLimits": "Request timeout covers the FastCGI exchange. The body limit is enforced while streaming and returns 413 when exceeded; 0 disables the RustProxy-side body limit. Response-header and stderr limits bound memory/diagnostic data. Up to 64 custom FastCGI parameters and 64 PHP INI overrides are accepted, with at most 128 KiB of combined custom data. Authorization forwarding can be disabled for applications that do not need HTTP_AUTHORIZATION.", "webServicePhpDocsLimits": "Request timeout covers the FastCGI exchange. The body limit is enforced while streaming and returns 413 when exceeded; 0 disables the RustProxy-side body limit. Response-header and stderr limits bound memory/diagnostic data. Up to 64 custom FastCGI parameters and 64 PHP INI overrides are accepted, with at most 128 KiB of combined custom data. Authorization forwarding can be disabled for applications that do not need HTTP_AUTHORIZATION.",
"webServicePhpDocsSecurity": "Do not put secrets in custom parameters or PHP_VALUE unless you accept storing them in normal Web Service configuration. Use a dedicated non-root PHP-FPM pool identity and keep PHP-FPM off public networks.", "webServicePhpDocsSecurity": "A CGI runner executes local scripts with its own OS identity. Restrict socket access and script filesystem permissions; use separate Web Services for different script roots or handlers. Protect the public Vhost with authentication and access rules where necessary. Avoid storing secrets in plain FastCGI parameter overrides.",
"webServicePhpHelp": "RustProxy speaks FastCGI directly to a long-running PHP-FPM pool. PHP is not spawned per request and PHP source is never served when PHP handling is selected.", "webServicePhpHelp": "RustProxy forwards configured script extensions to an existing FastCGI responder: PHP-FPM, fcgiwrap or another compatible backend. It does not start processes.",
"webServicePhpSymlinkConflict": "PHP-FPM currently requires the symlink policy to be Deny.", "webServicePhpSymlinkConflict": "FastCGI script execution requires symlink policy Deny.",
"webServiceSymlinkPolicy": "Symlink policy", "webServiceSymlinkPolicy": "Symlink policy",
"webServiceSymlinkDeny": "Deny", "webServiceSymlinkDeny": "Deny",
"webServiceSymlinkInsideRoot": "Allow only inside document root (Linux)", "webServiceSymlinkInsideRoot": "Allow only inside document root (Linux)",
@@ -2227,6 +2227,8 @@
"webServiceHtaccessRecursive": "Scan subdirectories", "webServiceHtaccessRecursive": "Scan subdirectories",
"webServiceHtaccessStrict": "Strict unsupported-directive mode", "webServiceHtaccessStrict": "Strict unsupported-directive mode",
"webServiceHtaccessDocs": "Compatibility documentation", "webServiceHtaccessDocs": "Compatibility documentation",
"webServiceHtaccessWarningsCount": "Skipped .htaccess directives (ignored)",
"webServiceHtaccessStrictHelp": "With Strict off, unsupported non-security directives are skipped and logged as warnings. Order/Allow/Deny with all, IP or CIDR are enforced; unsupported access rules still block Apply.",
"webServiceHtaccessHelp": "RustProxy compiles a bounded Apache-compatible subset when the Web Service is applied. Files are not parsed on every request; apply the Web Service again after editing .htaccess on disk.", "webServiceHtaccessHelp": "RustProxy compiles a bounded Apache-compatible subset when the Web Service is applied. Files are not parsed on every request; apply the Web Service again after editing .htaccess on disk.",
"webServiceHtaccessDocsTitle": ".htaccess compatibility", "webServiceHtaccessDocsTitle": ".htaccess compatibility",
"webServiceHtaccessDocsIntro": "This is a migration-oriented compatibility layer, not a complete Apache runtime. Supported directives are compiled into RustProxy Web Server rules.", "webServiceHtaccessDocsIntro": "This is a migration-oriented compatibility layer, not a complete Apache runtime. Supported directives are compiled into RustProxy Web Server rules.",
@@ -2238,7 +2240,7 @@
"webServiceHtaccessDocsReloadTitle": "Loading and limits", "webServiceHtaccessDocsReloadTitle": "Loading and limits",
"webServiceHtaccessDocsReload": "Files are read and compiled on Validate, save and apply. RustProxy does not parse .htaccess per request. Re-apply after changing a file. The scan is bounded to 128 files, depth 16, 128 KiB per file and 1 MiB total.", "webServiceHtaccessDocsReload": "Files are read and compiled on Validate, save and apply. RustProxy does not parse .htaccess per request. Re-apply after changing a file. The scan is bounded to 128 files, depth 16, 128 KiB per file and 1 MiB total.",
"webServiceHtaccessDocsUnsupportedTitle": "Not Apache-complete", "webServiceHtaccessDocsUnsupportedTitle": "Not Apache-complete",
"webServiceHtaccessDocsUnsupported": "ErrorDocument, SetEnvIf, Redirect/RedirectMatch and FallbackResource are not implemented in this compatibility layer. General Files/FilesMatch, unsupported authentication/authorization directives, non-PHP handlers and SetHandler are rejected even when Strict mode is off because silently ignoring them could weaken access control or expose source. .htaccess/.htpasswd files are always blocked from HTTP delivery. Other unsupported non-security directives are logged and ignored unless Strict mode is enabled.", "webServiceHtaccessDocsUnsupported": "ErrorDocument, SetEnvIf, Redirect/RedirectMatch and FallbackResource are not implemented. Order/Allow/Deny with all, IP or CIDR (IPv4/IPv6) are supported and enforced. General Files/FilesMatch, unsupported authentication/authorization and hostname access directives, non-PHP handlers and SetHandler are rejected even with Strict off: ignoring them could expose protected content. .htaccess/.htpasswd are never served over HTTP. Other unsupported non-security directives are logged and skipped with Strict off.",
"webServiceHtaccessDocsSecurity": "Vhost/location ACL, authentication, error pages and response rules still remain authoritative. .htaccess cannot escape the document root, select an arbitrary FastCGI socket or override protected framing headers.", "webServiceHtaccessDocsSecurity": "Vhost/location ACL, authentication, error pages and response rules still remain authoritative. .htaccess cannot escape the document root, select an arbitrary FastCGI socket or override protected framing headers.",
"webServicePresetTitle": "Configuration preset", "webServicePresetTitle": "Configuration preset",
"webServicePreset": "Preset", "webServicePreset": "Preset",
@@ -2618,13 +2620,13 @@
"locationErrorFallbackTarget": "Error fallback target", "locationErrorFallbackTarget": "Error fallback target",
"locationErrorFallbackStatuses": "Intercepted status codes", "locationErrorFallbackStatuses": "Intercepted status codes",
"locationErrorFallbackHelp": "Optional Nginx-style error fallback. Target an enabled internal location by ID. Supported statuses: 403, 404, 500, 502, 503, 504.", "locationErrorFallbackHelp": "Optional Nginx-style error fallback. Target an enabled internal location by ID. Supported statuses: 403, 404, 500, 502, 503, 504.",
"webServicePhpPathInfo": "Enable PHP PATH_INFO splitting", "webServicePhpPathInfo": "Enable FastCGI PATH_INFO splitting",
"phpProfileSelect": "PHP-FPM configuration", "phpProfileSelect": "PHP-FPM configuration",
"phpProfileLocal": "Local configuration", "phpProfileLocal": "Local configuration",
"phpProfileHelp": "Select a shared PHP-FPM profile or configure this Web Service directly. Shared edits affect all attached services.", "phpProfileHelp": "Select a shared FastCGI profile or configure this Web Service directly. Shared edits affect all attached services.",
"phpProfileManage": "Manage PHP-FPM profiles", "phpProfileManage": "Manage FastCGI profiles",
"phpProfileToolbar": "PHP-FPM profiles", "phpProfileToolbar": "FastCGI profiles",
"phpProfileTitle": "Shared PHP-FPM profiles", "phpProfileTitle": "Shared FastCGI profiles",
"phpProfileDescription": "Expand a profile to edit it; save applies immediately to every attached Web Service.", "phpProfileDescription": "Expand a profile to edit it; save applies immediately to every attached Web Service.",
"phpProfileAdd": "Add profile", "phpProfileAdd": "Add profile",
"phpProfileNew": "New PHP-FPM profile", "phpProfileNew": "New PHP-FPM profile",
@@ -2645,10 +2647,10 @@
"backendHealthOverridesHelp": "When unchecked, inherit the vhost health policy. Disabling monitoring keeps the backend available for explicitly pinned locations, without active probes or passive ejection. Use a custom check for an individual backend.", "backendHealthOverridesHelp": "When unchecked, inherit the vhost health policy. Disabling monitoring keeps the backend available for explicitly pinned locations, without active probes or passive ejection. Use a custom check for an individual backend.",
"cacheOnlyHits": "Show RustProxy cache diagnostics only on HIT (retain origin headers)", "cacheOnlyHits": "Show RustProxy cache diagnostics only on HIT (retain origin headers)",
"cacheDetailedStatus": "X-Cache shows STALE and REVALIDATED instead of HIT", "cacheDetailedStatus": "X-Cache shows STALE and REVALIDATED instead of HIT",
"phpHintEnabled": "Run configured PHP file extensions through an already-running PHP-FPM pool. RustProxy does not start PHP; non-PHP files remain static.", "phpHintEnabled": "Enable execution of configured script extensions through an already-running PHP-FPM, CGI runner, or FastCGI responder. The backend must be reachable.",
"phpHintPathInfo": "Split /static.php/skins/file.css into SCRIPT_FILENAME=static.php and PATH_INFO=/skins/file.css. Useful for Roundcube; usually unnecessary for WordPress. Off by default.", "phpHintPathInfo": "Split /static.php/skins/file.css into SCRIPT_FILENAME=static.php and PATH_INFO=/skins/file.css. Useful for Roundcube; usually unnecessary for WordPress. Off by default.",
"phpHintPassAuthorization": "Pass the incoming Authorization header as HTTP_AUTHORIZATION to PHP (API/Bearer/Basic authentication). Disable if not needed.", "phpHintPassAuthorization": "Pass the incoming Authorization header as HTTP_AUTHORIZATION to PHP (API/Bearer/Basic authentication). Disable if not needed.",
"phpHintExtensions": "Comma-separated extensions without leading dots: php, phtml. Only these extensions run as PHP.", "phpHintExtensions": "Only these extensions are executed by the selected backend. Use php for PHP-FPM and cgi or fcgi for compatible script handlers. Unhandled script extensions are not served as static code.",
"phpHintConnectTimeout": "PHP-FPM socket connection timeout in milliseconds: 1000 = 1 second. Range: 50–60000.", "phpHintConnectTimeout": "PHP-FPM socket connection timeout in milliseconds: 1000 = 1 second. Range: 50–60000.",
"phpHintRequestTimeout": "Timeout for the complete FastCGI request in milliseconds: 30000 = 30 seconds. Range: 100–3600000.", "phpHintRequestTimeout": "Timeout for the complete FastCGI request in milliseconds: 30000 = 30 seconds. Range: 100–3600000.",
"phpHintConcurrency": "Maximum concurrent PHP requests per service: e.g. 64. Exhaustion returns 503. Range: 1–4096.", "phpHintConcurrency": "Maximum concurrent PHP requests per service: e.g. 64. Exhaustion returns 503. Range: 1–4096.",
@@ -4434,6 +4436,10 @@
"vhJsonDraft": "Unapplied JSON edits", "vhJsonDraft": "Unapplied JSON edits",
"vhJsonReloadConfirm": "Discard the unapplied JSON edits and reload the current form values?", "vhJsonReloadConfirm": "Discard the unapplied JSON edits and reload the current form values?",
"vhJsonInvalidAcl": "Use null or an ACL object with an allow/deny default and IP/CIDR rules.", "vhJsonInvalidAcl": "Use null or an ACL object with an allow/deny default and IP/CIDR rules.",
"vhJsonInvalidPaths": "Use an array of up to 64 location objects." "vhJsonInvalidPaths": "Use an array of up to 64 location objects.",
"webServiceFastCgiHandler": "FastCGI handler",
"webServiceFastCgiHandlerHelp": "Choose a backend protocol responder: PHP-FPM executes PHP, fcgiwrap runs CGI programs, and FastCGI responder connects to any compatible application. Configure separate Web Services and Vhost locations for different roots or endpoints.",
"webServiceFastCgiScriptPrefix": "Public SCRIPT_NAME prefix",
"webServiceFastCgiScriptPrefixHelp": "When a Vhost location strips a URL mount prefix (for example /app/cgi-bin), set it here. RustProxy prepends it to SCRIPT_NAME but leaves SCRIPT_FILENAME under the document root."
} }
} }
+21 -15
View File
@@ -2079,7 +2079,7 @@
"webServiceTabMime": "MIME", "webServiceTabMime": "MIME",
"webServiceTabCacheHeaders": "Cache i nagłówki", "webServiceTabCacheHeaders": "Cache i nagłówki",
"webServiceTabDelivery": "Serwowanie", "webServiceTabDelivery": "Serwowanie",
"webServiceTabPhp": "PHP-FPM", "webServiceTabPhp": "FastCGI / PHP",
"webServiceTabSecurity": "Bezpieczeństwo", "webServiceTabSecurity": "Bezpieczeństwo",
"webServiceId": "ID usługi", "webServiceId": "ID usługi",
"webServiceName": "Nazwa", "webServiceName": "Nazwa",
@@ -2135,7 +2135,7 @@
"webServicePhpValuesInvalid": "Nadpisania PHP INI muszą mieć unikalny format dyrektywa = wartość, po jednym wpisie na linię.", "webServicePhpValuesInvalid": "Nadpisania PHP INI muszą mieć unikalny format dyrektywa = wartość, po jednym wpisie na linię.",
"webServicePhpDocsButton": "Składnia i bezpieczeństwo FastCGI", "webServicePhpDocsButton": "Składnia i bezpieczeństwo FastCGI",
"webServicePhpDocsTitle": "Konfiguracja PHP-FPM / FastCGI", "webServicePhpDocsTitle": "Konfiguracja PHP-FPM / FastCGI",
"webServicePhpDocsIntro": "RustProxy łączy się bezpośrednio z istniejącą pulą PHP-FPM. Na tym samym hoście preferuj socket Unix. TCP jest akceptowane wyłącznie na loopback i nie jest publicznym/sieciowym transportem FastCGI.", "webServicePhpDocsIntro": "RustProxy łączy się z istniejącymi pulami PHP-FPM, wykonawcami CGI (np. fcgiwrap) lub innymi responderami FastCGI. Użyj chronionego socketu Unix albo lokalnego TCP; nie wystawiaj FastCGI publicznie.",
"webServicePhpDocsEndpointTitle": "Składnia endpointu", "webServicePhpDocsEndpointTitle": "Składnia endpointu",
"webServicePhpDocsEndpoint": "Użyj unix: z pełną ścieżką gniazda albo tcp: z adresem IP loopback i portem. Nazwy DNS i publiczne adresy TCP są zabronione. Oddziel pule PHP-FPM aplikacji z różnymi ograniczeniami INI.", "webServicePhpDocsEndpoint": "Użyj unix: z pełną ścieżką gniazda albo tcp: z adresem IP loopback i portem. Nazwy DNS i publiczne adresy TCP są zabronione. Oddziel pule PHP-FPM aplikacji z różnymi ograniczeniami INI.",
"webServicePhpDocsCustomTitle": "Własne parametry FastCGI", "webServicePhpDocsCustomTitle": "Własne parametry FastCGI",
@@ -2144,9 +2144,9 @@
"webServicePhpDocsValues": "Każda linia trafia do PHP_VALUE. Zaufane ustawienia administracyjne wpisuj osobno w PHP_ADMIN_VALUE; żadne z tych pól nie izoluje procesów korzystających z tej samej puli PHP-FPM.", "webServicePhpDocsValues": "Każda linia trafia do PHP_VALUE. Zaufane ustawienia administracyjne wpisuj osobno w PHP_ADMIN_VALUE; żadne z tych pól nie izoluje procesów korzystających z tej samej puli PHP-FPM.",
"webServicePhpDocsLimitsTitle": "Limity i nagłówki", "webServicePhpDocsLimitsTitle": "Limity i nagłówki",
"webServicePhpDocsLimits": "Timeout żądania obejmuje wymianę FastCGI. Limit body jest egzekwowany podczas streamingu i po przekroczeniu zwraca 413; 0 wyłącza limit body po stronie RustProxy. Limity nagłówków odpowiedzi i stderr ograniczają pamięć/dane diagnostyczne. Dozwolone są maks. 64 własne parametry FastCGI i 64 nadpisania PHP INI, łącznie do 128 KiB danych własnych. Przekazywanie Authorization można wyłączyć, gdy aplikacja nie potrzebuje HTTP_AUTHORIZATION.", "webServicePhpDocsLimits": "Timeout żądania obejmuje wymianę FastCGI. Limit body jest egzekwowany podczas streamingu i po przekroczeniu zwraca 413; 0 wyłącza limit body po stronie RustProxy. Limity nagłówków odpowiedzi i stderr ograniczają pamięć/dane diagnostyczne. Dozwolone są maks. 64 własne parametry FastCGI i 64 nadpisania PHP INI, łącznie do 128 KiB danych własnych. Przekazywanie Authorization można wyłączyć, gdy aplikacja nie potrzebuje HTTP_AUTHORIZATION.",
"webServicePhpDocsSecurity": "Nie umieszczaj sekretów we własnych parametrach ani PHP_VALUE, jeśli nie akceptujesz ich przechowywania w zwykłej konfiguracji Web Service. Używaj osobnej, nieuprzywilejowanej tożsamości puli PHP-FPM i nie wystawiaj PHP-FPM do publicznej sieci.", "webServicePhpDocsSecurity": "Wykonawca CGI uruchamia lokalne skrypty ze swoimi uprawnieniami systemowymi. Ogranicz dostęp do socketu i katalogów, a dla różnych środowisk stosuj osobne Web Service. Gdy potrzeba, chroń Vhost autoryzacją i regułami dostępu. Nie zapisuj sekretów w jawnych parametrach FastCGI.",
"webServicePhpHelp": "RustProxy komunikuje się bezpośrednio przez FastCGI z długowieczną pulą PHP-FPM. PHP nie jest uruchamiane osobno dla każdego żądania, a kod źródłowy PHP nie jest serwowany, gdy obsługa PHP jest wybrana.", "webServicePhpHelp": "RustProxy kieruje wybrane rozszerzenia skryptów do istniejącego serwera FastCGI: PHP-FPM, fcgiwrap lub innego zgodnego backendu. Nie uruchamia procesów.",
"webServicePhpSymlinkConflict": "PHP-FPM wymaga obecnie polityki symlinków Deny.", "webServicePhpSymlinkConflict": "Wykonywanie skryptów FastCGI wymaga polityki symlinków Deny.",
"webServiceSymlinkPolicy": "Polityka symlinków", "webServiceSymlinkPolicy": "Polityka symlinków",
"webServiceSymlinkDeny": "Zabroń", "webServiceSymlinkDeny": "Zabroń",
"webServiceSymlinkInsideRoot": "Zezwól tylko wewnątrz document root (Linux)", "webServiceSymlinkInsideRoot": "Zezwól tylko wewnątrz document root (Linux)",
@@ -2227,6 +2227,8 @@
"webServiceHtaccessRecursive": "Skanuj podkatalogi", "webServiceHtaccessRecursive": "Skanuj podkatalogi",
"webServiceHtaccessStrict": "Tryb ścisły dla niewspieranych dyrektyw", "webServiceHtaccessStrict": "Tryb ścisły dla niewspieranych dyrektyw",
"webServiceHtaccessDocs": "Dokumentacja zgodności", "webServiceHtaccessDocs": "Dokumentacja zgodności",
"webServiceHtaccessWarningsCount": "Pominięte dyrektywy .htaccess (ostrzeżenia)",
"webServiceHtaccessStrictHelp": "Po wyłączeniu trybu ścisłego nieobsługiwane dyrektywy niezwiązane z bezpieczeństwem są pomijane, a ostrzeżenia trafiają do logów. Order/Allow/Deny z all, IP lub CIDR są egzekwowane; nieobsługiwane reguły dostępu nadal blokują zapis.",
"webServiceHtaccessHelp": "RustProxy kompiluje ograniczony podzbiór zgodny z Apache podczas zastosowania Web Service. Pliki nie są parsowane przy każdym żądaniu; po zmianie .htaccess na dysku zastosuj Web Service ponownie.", "webServiceHtaccessHelp": "RustProxy kompiluje ograniczony podzbiór zgodny z Apache podczas zastosowania Web Service. Pliki nie są parsowane przy każdym żądaniu; po zmianie .htaccess na dysku zastosuj Web Service ponownie.",
"webServiceHtaccessDocsTitle": "Zgodność .htaccess", "webServiceHtaccessDocsTitle": "Zgodność .htaccess",
"webServiceHtaccessDocsIntro": "To warstwa zgodności przeznaczona do migracji, a nie pełne środowisko Apache. Wspierane dyrektywy są kompilowane do reguł Web Servera RustProxy.", "webServiceHtaccessDocsIntro": "To warstwa zgodności przeznaczona do migracji, a nie pełne środowisko Apache. Wspierane dyrektywy są kompilowane do reguł Web Servera RustProxy.",
@@ -2238,7 +2240,7 @@
"webServiceHtaccessDocsReloadTitle": "Ładowanie i limity", "webServiceHtaccessDocsReloadTitle": "Ładowanie i limity",
"webServiceHtaccessDocsReload": "Pliki są odczytywane i kompilowane podczas „Validate, save and apply”. RustProxy nie parsuje .htaccess przy każdym żądaniu. Po zmianie pliku zastosuj konfigurację ponownie. Skan ma limity: 128 plików, głębokość 16, 128 KiB na plik i 1 MiB łącznie.", "webServiceHtaccessDocsReload": "Pliki są odczytywane i kompilowane podczas „Validate, save and apply”. RustProxy nie parsuje .htaccess przy każdym żądaniu. Po zmianie pliku zastosuj konfigurację ponownie. Skan ma limity: 128 plików, głębokość 16, 128 KiB na plik i 1 MiB łącznie.",
"webServiceHtaccessDocsUnsupportedTitle": "To nie jest pełny Apache", "webServiceHtaccessDocsUnsupportedTitle": "To nie jest pełny Apache",
"webServiceHtaccessDocsUnsupported": "ErrorDocument, SetEnvIf, Redirect/RedirectMatch i FallbackResource nie są zaimplementowane w tej warstwie. Ogólne Files/FilesMatch, niewspierane dyrektywy uwierzytelniania/autoryzacji, handlery inne niż PHP i SetHandler są odrzucane nawet przy wyłączonym trybie ścisłym, ponieważ ich ciche pominięcie mogłoby osłabić kontrolę dostępu lub ujawnić kod źródłowy. Pliki .htaccess/.htpasswd są zawsze blokowane przed wysłaniem przez HTTP. Pozostałe niewspierane dyrektywy niesecurity są logowane i ignorowane, chyba że włączono tryb ścisły.", "webServiceHtaccessDocsUnsupported": "ErrorDocument, SetEnvIf, Redirect/RedirectMatch i FallbackResource nie są zaimplementowane. Order/Allow/Deny z all, IP lub CIDR (IPv4/IPv6) są obsługiwane i egzekwowane. Ogólne Files/FilesMatch, nieobsługiwane dyrektywy uwierzytelniania/autoryzacji i reguły dostępu po nazwie hosta, handlery inne niż PHP oraz SetHandler są odrzucane nawet przy wyłączonym trybie ścisłym, ponieważ ich zignorowanie mogłoby ujawnić chronione zasoby. Pliki .htaccess/.htpasswd nigdy nie są udostępniane przez HTTP. Pozostałe nieobsługiwane dyrektywy niezwiązane z bezpieczeństwem są logowane i pomijane przy wyłączonym trybie ścisłym.",
"webServiceHtaccessDocsSecurity": "ACL vhost/location, uwierzytelnianie, strony błędów i reguły odpowiedzi nadal mają nadrzędną rolę. .htaccess nie może wyjść poza document root, wybrać dowolnego socketu FastCGI ani nadpisać chronionych nagłówków transportowych.", "webServiceHtaccessDocsSecurity": "ACL vhost/location, uwierzytelnianie, strony błędów i reguły odpowiedzi nadal mają nadrzędną rolę. .htaccess nie może wyjść poza document root, wybrać dowolnego socketu FastCGI ani nadpisać chronionych nagłówków transportowych.",
"webServicePresetTitle": "Preset konfiguracji", "webServicePresetTitle": "Preset konfiguracji",
"webServicePreset": "Preset", "webServicePreset": "Preset",
@@ -2618,13 +2620,13 @@
"locationErrorFallbackTarget": "Cel fallbacku błędów", "locationErrorFallbackTarget": "Cel fallbacku błędów",
"locationErrorFallbackStatuses": "Przechwytywane kody statusu", "locationErrorFallbackStatuses": "Przechwytywane kody statusu",
"locationErrorFallbackHelp": "Opcjonalny fallback błędów w stylu Nginx. Wskaż ID włączonej lokalizacji wewnętrznej. Obsługiwane statusy: 403, 404, 500, 502, 503, 504.", "locationErrorFallbackHelp": "Opcjonalny fallback błędów w stylu Nginx. Wskaż ID włączonej lokalizacji wewnętrznej. Obsługiwane statusy: 403, 404, 500, 502, 503, 504.",
"webServicePhpPathInfo": "Włącz rozdzielanie PHP PATH_INFO", "webServicePhpPathInfo": "Włącz dzielenie FastCGI PATH_INFO",
"phpProfileSelect": "Konfiguracja PHP-FPM", "phpProfileSelect": "Konfiguracja PHP-FPM",
"phpProfileLocal": "Konfiguracja lokalna", "phpProfileLocal": "Konfiguracja lokalna",
"phpProfileHelp": "Wybierz wspólny profil PHP-FPM lub skonfiguruj usługę samodzielnie. Zmiana profilu dotyczy wszystkich przypiętych usług.", "phpProfileHelp": "Wybierz współdzielony profil FastCGI lub skonfiguruj usługę lokalnie. Zmiany profilu dotyczą wszystkich przypiętych usług.",
"phpProfileManage": "Zarządzaj profilami PHP-FPM", "phpProfileManage": "Zarządzaj profilami FastCGI",
"phpProfileToolbar": "Profile PHP-FPM", "phpProfileToolbar": "Profile FastCGI",
"phpProfileTitle": "Wspólne profile PHP-FPM", "phpProfileTitle": "Wspólne profile FastCGI",
"phpProfileDescription": "Rozwiń profil, aby go zmienić. Zapis od razu aktualizuje wszystkie przypięte serwery WWW.", "phpProfileDescription": "Rozwiń profil, aby go zmienić. Zapis od razu aktualizuje wszystkie przypięte serwery WWW.",
"phpProfileAdd": "Dodaj profil", "phpProfileAdd": "Dodaj profil",
"phpProfileNew": "Nowy profil PHP-FPM", "phpProfileNew": "Nowy profil PHP-FPM",
@@ -2645,10 +2647,10 @@
"backendHealthOverridesHelp": "Bez nadpisania backend dziedziczy ustawienia vhosta. Wylaczenie monitorowania nie blokuje lokalizacji przypisanych do backendu, ale wylacza probe aktywna i pasywne wykluczanie.", "backendHealthOverridesHelp": "Bez nadpisania backend dziedziczy ustawienia vhosta. Wylaczenie monitorowania nie blokuje lokalizacji przypisanych do backendu, ale wylacza probe aktywna i pasywne wykluczanie.",
"cacheOnlyHits": "Pokazuj naglowki RustProxy tylko dla HIT (zachowaj naglowki backendu)", "cacheOnlyHits": "Pokazuj naglowki RustProxy tylko dla HIT (zachowaj naglowki backendu)",
"cacheDetailedStatus": "X-Cache pokazuje STALE i REVALIDATED zamiast HIT", "cacheDetailedStatus": "X-Cache pokazuje STALE i REVALIDATED zamiast HIT",
"phpHintEnabled": "Uruchamia pliki o wskazanych rozszerzeniach przez już działającą pulę PHP-FPM. RustProxy nie uruchamia PHP; inne pliki nadal są statyczne.", "phpHintEnabled": "Włącz wykonywanie wybranych rozszerzeń przez już uruchomiony PHP-FPM, wykonawcę CGI lub serwer FastCGI. Backend musi być dostępny.",
"phpHintPathInfo": "Rozdziela /static.php/skins/file.css na SCRIPT_FILENAME=static.php i PATH_INFO=/skins/file.css. Potrzebne np. w Roundcube; zwykle zbędne w WordPressie. Domyślnie wyłączone.", "phpHintPathInfo": "Rozdziela /static.php/skins/file.css na SCRIPT_FILENAME=static.php i PATH_INFO=/skins/file.css. Potrzebne np. w Roundcube; zwykle zbędne w WordPressie. Domyślnie wyłączone.",
"phpHintPassAuthorization": "Przekazuje nagłówek Authorization do PHP jako HTTP_AUTHORIZATION (np. API/Bearer/Basic). Wyłącz, gdy aplikacja go nie używa.", "phpHintPassAuthorization": "Przekazuje nagłówek Authorization do PHP jako HTTP_AUTHORIZATION (np. API/Bearer/Basic). Wyłącz, gdy aplikacja go nie używa.",
"phpHintExtensions": "Rozszerzenia oddzielone przecinkami, bez kropek: php, phtml. Tylko te rozszerzenia uruchamiają PHP.", "phpHintExtensions": "Tylko te rozszerzenia uruchamia wybrany backend. Dla PHP-FPM użyj php, dla CGI/FastCGI np. cgi lub fcgi. Pozostały kod wykonywalny nie jest serwowany jako plik statyczny.",
"phpHintConnectTimeout": "Limit łączenia z gniazdem PHP-FPM w milisekundach: 1000 = 1 sekunda. Zakres: 50–60000.", "phpHintConnectTimeout": "Limit łączenia z gniazdem PHP-FPM w milisekundach: 1000 = 1 sekunda. Zakres: 50–60000.",
"phpHintRequestTimeout": "Limit całego żądania FastCGI w milisekundach: 30000 = 30 sekund. Zakres: 100–3600000.", "phpHintRequestTimeout": "Limit całego żądania FastCGI w milisekundach: 30000 = 30 sekund. Zakres: 100–3600000.",
"phpHintConcurrency": "Maksymalna liczba równoległych żądań PHP na usługę, np. 64. Przekroczenie zwraca 503. Zakres: 1–4096.", "phpHintConcurrency": "Maksymalna liczba równoległych żądań PHP na usługę, np. 64. Przekroczenie zwraca 503. Zakres: 1–4096.",
@@ -4434,6 +4436,10 @@
"vhJsonDraft": "Niezastosowane zmiany JSON", "vhJsonDraft": "Niezastosowane zmiany JSON",
"vhJsonReloadConfirm": "Odrzucić niezastosowane zmiany JSON i wczytać aktualne wartości formularza?", "vhJsonReloadConfirm": "Odrzucić niezastosowane zmiany JSON i wczytać aktualne wartości formularza?",
"vhJsonInvalidAcl": "Użyj null albo obiektu ACL z domyślną akcją allow/deny i regułami IP/CIDR.", "vhJsonInvalidAcl": "Użyj null albo obiektu ACL z domyślną akcją allow/deny i regułami IP/CIDR.",
"vhJsonInvalidPaths": "Użyj tablicy zawierającej najwyżej 64 obiekty lokalizacji." "vhJsonInvalidPaths": "Użyj tablicy zawierającej najwyżej 64 obiekty lokalizacji.",
"webServiceFastCgiHandler": "Tryb FastCGI",
"webServiceFastCgiHandlerHelp": "Wybierz backend: PHP-FPM wykonuje PHP, fcgiwrap uruchamia programy CGI, a ogólny responder FastCGI obsługuje zgodne aplikacje. Dla różnych katalogów lub socketów użyj osobnych Web Service i lokalizacji Vhost.",
"webServiceFastCgiScriptPrefix": "Publiczny prefiks SCRIPT_NAME",
"webServiceFastCgiScriptPrefixHelp": "Jeśli reguła Vhost usuwa prefiks URL (np. /app/cgi-bin), wpisz go tutaj. Prefiks jest dodawany do SCRIPT_NAME; SCRIPT_FILENAME pozostaje w katalogu usługi."
} }
} }
+1
View File
@@ -25,6 +25,7 @@ pub(super) static READER_DOCUMENTS: &[(&str, &str, &str)] = &[
reader_doc!("docs/ACCESS.md", "guides"), reader_doc!("docs/ACCESS.md", "guides"),
reader_doc!("docs/WEB_SERVER.md", "guides"), reader_doc!("docs/WEB_SERVER.md", "guides"),
reader_doc!("docs/PHP_FPM.md", "guides"), reader_doc!("docs/PHP_FPM.md", "guides"),
reader_doc!("docs/FASTCGI.md", "guides"),
reader_doc!("docs/CACHE.md", "guides"), reader_doc!("docs/CACHE.md", "guides"),
reader_doc!("docs/CACHE_TEMPLATE_LIBRARY.md", "guides"), reader_doc!("docs/CACHE_TEMPLATE_LIBRARY.md", "guides"),
reader_doc!("docs/VCL.md", "guides"), reader_doc!("docs/VCL.md", "guides"),
+66 -3
View File
@@ -2,7 +2,7 @@
"openapi": "3.0.3", "openapi": "3.0.3",
"info": { "info": {
"title": "RustProxy Administration API", "title": "RustProxy Administration API",
"version": "0.42.1", "version": "0.42.2",
"description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only." "description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only."
}, },
"servers": [ "servers": [
@@ -6806,9 +6806,25 @@
"maxLength": 8192 "maxLength": 8192
}, },
"description": "Trusted operator PHP-FPM administrative php.ini directives packed into PHP_ADMIN_VALUE. Restrict access to FastCGI endpoints." "description": "Trusted operator PHP-FPM administrative php.ini directives packed into PHP_ADMIN_VALUE. Restrict access to FastCGI endpoints."
},
"handler": {
"type": "string",
"enum": [
"php_fpm",
"fcgiwrap",
"fastcgi"
],
"default": "php_fpm",
"description": "PHP-FPM, a CGI runner such as fcgiwrap, or a general FastCGI responder. Existing PHP configurations default to php_fpm."
},
"script_name_prefix": {
"type": "string",
"maxLength": 256,
"default": "",
"description": "Fixed public URL mount prefix prepended to SCRIPT_NAME when the Vhost route strips or rewrites a URL prefix. SCRIPT_FILENAME remains inside the Web Service document root."
} }
}, },
"description": "Optional bounded direct FastCGI connection to a PHP-FPM pool." "description": "Optional bounded direct FastCGI connection to PHP-FPM, a CGI runner, or another FastCGI responder."
}, },
"htaccess": { "htaccess": {
"type": "object", "type": "object",
@@ -6839,7 +6855,7 @@
"strict": { "strict": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "Reject Apply when an unsupported directive is found instead of logging and ignoring it." "description": "Reject unsupported non-security directives during Apply instead of logging and skipping them. Unsupported access-control and handler constructs are rejected regardless of this setting; supported Order/Allow/Deny IP/CIDR/all rules are enforced."
} }
}, },
"description": "Migration-oriented Apache .htaccess subset compiled at Web Service apply time; never parsed per request." "description": "Migration-oriented Apache .htaccess subset compiled at Web Service apply time; never parsed per request."
@@ -13268,6 +13284,53 @@
} }
} }
}, },
"/api/web-services/htaccess-warnings": {
"get": {
"summary": "Compiled .htaccess warnings for Web Services",
"tags": [
"Configuration"
],
"operationId": "get_api_web_services_htaccess_warnings",
"description": "Authenticated read-only snapshot. Returns {revision, services:{id:{files_loaded,warnings:[file:line:reason]}}} for configured .htaccess services. Warnings describe non-security directives skipped because Strict is disabled. Unsupported security directives fail validation instead of appearing as warnings. No disk scan is performed per request.",
"security": [
{
"AdminSession": []
}
],
"responses": {
"200": {
"description": "Compiled diagnostics from the active configuration",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"description": "Authentication required",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Host or session access denied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/config/{section}": { "/api/config/{section}": {
"put": { "put": {
"summary": "Replace one configuration section atomically", "summary": "Replace one configuration section atomically",
+1
View File
@@ -183,6 +183,7 @@ pub fn router(state: Arc<App>) -> Router {
.route("/favicon.svg", get(panel_assets::serve)) .route("/favicon.svg", get(panel_assets::serve))
.route("/healthz", get(|| async { Json(json!({"status":"ok"})) })) .route("/healthz", get(|| async { Json(json!({"status":"ok"})) }))
.route("/api/status", get(status)) .route("/api/status", get(status))
.route("/api/web-services/htaccess-warnings", get(web_service_htaccess_warnings))
.route("/api/system-info", get(system_info)) .route("/api/system-info", get(system_info))
.route("/api/backends", get(backend_status)) .route("/api/backends", get(backend_status))
.route("/api/alerts", get(alerts_status)) .route("/api/alerts", get(alerts_status))
+9
View File
@@ -11,6 +11,15 @@ fn live_chart_system_payload(state: &App) -> Value {
}) })
} }
async fn web_service_htaccess_warnings(State(state): State<Arc<App>>) -> Json<Value> {
let snapshot = state.config.load();
let services = snapshot.web_php_services.iter().filter_map(|(id, service)| {
let (files_loaded, warnings) = service.htaccess_diagnostics()?;
Some((id.clone(), json!({ "files_loaded": files_loaded, "warnings": warnings })))
}).collect::<serde_json::Map<String, Value>>();
Json(json!({ "revision": snapshot.envelope.revision, "services": services }))
}
fn web_server_metrics_payload(snapshot: &crate::config::Snapshot) -> Value { fn web_server_metrics_payload(snapshot: &crate::config::Snapshot) -> Value {
let mut services = serde_json::Map::new(); let mut services = serde_json::Map::new();
for service in &snapshot.envelope.config.web_services { for service in &snapshot.envelope.config.web_services {
+24 -15
View File
@@ -921,7 +921,7 @@
data-i18n-placeholder="webServiceSearchPlaceholder" id="web-service-search" data-i18n-placeholder="webServiceSearchPlaceholder" id="web-service-search"
type="search" /> type="search" />
<button class="outline" data-i18n="phpProfileToolbar" <button class="outline" data-i18n="phpProfileToolbar"
id="web-service-php-profiles-open" type="button">PHP-FPM profiles</button> id="web-service-php-profiles-open" type="button">FastCGI profiles</button>
<button class="outline" data-i18n="webServiceNew" id="web-service-new" <button class="outline" data-i18n="webServiceNew" id="web-service-new"
type="button">New Web Service</button> type="button">New Web Service</button>
</div> </div>
@@ -4864,6 +4864,7 @@ curl -sS -D - -o /dev/null \
checked /><span data-i18n="webServiceHtaccessRecursive">Scan subdirectories</span></label> checked /><span data-i18n="webServiceHtaccessRecursive">Scan subdirectories</span></label>
<label class="check"><input class="switch" id="web-service-htaccess-strict" type="checkbox" /><span <label class="check"><input class="switch" id="web-service-htaccess-strict" type="checkbox" /><span
data-i18n="webServiceHtaccessStrict">Strict unsupported-directive mode</span></label> data-i18n="webServiceHtaccessStrict">Strict unsupported-directive mode</span></label>
<p class="fine vh-wide" data-i18n="webServiceHtaccessStrictHelp">When Strict is off, unsupported non-security directives are skipped and logged as warnings. Legacy Order/Allow/Deny with all, IP and CIDR are enforced; unsupported access-control rules still block Apply.</p>
<div class="vh-wide"><button class="outline" id="web-service-htaccess-help" <div class="vh-wide"><button class="outline" id="web-service-htaccess-help"
data-i18n="webServiceHtaccessDocs" type="button">Compatibility documentation</button></div> data-i18n="webServiceHtaccessDocs" type="button">Compatibility documentation</button></div>
<p class="fine vh-wide" data-i18n="webServiceHtaccessHelp">RustProxy compiles a bounded <p class="fine vh-wide" data-i18n="webServiceHtaccessHelp">RustProxy compiles a bounded
@@ -4982,7 +4983,7 @@ curl -sS -D - -o /dev/null \
</div> </div>
<div class="vh-grid web-service-page" data-web-service-page="php" hidden> <div class="vh-grid web-service-page" data-web-service-page="php" hidden>
<section class="vh-wide vh-setting-section web-service-setting-section"> <section class="vh-wide vh-setting-section web-service-setting-section">
<h3 data-i18n="webServicePhpSourceSection">PHP-FPM source and endpoint</h3> <h3 data-i18n="webServicePhpSourceSection">FastCGI / PHP-FPM source and endpoint</h3>
<div class="vh-grid"> <div class="vh-grid">
<label class="vh-wide"><span data-i18n="phpProfileSelect">PHP-FPM configuration <label class="vh-wide"><span data-i18n="phpProfileSelect">PHP-FPM configuration
source</span> source</span>
@@ -4994,7 +4995,7 @@ curl -sS -D - -o /dev/null \
Profile changes apply to all attached Web Services.</small> Profile changes apply to all attached Web Services.</small>
</label> </label>
<div class="vh-wide"><button type="button" class="outline" id="web-service-php-profiles" <div class="vh-wide"><button type="button" class="outline" id="web-service-php-profiles"
data-i18n="phpProfileManage">Manage PHP-FPM profiles</button></div> data-i18n="phpProfileManage">Manage FastCGI profiles</button></div>
<div class="vh-wide php-switch-row"><label class="check php-switch-label"><input <div class="vh-wide php-switch-row"><label class="check php-switch-label"><input
class="switch" id="web-service-php-enabled" type="checkbox" /><span class="switch" id="web-service-php-enabled" type="checkbox" /><span
data-i18n="webServicePhpEnabled">Enable PHP-FPM / FastCGI</span></label> data-i18n="webServicePhpEnabled">Enable PHP-FPM / FastCGI</span></label>
@@ -5009,13 +5010,24 @@ curl -sS -D - -o /dev/null \
</div> </div>
</details> </details>
</div> </div>
<label class="vh-wide"><span data-i18n="webServicePhpEndpoint">PHP-FPM endpoint</span><input <label class="vh-wide"><span data-i18n="webServiceFastCgiHandler">FastCGI handler</span>
<select id="web-service-php-handler">
<option value="php_fpm">PHP-FPM</option>
<option value="fcgiwrap">fcgiwrap (CGI)</option>
<option value="fastcgi">FastCGI responder</option>
</select><small class="fine" data-i18n="webServiceFastCgiHandlerHelp">Select PHP-FPM for PHP, fcgiwrap for CGI programs or FastCGI for compatible responders.</small>
</label>
<label class="vh-wide"><span data-i18n="webServiceFastCgiScriptPrefix">Public SCRIPT_NAME prefix</span>
<input id="web-service-php-script-prefix" maxlength="256" placeholder="/app/cgi-bin" />
<small class="fine" data-i18n="webServiceFastCgiScriptPrefixHelp">Set the public URL prefix removed by the Vhost path rewrite, for example /app/cgi-bin. Leave empty without a rewrite.</small>
</label>
<label class="vh-wide"><span data-i18n="webServicePhpEndpoint">FastCGI endpoint</span><input
id="web-service-php-endpoint" maxlength="512" id="web-service-php-endpoint" maxlength="512"
placeholder="unix:/run/php/php-fpm.sock" /><small class="fine" placeholder="unix:/run/php/php-fpm.sock" /><small class="fine"
data-i18n="webServicePhpEndpointHelp">Unix: unix:/run/php/php-fpm.sock. TCP: data-i18n="webServicePhpEndpointHelp">Unix: unix:/run/php/php-fpm.sock. TCP:
tcp:127.0.0.1:9000 or tcp:[::1]:9000. TCP is intentionally limited to loopback tcp:127.0.0.1:9000 or tcp:[::1]:9000. TCP is intentionally limited to loopback
addresses.</small></label> addresses.</small></label>
<label><span data-i18n="webServicePhpExtensions">PHP extensions</span><input <label><span data-i18n="webServicePhpExtensions">Executable extensions (PHP or CGI)</span><input
id="web-service-php-extensions" maxlength="512" placeholder="php, phtml" /><small id="web-service-php-extensions" maxlength="512" placeholder="php, phtml" /><small
class="fine" data-i18n="phpHintExtensions">Comma-separated extensions without dots class="fine" data-i18n="phpHintExtensions">Comma-separated extensions without dots
(e.g. (e.g.
@@ -5125,10 +5137,7 @@ curl -sS -D - -o /dev/null \
<div class="vh-wide form-actions"><button class="outline" <div class="vh-wide form-actions"><button class="outline"
data-i18n="webServicePhpDocsButton" id="web-service-php-help" type="button">FastCGI data-i18n="webServicePhpDocsButton" id="web-service-php-help" type="button">FastCGI
syntax and safety</button></div> syntax and safety</button></div>
<p class="fine vh-wide" data-i18n="webServicePhpHelp">RustProxy speaks FastCGI directly to a <p class="fine vh-wide" data-i18n="webServicePhpHelp">RustProxy connects to PHP-FPM, fcgiwrap or other compatible FastCGI responders. Select executable extensions, configure a Unix or loopback TCP endpoint, and optionally set the public SCRIPT_NAME prefix when Vhost locations strip a URL prefix. Script source is never served statically for protected executable extensions.</p>
long-running PHP-FPM pool. PHP is not spawned per request and PHP source is never served
when
PHP handling is selected.</p>
</div> </div>
</section> </section>
</div> </div>
@@ -5160,7 +5169,7 @@ curl -sS -D - -o /dev/null \
</dialog> </dialog>
<dialog aria-labelledby="php-profiles-title" class="vhost-dialog location-help-dialog" id="php-fpm-profiles-dialog"> <dialog aria-labelledby="php-profiles-title" class="vhost-dialog location-help-dialog" id="php-fpm-profiles-dialog">
<div class="window-heading"> <div class="window-heading">
<h2 id="php-profiles-title" data-i18n="phpProfileTitle">Shared PHP-FPM profiles</h2> <h2 id="php-profiles-title" data-i18n="phpProfileTitle">Shared FastCGI profiles</h2>
<button type="button" class="outline" id="php-fpm-profiles-close" data-i18n="close">Close</button> <button type="button" class="outline" id="php-fpm-profiles-close" data-i18n="close">Close</button>
</div> </div>
<div class="card location-help-content"> <div class="card location-help-content">
@@ -5207,11 +5216,11 @@ RewriteRule . /index.php [L]</code></pre>
128 files, depth 16, 128 KiB per file and 1 MiB total.</p> 128 files, depth 16, 128 KiB per file and 1 MiB total.</p>
<h3 data-i18n="webServiceHtaccessDocsUnsupportedTitle">Not Apache-complete</h3> <h3 data-i18n="webServiceHtaccessDocsUnsupportedTitle">Not Apache-complete</h3>
<p data-i18n="webServiceHtaccessDocsUnsupported">ErrorDocument, SetEnvIf, Redirect/RedirectMatch and <p data-i18n="webServiceHtaccessDocsUnsupported">ErrorDocument, SetEnvIf, Redirect/RedirectMatch and
FallbackResource are not implemented in this compatibility layer. General Files/FilesMatch, unsupported FallbackResource are not implemented. Order/Allow/Deny with all, IP or CIDR (IPv4/IPv6) are supported
authentication/authorization directives, non-PHP handlers and SetHandler are rejected even when Strict and enforced. General Files/FilesMatch, unsupported authentication/authorization and hostname access
mode is off because silently ignoring them could weaken access control or expose source. directives, non-PHP handlers and SetHandler are rejected even with Strict off: ignoring them may expose
.htaccess/.htpasswd files are always blocked from HTTP delivery. Other unsupported non-security protected content. .htaccess/.htpasswd are never served over HTTP. Other unsupported non-security
directives are logged and ignored unless Strict mode is enabled.</p> directives are logged and skipped with Strict off.</p>
<p class="fine" data-i18n="webServiceHtaccessDocsSecurity">Vhost/location ACL, authentication, error pages <p class="fine" data-i18n="webServiceHtaccessDocsSecurity">Vhost/location ACL, authentication, error pages
and response rules still remain authoritative. .htaccess cannot escape the document root, select an and response rules still remain authoritative. .htaccess cannot escape the document root, select an
arbitrary FastCGI socket or override protected framing headers.</p> arbitrary FastCGI socket or override protected framing headers.</p>
+33 -3
View File
@@ -13,6 +13,8 @@ window.rustProxyPhpProfiles = ({ defaults, mapLines, lines, parseFastCgiParams,
const profileFields = [ const profileFields = [
["enabled", "webServicePhpEnabled", "checkbox"], ["enabled", "webServicePhpEnabled", "checkbox"],
["endpoint", "webServicePhpEndpoint", "text"], ["endpoint", "webServicePhpEndpoint", "text"],
["handler", "webServiceFastCgiHandler", "select"],
["script_name_prefix", "webServiceFastCgiScriptPrefix", "text"],
["extensions", "webServicePhpExtensions", "text"], ["extensions", "webServicePhpExtensions", "text"],
["path_info", "webServicePhpPathInfo", "checkbox"], ["path_info", "webServicePhpPathInfo", "checkbox"],
["pass_authorization", "webServicePhpPassAuthorization", "checkbox"], ["pass_authorization", "webServicePhpPassAuthorization", "checkbox"],
@@ -29,6 +31,7 @@ window.rustProxyPhpProfiles = ({ defaults, mapLines, lines, parseFastCgiParams,
const helpKeys = { const helpKeys = {
enabled: "phpHintEnabled", path_info: "phpHintPathInfo", endpoint: "webServicePhpDocsEndpoint", enabled: "phpHintEnabled", path_info: "phpHintPathInfo", endpoint: "webServicePhpDocsEndpoint",
handler: "webServiceFastCgiHandlerHelp", script_name_prefix: "webServiceFastCgiScriptPrefixHelp",
extensions: "phpHintExtensions", pass_authorization: "phpHintPassAuthorization", extensions: "phpHintExtensions", pass_authorization: "phpHintPassAuthorization",
connect_timeout_ms: "phpHintConnectTimeout", request_timeout_ms: "phpHintRequestTimeout", connect_timeout_ms: "phpHintConnectTimeout", request_timeout_ms: "phpHintRequestTimeout",
max_concurrent_requests: "phpHintConcurrency", max_request_body_bytes: "phpHintBodyLimit", max_concurrent_requests: "phpHintConcurrency", max_request_body_bytes: "phpHintBodyLimit",
@@ -56,18 +59,25 @@ window.rustProxyPhpProfiles = ({ defaults, mapLines, lines, parseFastCgiParams,
const wrapper = toggle ? el("div", undefined, "php-switch-row vh-wide") : el("label"); const wrapper = toggle ? el("div", undefined, "php-switch-row vh-wide") : el("label");
if (!toggle && kind === "textarea") wrapper.className = "vh-wide"; if (!toggle && kind === "textarea") wrapper.className = "vh-wide";
const labelEl = toggle ? el("label", undefined, "check php-switch-label") : wrapper; const labelEl = toggle ? el("label", undefined, "check php-switch-label") : wrapper;
const input = document.createElement(kind === "textarea" ? "textarea" : "input"); const input = document.createElement(kind === "textarea" ? "textarea" : kind === "select" ? "select" : "input");
if (kind !== "textarea") input.type = kind; if (kind !== "textarea" && kind !== "select") input.type = kind;
if (kind === "select") {
for (const [value, label] of [["php_fpm", "PHP-FPM"], ["fcgiwrap", "fcgiwrap (CGI)"], ["fastcgi", "FastCGI responder"]]) {
const option = el("option", label); option.value = value; input.append(option);
}
}
if (toggle) input.classList.add("switch"); if (toggle) input.classList.add("switch");
const caption = el("span", t(label)); const caption = el("span", t(label));
if (toggle) labelEl.append(input, caption); else labelEl.append(caption, input); if (toggle) labelEl.append(input, caption); else labelEl.append(caption, input);
if (toggle) input.checked = profile.php?.[key] === true; if (toggle) input.checked = profile.php?.[key] === true;
else if (kind === "textarea") { input.rows = 4; input.maxLength = 65536; input.value = mapLines(profile.php?.[key]); } else if (kind === "textarea") { input.rows = 4; input.maxLength = 65536; input.value = mapLines(profile.php?.[key]); }
else if (key === "extensions") input.value = (profile.php?.extensions || ["php"]).join(", "); else if (key === "extensions") input.value = (profile.php?.extensions || ["php"]).join(", ");
else if (key === "handler") input.value = profile.php?.handler || "php_fpm";
else input.value = profile.php?.[key] ?? ""; else input.value = profile.php?.[key] ?? "";
if (kind === "number") { input.min = min; input.max = max; input.step = 1; input.required = true; } if (kind === "number") { input.min = min; input.max = max; input.step = 1; input.required = true; }
if (key === "endpoint") { input.required = true; input.maxLength = 512; input.placeholder = "unix:/run/php/php-fpm.sock"; } if (key === "endpoint") { input.required = true; input.maxLength = 512; input.placeholder = "unix:/run/php/php-fpm.sock"; }
if (key === "extensions") input.placeholder = "php, phtml"; if (key === "script_name_prefix") { input.maxLength = 256; input.placeholder = "/app/cgi-bin"; }
if (key === "extensions") input.placeholder = "php, cgi, fcgi";
if (key === "custom_params") input.placeholder = "APP_ENV = production\nAPP_DEBUG = 0"; if (key === "custom_params") input.placeholder = "APP_ENV = production\nAPP_DEBUG = 0";
if (key === "php_values") input.placeholder = "memory_limit = 256M\npost_max_size = 64M"; if (key === "php_values") input.placeholder = "memory_limit = 256M\npost_max_size = 64M";
if (key === "php_admin_values") input.placeholder = "open_basedir = /var/www/webmail/:/tmp/"; if (key === "php_admin_values") input.placeholder = "open_basedir = /var/www/webmail/:/tmp/";
@@ -83,6 +93,26 @@ window.rustProxyPhpProfiles = ({ defaults, mapLines, lines, parseFastCgiParams,
} }
editor.append(wrapper); controls[key] = input; editor.append(wrapper); controls[key] = input;
} }
const handlerSelector = controls.handler;
handlerSelector.addEventListener("change", () => {
const kind = handlerSelector.value;
if (kind !== "php_fpm" && controls.extensions.value.trim().toLowerCase() === "php") {
controls.extensions.value = kind === "fcgiwrap" ? "cgi" : "fcgi";
} else if (kind === "php_fpm" && ["cgi", "fcgi"].includes(controls.extensions.value.trim().toLowerCase())) {
controls.extensions.value = "php";
}
if (kind === "fcgiwrap" && controls.endpoint.value === "unix:/run/php/php-fpm.sock") {
controls.endpoint.value = "unix:/run/fcgiwrap.socket";
}
if (kind !== "php_fpm") {
controls.php_values.value = "";
controls.php_admin_values.value = "";
}
controls.php_values.disabled = kind !== "php_fpm";
controls.php_admin_values.disabled = kind !== "php_fpm";
});
controls.php_values.disabled = handlerSelector.value !== "php_fpm";
controls.php_admin_values.disabled = handlerSelector.value !== "php_fpm";
const actions = el("div", undefined, "form-actions vh-wide"); const actions = el("div", undefined, "form-actions vh-wide");
const save = el("button", t("apply"), "primary"); save.type = "submit"; const save = el("button", t("apply"), "primary"); save.type = "submit";
actions.append(save); actions.append(save);
+57 -4
View File
@@ -1,6 +1,7 @@
"use strict"; "use strict";
(() => { (() => {
let editing = null, dirty = false; let editing = null, dirty = false;
let htaccessWarnings = {}, htaccessWarningsRevision = null, htaccessWarningsLoading = false;
const form = $("web-service-form"), dialog = $("web-service-dialog"); const form = $("web-service-form"), dialog = $("web-service-dialog");
function syncRootPermissions() { function syncRootPermissions() {
window.rustProxyPermissions?.render($("web-service-permissions"), { kind: "web", paths: [$("web-service-root").value] }); window.rustProxyPermissions?.render($("web-service-permissions"), { kind: "web", paths: [$("web-service-root").value] });
@@ -54,7 +55,7 @@
const reservedFastCgiParams = new Set([ const reservedFastCgiParams = new Set([
"REQUEST_METHOD", "SCRIPT_FILENAME", "SCRIPT_NAME", "QUERY_STRING", "REQUEST_URI", "DOCUMENT_ROOT", "REQUEST_METHOD", "SCRIPT_FILENAME", "SCRIPT_NAME", "QUERY_STRING", "REQUEST_URI", "DOCUMENT_ROOT",
"SERVER_PROTOCOL", "SERVER_NAME", "SERVER_PORT", "REMOTE_ADDR", "REMOTE_PORT", "HTTPS", "SERVER_PROTOCOL", "SERVER_NAME", "SERVER_PORT", "REMOTE_ADDR", "REMOTE_PORT", "REMOTE_USER", "AUTH_USER", "HTTPS",
"GATEWAY_INTERFACE", "SERVER_SOFTWARE", "REDIRECT_STATUS", "CONTENT_TYPE", "CONTENT_LENGTH", "GATEWAY_INTERFACE", "SERVER_SOFTWARE", "REDIRECT_STATUS", "CONTENT_TYPE", "CONTENT_LENGTH",
"PATH_INFO", "PATH_TRANSLATED", "PHP_VALUE", "PHP_ADMIN_VALUE" "PATH_INFO", "PATH_TRANSLATED", "PHP_VALUE", "PHP_ADMIN_VALUE"
]); ]);
@@ -170,13 +171,17 @@
const attached = !!$("web-service-php-profile").value; const attached = !!$("web-service-php-profile").value;
const enabled = $("web-service-php-enabled").checked; const enabled = $("web-service-php-enabled").checked;
$("web-service-php-enabled").disabled = attached; $("web-service-php-enabled").disabled = attached;
const phpFpm = $("web-service-php-handler").value === "php_fpm";
$("web-service-php-values").disabled = !enabled || attached || !phpFpm;
$("web-service-php-admin-values").disabled = !enabled || attached || !phpFpm;
for (const id of [ for (const id of [
"web-service-php-endpoint", "web-service-php-extensions", "web-service-php-connect-timeout", "web-service-php-endpoint", "web-service-php-handler", "web-service-php-script-prefix",
"web-service-php-extensions", "web-service-php-connect-timeout",
"web-service-php-request-timeout", "web-service-php-concurrency", "web-service-php-pass-authorization", "web-service-php-request-timeout", "web-service-php-concurrency", "web-service-php-pass-authorization",
"web-service-php-path-info", "web-service-php-path-info",
"web-service-php-body-limit", "web-service-php-header-limit", "web-service-php-stderr-limit", "web-service-php-body-limit", "web-service-php-header-limit", "web-service-php-stderr-limit",
"web-service-php-custom-params", "web-service-php-values", "web-service-php-admin-values" "web-service-php-custom-params"
]) $(id).disabled = !enabled || attached; ]) $(id).disabled = !enabled || attached;
} }
@@ -213,7 +218,8 @@
mime_types: {}, default_mime_type: "application/octet-stream", cache_control: null, cache_rules: [], response_headers: {}, mime_types: {}, default_mime_type: "application/octet-stream", cache_control: null, cache_rules: [], response_headers: {},
try_files: [], rewrites: [], compression: { enabled: null, gzip: null, br: null, zstd: null, deflate: null }, precompressed: { enabled: false, brotli: true, gzip: true }, download_extensions: [], try_files: [], rewrites: [], compression: { enabled: null, gzip: null, br: null, zstd: null, deflate: null }, precompressed: { enabled: false, brotli: true, gzip: true }, download_extensions: [],
symlink_policy: "deny", php_profile_id: null, php: { symlink_policy: "deny", php_profile_id: null, php: {
enabled: false, path_info: false, extensions: ["php"], endpoint: "unix:/run/php/php-fpm.sock", connect_timeout_ms: 1000, enabled: false, path_info: false, extensions: ["php"], endpoint: "unix:/run/php/php-fpm.sock",
handler: "php_fpm", script_name_prefix: "", connect_timeout_ms: 1000,
request_timeout_ms: 30000, max_concurrent_requests: 64, pass_authorization: true, max_request_body_bytes: 0, request_timeout_ms: 30000, max_concurrent_requests: 64, pass_authorization: true, max_request_body_bytes: 0,
max_response_header_bytes: 65536, stderr_log_bytes: 4096, custom_params: {}, php_values: {}, php_admin_values: {} max_response_header_bytes: 65536, stderr_log_bytes: 4096, custom_params: {}, php_values: {}, php_admin_values: {}
}, },
@@ -264,6 +270,8 @@
$("web-service-php-enabled").checked = item.php?.enabled === true; $("web-service-php-enabled").checked = item.php?.enabled === true;
$("web-service-php-path-info").checked = item.php?.path_info === true; $("web-service-php-path-info").checked = item.php?.path_info === true;
$("web-service-php-endpoint").value = item.php?.endpoint || "unix:/run/php/php-fpm.sock"; $("web-service-php-endpoint").value = item.php?.endpoint || "unix:/run/php/php-fpm.sock";
$("web-service-php-handler").value = ["php_fpm", "fcgiwrap", "fastcgi"].includes(item.php?.handler) ? item.php.handler : "php_fpm";
$("web-service-php-script-prefix").value = item.php?.script_name_prefix || "";
$("web-service-php-extensions").value = (item.php?.extensions || ["php"]).join(", "); $("web-service-php-extensions").value = (item.php?.extensions || ["php"]).join(", ");
$("web-service-php-connect-timeout").value = item.php?.connect_timeout_ms ?? 1000; $("web-service-php-connect-timeout").value = item.php?.connect_timeout_ms ?? 1000;
$("web-service-php-request-timeout").value = item.php?.request_timeout_ms ?? 30000; $("web-service-php-request-timeout").value = item.php?.request_timeout_ms ?? 30000;
@@ -362,9 +370,23 @@
} }
function closeEditor() { if (dirty) return window.rustProxyDrafts.dock("web-server"); clearEditor(); return true; } function closeEditor() { if (dirty) return window.rustProxyDrafts.dock("web-server"); clearEditor(); return true; }
async function loadHtaccessWarnings() {
if (htaccessWarningsLoading || !envelope || !authenticated) return;
htaccessWarningsLoading = true;
try {
const result = await api("/api/web-services/htaccess-warnings");
if (!envelope || result.revision !== envelope.revision) return;
htaccessWarnings = result.services || {};
htaccessWarningsRevision = result.revision;
if (currentPanel === "web-server") render();
} catch { /* The configuration remains available if diagnostics cannot be loaded. */ }
finally { htaccessWarningsLoading = false; }
}
function render() { function render() {
syncRootPermissions(); syncRootPermissions();
if (!envelope) return; if (!envelope) return;
if (htaccessWarningsRevision !== envelope.revision && !htaccessWarningsLoading) void loadHtaccessWarnings();
const query = ($("web-service-search")?.value || "").trim().toLowerCase(); const query = ($("web-service-search")?.value || "").trim().toLowerCase();
const services = (envelope.config.web_services || []).filter(service => !query || [service.id, service.name, service.document_root].join(" ").toLowerCase().includes(query)); const services = (envelope.config.web_services || []).filter(service => !query || [service.id, service.name, service.document_root].join(" ").toLowerCase().includes(query));
const cards = services.map(service => { const cards = services.map(service => {
@@ -402,6 +424,17 @@
item.append(el("span", t(key), "small-label"), el("b", value)); item.append(el("span", t(key), "small-label"), el("b", value));
details.append(item); details.append(item);
} }
// Show the real skipped directives from the active configuration, with
// file/line context. Security-related errors never appear here: they fail Apply.
const ignored = htaccessWarningsRevision === envelope.revision ? (htaccessWarnings[service.id]?.warnings || []) : [];
if (service.htaccess?.enabled && ignored.length) {
const details = el("details", undefined, "web-service-htaccess-warnings");
details.append(el("summary", `${t("webServiceHtaccessWarningsCount")}: ${ignored.length}`));
const lines = el("ul");
for (const warning of ignored.slice(0, 50)) lines.append(el("li", warning));
if (ignored.length > 50) lines.append(el("li", `+${ignored.length - 50}`));
details.append(lines); box.append(details);
}
const live = el("section", undefined, "www-service-panel"); const live = el("section", undefined, "www-service-panel");
const panel = el("div", undefined, "www-service-live"); panel.dataset.webLiveId = service.id; const panel = el("div", undefined, "www-service-live"); panel.dataset.webLiveId = service.id;
@@ -517,6 +550,8 @@
path_info: $("web-service-php-path-info").checked, path_info: $("web-service-php-path-info").checked,
extensions: lines($("web-service-php-extensions").value).map(value => value.replace(/^\./, "").toLowerCase()), extensions: lines($("web-service-php-extensions").value).map(value => value.replace(/^\./, "").toLowerCase()),
endpoint: $("web-service-php-endpoint").value.trim() || "unix:/run/php/php-fpm.sock", endpoint: $("web-service-php-endpoint").value.trim() || "unix:/run/php/php-fpm.sock",
handler: $("web-service-php-handler").value,
script_name_prefix: $("web-service-php-script-prefix").value.trim(),
connect_timeout_ms: Number($("web-service-php-connect-timeout").value || 1000), connect_timeout_ms: Number($("web-service-php-connect-timeout").value || 1000),
request_timeout_ms: Number($("web-service-php-request-timeout").value || 30000), request_timeout_ms: Number($("web-service-php-request-timeout").value || 30000),
max_concurrent_requests: Number($("web-service-php-concurrency").value || 64), max_concurrent_requests: Number($("web-service-php-concurrency").value || 64),
@@ -548,6 +583,24 @@
$("web-service-root").addEventListener("input", syncRootPermissions); $("web-service-root").addEventListener("input", syncRootPermissions);
$("web-service-root").addEventListener("change", syncRootPermissions); $("web-service-root").addEventListener("change", syncRootPermissions);
$("web-service-php-enabled").addEventListener("change", syncPhp); $("web-service-php-enabled").addEventListener("change", syncPhp);
$("web-service-php-handler").addEventListener("change", () => {
const kind = $("web-service-php-handler").value;
const extensions = $("web-service-php-extensions");
if (kind !== "php_fpm" && extensions.value.trim().toLowerCase() === "php") {
extensions.value = kind === "fcgiwrap" ? "cgi" : "fcgi";
} else if (kind === "php_fpm" && ["cgi", "fcgi"].includes(extensions.value.trim().toLowerCase())) {
extensions.value = "php";
}
const endpoint = $("web-service-php-endpoint");
if (kind === "fcgiwrap" && endpoint.value === "unix:/run/php/php-fpm.sock") {
endpoint.value = "unix:/run/fcgiwrap.socket";
}
if (kind !== "php_fpm") {
$("web-service-php-values").value = "";
$("web-service-php-admin-values").value = "";
}
syncPhp();
});
$("web-service-php-profile").addEventListener("change", syncPhp); $("web-service-php-profile").addEventListener("change", syncPhp);
$("web-service-php-profiles").addEventListener("click", openProfiles); $("web-service-php-profiles").addEventListener("click", openProfiles);
$("web-service-php-profiles-open").addEventListener("click", openProfiles); $("web-service-php-profiles-open").addEventListener("click", openProfiles);
+7
View File
@@ -157,6 +157,13 @@ fn denied(status: StatusCode, challenge: Option<&HeaderValue>) -> Response {
.insert(crate::auth_provider::AuthenticationResponse); .insert(crate::auth_provider::AuthenticationResponse);
response response
} }
/// Use only with the Authorization value returned from a successful authorize().
/// This is not itself authentication; do not call on untrusted request headers.
pub(crate) fn verified_username(value: &HeaderValue) -> Option<String> {
let mut headers = HeaderMap::new();
headers.insert("authorization", value.clone());
credentials(&headers).map(|(username, _, _)| username)
}
fn credentials(headers: &HeaderMap) -> Option<(String, Zeroizing<String>, HeaderValue)> { fn credentials(headers: &HeaderMap) -> Option<(String, Zeroizing<String>, HeaderValue)> {
if headers.get_all("authorization").iter().count() != 1 { if headers.get_all("authorization").iter().count() != 1 {
return None; return None;
+7 -3
View File
@@ -428,8 +428,10 @@ impl CompiledRoute {
let tail = path.strip_prefix(&self.path_prefix).unwrap_or(""); let tail = path.strip_prefix(&self.path_prefix).unwrap_or("");
if tail.is_empty() { if tail.is_empty() {
"/".to_owned() "/".to_owned()
} else { } else if tail.starts_with('/') {
tail.to_owned() tail.to_owned()
} else {
format!("/{tail}")
} }
} }
RewriteMode::ReplacePrefix => { RewriteMode::ReplacePrefix => {
@@ -442,9 +444,11 @@ impl CompiledRoute {
base.to_owned() base.to_owned()
} }
} else if base.is_empty() || base == "/" { } else if base.is_empty() || base == "/" {
tail.to_owned() if tail.starts_with('/') { tail.to_owned() } else { format!("/{tail}") }
} else { } else if tail.starts_with('/') {
format!("{base}{tail}") format!("{base}{tail}")
} else {
format!("{base}/{tail}")
} }
} }
RewriteMode::Regex => self RewriteMode::Regex => self
+26
View File
@@ -837,6 +837,32 @@ mod tests {
Some("/service/42/Ubuntu 14.04 LTS") Some("/service/42/Ubuntu 14.04 LTS")
); );
} }
#[test]
fn web_service_prefix_mount_rewrite_keeps_absolute_script_paths() {
for prefix in ["/console", "/console/"] {
let mut config = demo_config("127.0.0.1:9000".parse().unwrap());
let route = &mut config.vhosts[0].routes[0];
route.id = "mount".into();
route.match_type = crate::vhost::PathMatch::Prefix;
route.path_prefix = prefix.into();
route.rewrite = crate::vhost::PathRewrite {
mode: crate::vhost::RewriteMode::StripPrefix,
value: String::new(),
};
let snapshot = compile(config.clone(), 1, &policy()).unwrap();
let selected = snapshot.select("localhost", "/console/status.php").unwrap();
assert_eq!(selected.rewritten_path("/console/status.php").unwrap().as_deref(), Some("/status.php"));
assert_eq!(selected.rewritten_path("/console/").unwrap().as_deref(), Some("/"));
config.vhosts[0].routes[0].rewrite = crate::vhost::PathRewrite {
mode: crate::vhost::RewriteMode::ReplacePrefix,
value: "/internal".into(),
};
let snapshot = compile(config, 1, &policy()).unwrap();
assert_eq!(snapshot.select("localhost", "/console/status.php").unwrap()
.rewritten_path("/console/status.php").unwrap().as_deref(), Some("/internal/status.php"));
}
}
#[test] #[test]
fn custom_location_response_is_validated() { fn custom_location_response_is_validated() {
let mut c = demo_config("127.0.0.1:9000".parse().unwrap()); let mut c = demo_config("127.0.0.1:9000".parse().unwrap());
+9
View File
@@ -139,6 +139,14 @@
} else { } else {
(std::mem::take(&mut request_headers), false) (std::mem::take(&mut request_headers), false)
}; };
// Vhost Basic authentication already removed untrusted credentials. Forward
// only the verified value, when the operator selected forward_credentials.
let mut origin_request_headers = origin_request_headers;
if let Some(auth) = frontend.and_then(|f| f.basic_auth.as_ref()) {
auth.apply_upstream(&mut origin_request_headers, basic_identity.clone());
}
let authenticated_user = basic_identity.as_ref()
.and_then(crate::basic_auth::verified_username);
let started = Instant::now(); let started = Instant::now();
let response = crate::web_server::serve(service, request_method.clone(), let response = crate::web_server::serve(service, request_method.clone(),
origin_request_headers, request_uri, &service_path, static_body, origin_request_headers, request_uri, &service_path, static_body,
@@ -149,6 +157,7 @@
server_port: local.0.port(), server_port: local.0.port(),
tls, tls,
version: request_version, version: request_version,
authenticated_user,
}).await; }).await;
if let Some(fallback) = execute_error_fallback( if let Some(fallback) = execute_error_fallback(
state.clone(), peer, local, &snapshot, &host, tls, route, state.clone(), peer, local, &snapshot, &host, tls, route,
@@ -81,6 +81,7 @@ async fn serve_file(
server_port: 443, server_port: 443,
tls: true, tls: true,
version: http::Version::HTTP_2, version: http::Version::HTTP_2,
authenticated_user: None,
}, },
) )
.await .await
+30 -4
View File
@@ -9,6 +9,28 @@ impl Php {
"Web Service PHP extension", "Web Service PHP extension",
)?; )?;
self.endpoint = self.endpoint.trim().to_owned(); self.endpoint = self.endpoint.trim().to_owned();
self.script_name_prefix = self.script_name_prefix.trim().to_owned();
if !self.script_name_prefix.is_empty() {
ensure!(
self.script_name_prefix.starts_with('/')
&& !self.script_name_prefix.ends_with('/')
&& self.script_name_prefix.len() <= 256
&& self.script_name_prefix.bytes().all(|byte| {
byte.is_ascii_alphanumeric() || matches!(byte, b'/' | b'_' | b'-' | b'.')
})
&& self.script_name_prefix.split('/').skip(1).all(|part| {
!part.is_empty() && part != "." && part != ".."
}),
"Web Service FastCGI SCRIPT_NAME prefix must be /path (no trailing slash, dot segments or special characters)"
);
}
if self.handler != FastCgiHandler::PhpFpm {
ensure!(self.php_values.is_empty() && self.php_admin_values.is_empty(),
"PHP_VALUE and PHP_ADMIN_VALUE require handler=php_fpm");
ensure!(self.extensions.iter().all(|ext| !matches!(ext.as_str(),
"php" | "phtml" | "phar" | "php3" | "php4" | "php5" | "php7" | "php8")),
"non-PHP FastCGI handlers cannot execute PHP extensions; use php_fpm");
}
ensure!( ensure!(
self.connect_timeout_ms >= 50 && self.connect_timeout_ms <= 60_000, self.connect_timeout_ms >= 50 && self.connect_timeout_ms <= 60_000,
"Web Service PHP connect timeout must be 50..60000 ms" "Web Service PHP connect timeout must be 50..60000 ms"
@@ -57,7 +79,7 @@ impl Php {
if self.enabled { if self.enabled {
ensure!( ensure!(
!self.extensions.is_empty(), !self.extensions.is_empty(),
"PHP-FPM needs executable extensions" "FastCGI needs at least one executable extension"
); );
FastCgiEndpoint::parse(&self.endpoint)?; FastCgiEndpoint::parse(&self.endpoint)?;
} }
@@ -304,12 +326,12 @@ impl Service {
if self.php.enabled { if self.php.enabled {
ensure!( ensure!(
!self.php.extensions.is_empty(), !self.php.extensions.is_empty(),
"Web Service PHP needs at least one executable extension" "Web Service FastCGI needs at least one executable extension"
); );
FastCgiEndpoint::parse(&self.php.endpoint)?; FastCgiEndpoint::parse(&self.php.endpoint)?;
ensure!( ensure!(
self.symlink_policy == SymlinkPolicy::Deny, self.symlink_policy == SymlinkPolicy::Deny,
"PHP-FPM currently requires symlink_policy=deny to avoid script-path races" "FastCGI script execution requires symlink_policy=deny to avoid script-path races"
); );
} }
@@ -348,7 +370,8 @@ impl Service {
let htaccess = htaccess::compile(&root, &self.htaccess)?; let htaccess = htaccess::compile(&root, &self.htaccess)?;
if let Some(compiled) = &htaccess { if let Some(compiled) = &htaccess {
ensure!( ensure!(
self.php.enabled || !htaccess::adds_php_extensions(Some(compiled)), (self.php.enabled && self.php.handler == FastCgiHandler::PhpFpm)
|| !htaccess::adds_php_extensions(Some(compiled)),
".htaccess AddHandler for PHP requires PHP-FPM to be enabled on the Web Service" ".htaccess AddHandler for PHP requires PHP-FPM to be enabled on the Web Service"
); );
tracing::debug!(service = %self.id, files = compiled.files_loaded, ".htaccess compatibility compiled"); tracing::debug!(service = %self.id, files = compiled.files_loaded, ".htaccess compatibility compiled");
@@ -397,6 +420,7 @@ impl Service {
script_extensions.extend( script_extensions.extend(
[ [
"php", "phtml", "phar", "php3", "php4", "php5", "php7", "php8", "php", "phtml", "phar", "php3", "php4", "php5", "php7", "php8",
"cgi", "fcgi", "pl", "py", "sh",
] ]
.into_iter() .into_iter()
.map(str::to_owned), .map(str::to_owned),
@@ -406,6 +430,8 @@ impl Service {
extensions: self.php.extensions.iter().cloned().collect(), extensions: self.php.extensions.iter().cloned().collect(),
path_info: self.php.path_info, path_info: self.php.path_info,
endpoint: FastCgiEndpoint::parse(&self.php.endpoint)?, endpoint: FastCgiEndpoint::parse(&self.php.endpoint)?,
handler: self.php.handler,
script_name_prefix: self.php.script_name_prefix.clone(),
connect_timeout: Duration::from_millis(self.php.connect_timeout_ms), connect_timeout: Duration::from_millis(self.php.connect_timeout_ms),
request_timeout: Duration::from_millis(self.php.request_timeout_ms), request_timeout: Duration::from_millis(self.php.request_timeout_ms),
permits: Arc::new(Semaphore::new(self.php.max_concurrent_requests)), permits: Arc::new(Semaphore::new(self.php.max_concurrent_requests)),
+18
View File
@@ -112,6 +112,8 @@ fn reserved_fastcgi_param(name: &str) -> bool {
| "SERVER_PORT" | "SERVER_PORT"
| "REMOTE_ADDR" | "REMOTE_ADDR"
| "REMOTE_PORT" | "REMOTE_PORT"
| "REMOTE_USER"
| "AUTH_USER"
| "HTTPS" | "HTTPS"
| "GATEWAY_INTERFACE" | "GATEWAY_INTERFACE"
| "SERVER_SOFTWARE" | "SERVER_SOFTWARE"
@@ -259,6 +261,15 @@ impl Default for Precompressed {
} }
} }
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]
#[serde(rename_all = "snake_case")]
pub enum FastCgiHandler {
#[default]
PhpFpm,
Fcgiwrap,
Fastcgi,
}
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default, deny_unknown_fields)] #[serde(default, deny_unknown_fields)]
pub struct Php { pub struct Php {
@@ -267,6 +278,11 @@ pub struct Php {
#[serde(default = "default_php_extensions")] #[serde(default = "default_php_extensions")]
pub extensions: Vec<String>, pub extensions: Vec<String>,
pub endpoint: String, pub endpoint: String,
/// Existing configurations default to PHP-FPM; fcgiwrap runs installed CGI scripts.
pub handler: FastCgiHandler,
/// Public URL prefix when a Vhost location rewrites a mount path.
/// SCRIPT_FILENAME stays confined to document_root; SCRIPT_NAME gains this prefix.
pub script_name_prefix: String,
#[serde(default = "default_php_connect_timeout_ms")] #[serde(default = "default_php_connect_timeout_ms")]
pub connect_timeout_ms: u64, pub connect_timeout_ms: u64,
#[serde(default = "default_php_request_timeout_ms")] #[serde(default = "default_php_request_timeout_ms")]
@@ -292,6 +308,8 @@ impl Default for Php {
path_info: false, path_info: false,
extensions: default_php_extensions(), extensions: default_php_extensions(),
endpoint: "unix:/run/php/php-fpm.sock".into(), endpoint: "unix:/run/php/php-fpm.sock".into(),
handler: FastCgiHandler::PhpFpm,
script_name_prefix: String::new(),
connect_timeout_ms: default_php_connect_timeout_ms(), connect_timeout_ms: default_php_connect_timeout_ms(),
request_timeout_ms: default_php_request_timeout_ms(), request_timeout_ms: default_php_request_timeout_ms(),
max_concurrent_requests: default_php_max_concurrent_requests(), max_concurrent_requests: default_php_max_concurrent_requests(),
+15 -5
View File
@@ -1,25 +1,25 @@
impl FastCgiEndpoint { impl FastCgiEndpoint {
pub(super) fn parse(value: &str) -> Result<Self> { pub(super) fn parse(value: &str) -> Result<Self> {
if let Some(path) = value.strip_prefix("unix:") { if let Some(path) = value.strip_prefix("unix:") {
ensure!(!path.trim().is_empty(), "PHP-FPM unix socket path is empty"); ensure!(!path.trim().is_empty(), "FastCGI Unix socket path is empty");
#[cfg(unix)] #[cfg(unix)]
{ {
return Ok(Self::Unix(PathBuf::from(path))); return Ok(Self::Unix(PathBuf::from(path)));
} }
#[cfg(not(unix))] #[cfg(not(unix))]
anyhow::bail!("PHP-FPM unix sockets require a Unix platform"); anyhow::bail!("FastCGI Unix sockets require a Unix platform");
} }
if let Some(address) = value.strip_prefix("tcp:") { if let Some(address) = value.strip_prefix("tcp:") {
let address = address let address = address
.parse::<std::net::SocketAddr>() .parse::<std::net::SocketAddr>()
.context("PHP-FPM TCP endpoint must be an IP socket address")?; .context("FastCGI TCP endpoint must be an IP socket address")?;
ensure!( ensure!(
address.ip().is_loopback(), address.ip().is_loopback(),
"PHP-FPM TCP endpoint must use a loopback address" "FastCGI TCP endpoint must use a loopback address"
); );
return Ok(Self::Tcp(address)); return Ok(Self::Tcp(address));
} }
anyhow::bail!("PHP-FPM endpoint must start with unix: or tcp:") anyhow::bail!("FastCGI endpoint must start with unix: or tcp:")
} }
} }
@@ -28,6 +28,8 @@ pub(crate) struct CompiledPhp {
pub(super) extensions: HashSet<String>, pub(super) extensions: HashSet<String>,
pub(super) path_info: bool, pub(super) path_info: bool,
pub(super) endpoint: FastCgiEndpoint, pub(super) endpoint: FastCgiEndpoint,
pub(super) handler: FastCgiHandler,
pub(super) script_name_prefix: String,
pub(super) connect_timeout: Duration, pub(super) connect_timeout: Duration,
pub(super) request_timeout: Duration, pub(super) request_timeout: Duration,
pub(crate) permits: Arc<Semaphore>, pub(crate) permits: Arc<Semaphore>,
@@ -69,3 +71,11 @@ pub struct CompiledService {
#[cfg(unix)] #[cfg(unix)]
pub(super) root_handle: Arc<File>, pub(super) root_handle: Arc<File>,
} }
impl CompiledService {
// Read-only diagnostics for the authenticated administration UI. Warnings
// come from the active compiled snapshot, not from another filesystem scan.
pub fn htaccess_diagnostics(&self) -> Option<(usize, &[String])> {
self.htaccess.as_ref().map(|compiled| (compiled.files_loaded, compiled.warnings.as_slice()))
}
}
+8 -4
View File
@@ -141,7 +141,11 @@ pub(super) fn fastcgi_params(
let mut params = BTreeMap::<String, String>::new(); let mut params = BTreeMap::<String, String>::new();
params.insert("REQUEST_METHOD".into(), method.as_str().into()); params.insert("REQUEST_METHOD".into(), method.as_str().into());
params.insert("SCRIPT_FILENAME".into(), script_filename); params.insert("SCRIPT_FILENAME".into(), script_filename);
params.insert("SCRIPT_NAME".into(), script_path.into()); params.insert("SCRIPT_NAME".into(), format!("{}{}", php.script_name_prefix, script_path));
if let Some(username) = context.authenticated_user.as_deref() {
params.insert("REMOTE_USER".into(), username.to_owned());
params.insert("AUTH_USER".into(), username.to_owned());
}
if let Some(path_info) = path_info.filter(|value| !value.is_empty()) { if let Some(path_info) = path_info.filter(|value| !value.is_empty()) {
params.insert("PATH_INFO".into(), path_info.into()); params.insert("PATH_INFO".into(), path_info.into());
} }
@@ -208,7 +212,7 @@ pub(super) fn fastcgi_params(
for (name, value) in &php.custom_params { for (name, value) in &php.custom_params {
params.insert(name.clone(), value.clone()); params.insert(name.clone(), value.clone());
} }
if !php.php_values.is_empty() { if php.handler == super::config::FastCgiHandler::PhpFpm && !php.php_values.is_empty() {
let mut value = String::new(); let mut value = String::new();
for (name, item) in &php.php_values { for (name, item) in &php.php_values {
if !value.is_empty() { if !value.is_empty() {
@@ -220,7 +224,7 @@ pub(super) fn fastcgi_params(
} }
params.insert("PHP_VALUE".into(), value); params.insert("PHP_VALUE".into(), value);
} }
if !php.php_admin_values.is_empty() { if php.handler == super::config::FastCgiHandler::PhpFpm && !php.php_admin_values.is_empty() {
let value = php let value = php
.php_admin_values .php_admin_values
.iter() .iter()
@@ -375,7 +379,7 @@ async fn drain_fastcgi_body(
if !stderr.is_empty() { if !stderr.is_empty() {
tracing::warn!( tracing::warn!(
stderr = %String::from_utf8_lossy(&stderr), stderr = %String::from_utf8_lossy(&stderr),
"PHP-FPM FastCGI stderr" "FastCGI stderr"
); );
} }
} }
+7 -10
View File
@@ -73,7 +73,7 @@ async fn php_response_inner(
Ok(Ok(io)) => io, Ok(Ok(io)) => io,
Ok(Err(error)) => { Ok(Err(error)) => {
php.metrics.failure(2); php.metrics.failure(2);
tracing::warn!(%error, service = %service.id, "PHP-FPM connection failed"); tracing::warn!(%error, service = %service.id, "FastCGI connection failed");
return builtin_error_response(StatusCode::BAD_GATEWAY, &method); return builtin_error_response(StatusCode::BAD_GATEWAY, &method);
} }
Err(_) => { Err(_) => {
@@ -94,7 +94,7 @@ async fn php_response_inner(
) { ) {
Ok(params) => params, Ok(params) => params,
Err(error) => { Err(error) => {
tracing::warn!(%error, service = %service.id, "PHP-FPM parameter preparation failed"); tracing::warn!(%error, service = %service.id, "FastCGI parameter preparation failed");
php.metrics.failure(4); php.metrics.failure(4);
return builtin_error_response(StatusCode::BAD_GATEWAY, &method); return builtin_error_response(StatusCode::BAD_GATEWAY, &method);
} }
@@ -136,7 +136,7 @@ async fn php_response_inner(
} }
Ok(Err(FastCgiRequestWriteError::Io(error))) => { Ok(Err(FastCgiRequestWriteError::Io(error))) => {
php.metrics.failure(4); php.metrics.failure(4);
tracing::warn!(%error, service = %service.id, "PHP-FPM request write failed"); tracing::warn!(%error, service = %service.id, "FastCGI request write failed");
return builtin_error_response(StatusCode::BAD_GATEWAY, &method); return builtin_error_response(StatusCode::BAD_GATEWAY, &method);
} }
Err(_) => { Err(_) => {
@@ -156,7 +156,7 @@ async fn php_response_inner(
return builtin_error_response(StatusCode::GATEWAY_TIMEOUT, &method); return builtin_error_response(StatusCode::GATEWAY_TIMEOUT, &method);
} }
Err(error) => { Err(error) => {
tracing::warn!(%error, service = %service.id, "PHP-FPM response read failed"); tracing::warn!(%error, service = %service.id, "FastCGI response read failed");
php.metrics.failure(6); php.metrics.failure(6);
return builtin_error_response(StatusCode::BAD_GATEWAY, &method); return builtin_error_response(StatusCode::BAD_GATEWAY, &method);
} }
@@ -174,7 +174,7 @@ async fn php_response_inner(
match parsed { match parsed {
Ok((status, headers)) => break (status, headers, body), Ok((status, headers)) => break (status, headers, body),
Err(error) => { Err(error) => {
tracing::warn!(%error, service = %service.id, "PHP-FPM CGI headers rejected"); tracing::warn!(%error, service = %service.id, "FastCGI CGI headers rejected");
php.metrics.failure(7); php.metrics.failure(7);
return builtin_error_response(StatusCode::BAD_GATEWAY, &method); return builtin_error_response(StatusCode::BAD_GATEWAY, &method);
} }
@@ -188,7 +188,7 @@ async fn php_response_inner(
FCGI_END_REQUEST => { FCGI_END_REQUEST => {
php.metrics.failure(7); php.metrics.failure(7);
if !stderr.is_empty() { if !stderr.is_empty() {
tracing::warn!(stderr = %String::from_utf8_lossy(&stderr), service = %service.id, "PHP-FPM FastCGI stderr"); tracing::warn!(stderr = %String::from_utf8_lossy(&stderr), service = %service.id, "FastCGI stderr");
} }
return builtin_error_response(StatusCode::BAD_GATEWAY, &method); return builtin_error_response(StatusCode::BAD_GATEWAY, &method);
} }
@@ -196,7 +196,7 @@ async fn php_response_inner(
} }
}; };
if !stderr.is_empty() { if !stderr.is_empty() {
tracing::warn!(stderr = %String::from_utf8_lossy(&stderr), service = %service.id, "PHP-FPM FastCGI stderr"); tracing::warn!(stderr = %String::from_utf8_lossy(&stderr), service = %service.id, "FastCGI stderr");
} }
let send_body = method != Method::HEAD let send_body = method != Method::HEAD
&& status != StatusCode::NO_CONTENT && status != StatusCode::NO_CONTENT
@@ -258,9 +258,6 @@ pub(super) fn php_for_path<'a>(
} }
pub(super) fn protected_script_without_handler(service: &CompiledService, path: &Path) -> bool { pub(super) fn protected_script_without_handler(service: &CompiledService, path: &Path) -> bool {
if service.php.is_some() {
return false;
}
path.extension() path.extension()
.and_then(|value| value.to_str()) .and_then(|value| value.to_str())
.map(|value| value.to_ascii_lowercase()) .map(|value| value.to_ascii_lowercase())
+114 -1
View File
@@ -3,6 +3,7 @@ use super::{
routing::open_components, routing::open_components,
}; };
use anyhow::{bail, ensure, Context, Result}; use anyhow::{bail, ensure, Context, Result};
use ipnet::IpNet;
use axum::{body::Body, response::Response}; use axum::{body::Body, response::Response};
use http::{ use http::{
header::{CACHE_CONTROL, EXPIRES, LOCATION}, header::{CACHE_CONTROL, EXPIRES, LOCATION},
@@ -14,6 +15,7 @@ use std::{
collections::{BTreeMap, HashSet}, collections::{BTreeMap, HashSet},
fs, fs,
io::Read, io::Read,
net::IpAddr,
path::{Path, PathBuf}, path::{Path, PathBuf},
str::FromStr, str::FromStr,
time::{Duration, SystemTime}, time::{Duration, SystemTime},
@@ -27,6 +29,8 @@ const MAX_HTACCESS_RULES: usize = 256;
const MAX_HTACCESS_CONDITIONS: usize = 512; const MAX_HTACCESS_CONDITIONS: usize = 512;
const MAX_HTACCESS_HEADERS: usize = 64; const MAX_HTACCESS_HEADERS: usize = 64;
const MAX_HTACCESS_MIME_TYPES: usize = 128; const MAX_HTACCESS_MIME_TYPES: usize = 128;
const MAX_HTACCESS_ACCESS_SELECTORS: usize = 128;
const MAX_HTACCESS_FILE_RULES: usize = 64;
fn default_filename() -> String { fn default_filename() -> String {
".htaccess".into() ".htaccess".into()
@@ -85,6 +89,7 @@ pub struct Compiled {
struct Scope { struct Scope {
components: Vec<String>, components: Vec<String>,
rewrites: Vec<RewriteRule>, rewrites: Vec<RewriteRule>,
redirects: Vec<SimpleRedirect>,
directory_index: Option<Vec<String>>, directory_index: Option<Vec<String>>,
directory_listing: Option<bool>, directory_listing: Option<bool>,
mime_types: BTreeMap<String, HeaderValue>, mime_types: BTreeMap<String, HeaderValue>,
@@ -94,6 +99,83 @@ struct Scope {
expires_default: Option<Duration>, expires_default: Option<Duration>,
expires_by_type: Vec<(String, Duration)>, expires_by_type: Vec<(String, Duration)>,
deny_all: Option<bool>, deny_all: Option<bool>,
legacy_access: Option<LegacyAccess>,
file_rules: Vec<FileAccessRule>,
}
// Apache Files / FilesMatch rules apply to filenames below their directory.
// Only bounded access-control directives are accepted inside these blocks.
#[derive(Debug, Clone)]
struct FileAccessRule {
matcher: Regex,
deny_all: Option<bool>,
legacy_access: Option<LegacyAccess>,
}
impl FileAccessRule {
fn denied(&self, client_ip: IpAddr) -> Option<bool> {
if let Some(legacy) = &self.legacy_access {
Some(self.deny_all.unwrap_or(false) || legacy.denied(client_ip))
} else {
self.deny_all
}
}
}
// Apache 2.2 mod_access_compat's Order/Allow/Deny are access rules, not
// harmless unsupported directives. Evaluate them instead of silently skipping
// them and accidentally publishing protected files.
#[derive(Debug, Clone, Copy, Default)]
enum LegacyOrder {
#[default]
DenyAllow,
AllowDeny,
MutualFailure,
}
#[derive(Debug, Clone)]
enum AccessSelector {
All,
Network(IpNet),
}
impl AccessSelector {
fn matches(&self, client_ip: IpAddr) -> bool {
match self {
Self::All => true,
Self::Network(network) => network.contains(&client_ip),
}
}
}
#[derive(Debug, Clone, Default)]
struct LegacyAccess {
order: LegacyOrder,
allow: Vec<AccessSelector>,
deny: Vec<AccessSelector>,
}
impl LegacyAccess {
fn denied(&self, client_ip: IpAddr) -> bool {
let allowed = self.allow.iter().any(|selector| selector.matches(client_ip));
let denied = self.deny.iter().any(|selector| selector.matches(client_ip));
match self.order {
LegacyOrder::DenyAllow => denied && !allowed,
LegacyOrder::AllowDeny | LegacyOrder::MutualFailure => !allowed || denied,
}
}
}
#[derive(Debug, Clone)]
struct SimpleRedirect {
matcher: RedirectMatcher,
replacement: String,
status: StatusCode,
}
#[derive(Debug, Clone)]
enum RedirectMatcher {
Prefix(String),
Regex(Regex),
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@@ -158,7 +240,7 @@ struct ParseState {
rewrite_engine: bool, rewrite_engine: bool,
pending_conditions: Vec<RewriteCondition>, pending_conditions: Vec<RewriteCondition>,
skip_next_rule: bool, skip_next_rule: bool,
in_files_block: usize, file_block: Option<FileAccessRule>,
unsupported: Vec<String>, unsupported: Vec<String>,
} }
@@ -395,6 +477,37 @@ fn normalize_extension(value: &str) -> Result<String> {
Ok(value) Ok(value)
} }
fn legacy_access_selectors(parts: &[String], path: &Path, line_no: usize) -> Result<Vec<AccessSelector>> {
ensure!(
parts.len() >= 3 && parts[1].eq_ignore_ascii_case("from"),
"{}:{line_no}: {} expects 'from all' or 'from IP/CIDR'",
path.display(),
parts[0]
);
ensure!(
parts.len() - 2 <= MAX_HTACCESS_ACCESS_SELECTORS,
"{}:{line_no}: too many access-control selectors",
path.display()
);
let mut selectors = Vec::with_capacity(parts.len() - 2);
for value in &parts[2..] {
if value.eq_ignore_ascii_case("all") {
selectors.push(AccessSelector::All);
} else {
let network = if let Ok(ip) = value.parse::<IpAddr>() {
IpNet::from(ip)
} else {
value.parse::<IpNet>().with_context(|| format!(
"{}:{line_no}: unsupported {} source {value:?}; only all, IP and CIDR are supported to avoid weakening access control",
path.display(), parts[0]
))?
};
selectors.push(AccessSelector::Network(network));
}
}
Ok(selectors)
}
fn unsupported( fn unsupported(
state: &mut ParseState, state: &mut ParseState,
config: &Config, config: &Config,
+166 -18
View File
@@ -1,3 +1,115 @@
fn redirect_status(value: &str) -> Option<StatusCode> {
match value.to_ascii_lowercase().as_str() {
"permanent" | "301" => Some(StatusCode::MOVED_PERMANENTLY),
"temp" | "temporary" | "302" => Some(StatusCode::FOUND),
"seeother" | "303" => Some(StatusCode::SEE_OTHER),
"307" => Some(StatusCode::TEMPORARY_REDIRECT),
"308" => Some(StatusCode::PERMANENT_REDIRECT),
_ => None,
}
}
fn redirect_rule(parts: &[String], regex: bool) -> Result<SimpleRedirect> {
let (status, source_index) = if parts.len() == 4 {
(redirect_status(&parts[1]).context("unsupported Redirect status")?, 2)
} else {
ensure!(parts.len() == 3, "Redirect / RedirectMatch expects [status] source target");
(StatusCode::FOUND, 1)
};
let source = &parts[source_index];
let replacement = &parts[source_index + 1];
ensure!(!source.is_empty() && source.len() <= 512 && replacement.len() <= 1024,
"Redirect source/target is invalid");
ensure!((replacement.starts_with('/') && !replacement.starts_with("//"))
|| replacement.starts_with("http://") || replacement.starts_with("https://"),
"Redirect target must be a local absolute path or an explicit http(s) URL");
ensure!(!replacement.contains('\\') && !replacement.contains('\r') && !replacement.contains('\n'),
"Redirect target contains unsafe characters");
HeaderValue::from_str(replacement).context("invalid Redirect target")?;
let matcher = if regex {
RedirectMatcher::Regex(Regex::new(source).context("invalid RedirectMatch regex")?)
} else {
ensure!(source.starts_with('/') && !source.starts_with("//")
&& !source.contains('\r') && !source.contains('\n') && !source.contains('?')
&& !source.contains('#') && !source.contains('\\'), "invalid Redirect path prefix");
RedirectMatcher::Prefix(source.to_owned())
};
Ok(SimpleRedirect { matcher, replacement: replacement.to_owned(), status })
}
// Only a safe, deterministic subset of Apache access rules is allowed in
// <Files> and <FilesMatch>. Unknown directives inside a security scope must
// fail closed, including when the general "ignore unsupported" option is off.
fn file_rule_start(line: &str) -> Result<FileAccessRule> {
let inner = line.trim().strip_prefix('<').and_then(|s| s.strip_suffix('>'))
.context("unterminated Files or FilesMatch tag")?;
let (tag, value) = inner.split_once(char::is_whitespace)
.context("Files or FilesMatch requires a filename/pattern")?;
let values = tokens(value)?;
let regex_pattern = if tag.eq_ignore_ascii_case("filesmatch") {
ensure!(values.len() == 1, "FilesMatch needs one quoted regex");
values[0].clone()
} else {
// Apache also accepts <Files ~ "regex"> as an alias of FilesMatch.
if values.len() == 2 && values[0] == "~" {
values[1].clone()
} else {
ensure!(values.len() == 1, "Files needs a single filename/glob");
let mut pattern = String::from("^");
for ch in values[0].chars() {
match ch {
'*' => pattern.push_str(".*"),
'?' => pattern.push('.'),
_ => pattern.push_str(&regex::escape(&ch.to_string())),
}
}
pattern.push('$');
pattern
}
};
ensure!(regex_pattern.len() <= 512, "Files/FilesMatch pattern exceeds 512 bytes");
Ok(FileAccessRule { matcher: Regex::new(&regex_pattern)
.context("invalid Files/FilesMatch regular expression")?,
deny_all: None, legacy_access: None })
}
fn apply_access_directive(
directive: &str, parts: &[String], path: &Path, line_no: usize,
deny_all: &mut Option<bool>, legacy_access: &mut Option<LegacyAccess>,
) -> Result<()> {
match directive {
"require" => {
if parts.len() == 3 && parts[1].eq_ignore_ascii_case("all") && parts[2].eq_ignore_ascii_case("denied") {
*deny_all = Some(true);
} else if parts.len() == 3 && parts[1].eq_ignore_ascii_case("all") && parts[2].eq_ignore_ascii_case("granted") {
*deny_all = Some(false);
} else {
bail!("{}:{line_no}: unsupported Require; refusing to ignore access control", path.display());
}
}
"order" => {
ensure!(parts.len() == 2, "{}:{line_no}: Order expects allow,deny or deny,allow", path.display());
let order = match parts[1].to_ascii_lowercase().as_str() {
"deny,allow" => LegacyOrder::DenyAllow,
"allow,deny" => LegacyOrder::AllowDeny,
"mutual-failure" => LegacyOrder::MutualFailure,
_ => bail!("{}:{line_no}: unsupported Order value {:?}", path.display(), parts[1]),
};
legacy_access.get_or_insert_with(LegacyAccess::default).order = order;
}
"allow" | "deny" => {
let selectors = legacy_access_selectors(parts, path, line_no)?;
let access = legacy_access.get_or_insert_with(LegacyAccess::default);
let dest = if directive == "allow" { &mut access.allow } else { &mut access.deny };
ensure!(dest.len() + selectors.len() <= MAX_HTACCESS_ACCESS_SELECTORS,
"{}:{line_no}: too many access-control selectors", path.display());
dest.extend(selectors);
}
_ => bail!("{}:{line_no}: unsupported access directive", path.display()),
}
Ok(())
}
fn parse_file(path: &Path, components: Vec<String>, config: &Config) -> Result<(Scope, Vec<String>)> { fn parse_file(path: &Path, components: Vec<String>, config: &Config) -> Result<(Scope, Vec<String>)> {
let content = read_htaccess_nofollow(path)?; let content = read_htaccess_nofollow(path)?;
let mut scope = Scope { components, ..Scope::default() }; let mut scope = Scope { components, ..Scope::default() };
@@ -11,21 +123,33 @@ fn parse_file(path: &Path, components: Vec<String>, config: &Config) -> Result<(
if line.is_empty() || line.starts_with('#') { continue; } if line.is_empty() || line.starts_with('#') { continue; }
let lower_line = line.to_ascii_lowercase(); let lower_line = line.to_ascii_lowercase();
if lower_line.starts_with("<ifmodule") || lower_line == "</ifmodule>" { continue; } if lower_line.starts_with("<ifmodule") || lower_line == "</ifmodule>" { continue; }
if lower_line.starts_with("<files") || lower_line.starts_with("<filesmatch") { if lower_line == "</files>" || lower_line == "</filesmatch>" {
if lower_line.contains(".htaccess") || lower_line.contains(".htpasswd") || lower_line.contains("^\\.ht") { let rule = state.file_block.take()
state.in_files_block = state.in_files_block.saturating_add(1); .with_context(|| format!("{}:{line_no}: unmatched Files/FilesMatch closing tag", path.display()))?;
continue; ensure!(rule.deny_all.is_some() || rule.legacy_access.is_some(),
} "{}:{line_no}: Files/FilesMatch block has no supported access rule", path.display());
bail!("{}:{line_no}: general Files/FilesMatch semantics are not supported; refusing to ignore an access/handler scope", path.display()); scope.file_rules.push(rule);
}
if line.eq_ignore_ascii_case("</Files>") || line.eq_ignore_ascii_case("</FilesMatch>") {
state.in_files_block = state.in_files_block.saturating_sub(1);
continue; continue;
} }
if state.in_files_block != 0 { if lower_line.starts_with("<files ") || lower_line.starts_with("<filesmatch ") {
ensure!(state.file_block.is_none(), "{}:{line_no}: nested Files/FilesMatch blocks are unsupported", path.display());
ensure!(scope.file_rules.len() < MAX_HTACCESS_FILE_RULES,
"{}:{line_no}: too many Files/FilesMatch rules", path.display());
state.file_block = Some(file_rule_start(line)
.with_context(|| format!("{}:{line_no}", path.display()))?);
continue; continue;
} }
let parts = tokens(line).with_context(|| format!("{}:{line_no}", path.display()))?; let parts = tokens(line).with_context(|| format!("{}:{line_no}", path.display()))?;
if let Some(rule) = state.file_block.as_mut() {
let directive = parts.first().map(|s| s.to_ascii_lowercase()).unwrap_or_default();
if !matches!(directive.as_str(), "require" | "order" | "allow" | "deny") {
bail!("{}:{line_no}: unsupported {} inside Files/FilesMatch; refusing unsafe ignore",
path.display(), parts.first().map(String::as_str).unwrap_or("directive"));
}
apply_access_directive(&directive, &parts, path, line_no,
&mut rule.deny_all, &mut rule.legacy_access)?;
continue;
}
if parts.is_empty() { continue; } if parts.is_empty() { continue; }
let directive = parts[0].to_ascii_lowercase(); let directive = parts[0].to_ascii_lowercase();
match directive.as_str() { match directive.as_str() {
@@ -127,20 +251,25 @@ fn parse_file(path: &Path, components: Vec<String>, config: &Config) -> Result<(
ensure!(parts.len() >= 3, "{}:{line_no}: ExpiresByType needs media type and duration", path.display()); ensure!(parts.len() >= 3, "{}:{line_no}: ExpiresByType needs media type and duration", path.display());
scope.expires_by_type.push((parts[1].to_ascii_lowercase(), parse_duration(&parts[2..].join(" "))?)); scope.expires_by_type.push((parts[1].to_ascii_lowercase(), parse_duration(&parts[2..].join(" "))?));
} }
"require" => { "require" | "order" | "allow" | "deny" => {
if parts.len() == 3 && parts[1].eq_ignore_ascii_case("all") && parts[2].eq_ignore_ascii_case("denied") { scope.deny_all = Some(true); } apply_access_directive(&directive, &parts, path, line_no,
else if parts.len() == 3 && parts[1].eq_ignore_ascii_case("all") && parts[2].eq_ignore_ascii_case("granted") { scope.deny_all = Some(false); } &mut scope.deny_all, &mut scope.legacy_access)?;
else { bail!("{}:{line_no}: only 'Require all granted/denied' is supported; refusing to ignore an access-control directive", path.display()); }
} }
"sethandler" | "removehandler" | "authtype" | "authname" | "authuserfile" | "authgroupfile" | "order" | "allow" | "deny" => { "sethandler" | "removehandler" | "authtype" | "authname" | "authuserfile" | "authgroupfile" => {
bail!("{}:{line_no}: security/handler directive {} is not supported and cannot be ignored safely", path.display(), parts[0]); bail!("{}:{line_no}: security/handler directive {} is not supported and cannot be ignored safely", path.display(), parts[0]);
} }
"errordocument" | "setenvif" | "redirect" | "redirectmatch" | "fallbackresource" => { "redirect" | "redirectmatch" => {
ensure!(scope.redirects.len() < 64, "{}:{line_no}: at most 64 Redirect/RedirectMatch rules per file", path.display());
scope.redirects.push(redirect_rule(&parts, directive == "redirectmatch")
.with_context(|| format!("{}:{line_no}", path.display()))?);
}
"errordocument" | "setenvif" | "fallbackresource" => {
unsupported(&mut state, config, path, line_no, format!("directive {} is not in the RustProxy compatibility subset", parts[0]))?; unsupported(&mut state, config, path, line_no, format!("directive {} is not in the RustProxy compatibility subset", parts[0]))?;
} }
_ => unsupported(&mut state, config, path, line_no, format!("unsupported directive {}", parts[0]))?, _ => unsupported(&mut state, config, path, line_no, format!("unsupported directive {}", parts[0]))?,
} }
} }
ensure!(state.file_block.is_none(), "{}: unclosed Files/FilesMatch block", path.display());
ensure!(state.pending_conditions.is_empty(), "{}: RewriteCond without following RewriteRule", path.display()); ensure!(state.pending_conditions.is_empty(), "{}: RewriteCond without following RewriteRule", path.display());
Ok((scope, state.unsupported)) Ok((scope, state.unsupported))
} }
@@ -215,9 +344,28 @@ fn matching_scopes<'a>(compiled: &'a Compiled, path: &str) -> Vec<&'a Scope> {
compiled.scopes.iter().filter(|scope| scope_matches(scope, &components)).collect() compiled.scopes.iter().filter(|scope| scope_matches(scope, &components)).collect()
} }
pub fn denied(compiled: Option<&Compiled>, path: &str) -> bool { pub fn denied(compiled: Option<&Compiled>, path: &str, client_ip: IpAddr) -> bool {
let Some(compiled) = compiled else { return false; }; let Some(compiled) = compiled else { return false; };
matching_scopes(compiled, path).into_iter().filter_map(|scope| scope.deny_all).next_back().unwrap_or(false) let scopes = matching_scopes(compiled, path);
// A matching <Files>/<FilesMatch> denial is additive. A narrower file
// grant must not cancel a directory denial or another matched file rule.
let basename = path_components(path).ok().and_then(|parts| parts.last().cloned());
if let Some(name) = basename {
for scope in &scopes {
for rule in &scope.file_rules {
if rule.matcher.is_match(&name) && rule.denied(client_ip) == Some(true) {
return true;
}
}
}
}
scopes.into_iter().filter_map(|scope| {
if let Some(legacy) = &scope.legacy_access {
Some(scope.deny_all.unwrap_or(false) || legacy.denied(client_ip))
} else {
scope.deny_all
}
}).next_back().unwrap_or(false)
} }
pub fn index_files<'a>(compiled: Option<&'a Compiled>, directory_components: &[String], fallback: &'a [String]) -> &'a [String] { pub fn index_files<'a>(compiled: Option<&'a Compiled>, directory_components: &[String], fallback: &'a [String]) -> &'a [String] {
+31
View File
@@ -22,6 +22,37 @@ pub async fn apply_rewrites(
let mut changed = false; let mut changed = false;
let mut end = false; let mut end = false;
'scope: for scope in scopes { 'scope: for scope in scopes {
// Apache mod_alias Redirect / RedirectMatch, independently of RewriteEngine.
for rule in &scope.redirects {
let tail = match &rule.matcher {
RedirectMatcher::Prefix(prefix) => {
if path == *prefix { Some("") }
else if prefix.ends_with('/') && path.starts_with(prefix) {
Some(&path[prefix.len()..])
} else { path.strip_prefix(prefix).filter(|tail| tail.starts_with('/')) }
}
RedirectMatcher::Regex(_) => None,
};
let target = match &rule.matcher {
RedirectMatcher::Prefix(_) => tail.map(|tail| format!("{}{}", rule.replacement, tail)),
RedirectMatcher::Regex(regex) => regex.captures(&path).map(|captures| {
let mut target = String::new();
captures.expand(&rule.replacement, &mut target);
target
}),
};
if let Some(mut target) = target {
ensure!((target.starts_with('/') && !target.starts_with("//"))
|| target.starts_with("http://") || target.starts_with("https://"),
"unsafe .htaccess Redirect expansion");
ensure!(!target.contains('\\') && !target.contains('\r') && !target.contains('\n'),
"unsafe .htaccess Redirect expansion");
if let Some(query) = query.as_deref().filter(|q| !q.is_empty()) {
if !target.contains('?') { target.push('?'); target.push_str(query); }
}
return Ok(RewriteOutcome::Redirect(redirect_response(rule.status, &target)?));
}
}
for rule in &scope.rewrites { for rule in &scope.rewrites {
let relative = scope_relative_path(scope, &path); let relative = scope_relative_path(scope, &path);
if !rule.pattern.is_match(&relative) { if !rule.pattern.is_match(&relative) {
+1 -1
View File
@@ -10,7 +10,7 @@ mod security;
mod serve; mod serve;
pub use config::{ pub use config::{
CacheRule, CompiledService, Hardening, Php, PhpFpmProfile, Precompressed, RewriteRule, CacheRule, CompiledService, FastCgiHandler, Hardening, Php, PhpFpmProfile, Precompressed, RewriteRule,
SendfileMode, Service, SymlinkPolicy, SendfileMode, Service, SymlinkPolicy,
}; };
pub use htaccess::Config as HtaccessConfig; pub use htaccess::Config as HtaccessConfig;
+2
View File
@@ -8,6 +8,8 @@ pub struct RequestContext {
pub server_port: u16, pub server_port: u16,
pub tls: bool, pub tls: bool,
pub version: Version, pub version: Version,
/// Set only after Vhost Basic authentication has succeeded.
pub authenticated_user: Option<String>,
} }
pub(super) fn server_protocol(version: http::Version) -> &'static str { pub(super) fn server_protocol(version: http::Version) -> &'static str {
+21 -12
View File
@@ -4,6 +4,7 @@ use super::{
}, },
filesystem::{list_directory_sync, path_components, FilesystemRoot}, filesystem::{list_directory_sync, path_components, FilesystemRoot},
htaccess, htaccess,
config::FastCgiHandler,
response::{ response::{
add_service_headers, builtin_error_response, directory_listing, directory_redirect, add_service_headers, builtin_error_response, directory_listing, directory_redirect,
file_response, io_response, status_response, file_response, io_response, status_response,
@@ -22,7 +23,7 @@ use http::{
}; };
use std::{io, path::PathBuf}; use std::{io, path::PathBuf};
async fn resolve_php_path_info( async fn resolve_script_path_info(
service: &CompiledService, service: &CompiledService,
components: &[String], components: &[String],
) -> Option<(String, String)> { ) -> Option<(String, String)> {
@@ -77,7 +78,7 @@ async fn serve_inner(
components components
.iter() .iter()
.any(|component| htaccess::protected_component(service.htaccess.as_ref(), component)) .any(|component| htaccess::protected_component(service.htaccess.as_ref(), component))
}) || htaccess::denied(service.htaccess.as_ref(), path) }) || htaccess::denied(service.htaccess.as_ref(), path, context.client_ip)
{ {
return builtin_error_response(StatusCode::FORBIDDEN, &method); return builtin_error_response(StatusCode::FORBIDDEN, &method);
} }
@@ -125,18 +126,18 @@ async fn serve_inner(
htaccess::protected_component(service.htaccess.as_ref(), component) htaccess::protected_component(service.htaccess.as_ref(), component)
}) })
}) })
|| htaccess::denied(service.htaccess.as_ref(), &rewritten_path) || htaccess::denied(service.htaccess.as_ref(), &rewritten_path, context.client_ip)
{ {
return builtin_error_response(StatusCode::FORBIDDEN, &method); return builtin_error_response(StatusCode::FORBIDDEN, &method);
} }
if let Ok(components) = path_components(&rewritten_path) { if let Ok(components) = path_components(&rewritten_path) {
if let Some((script_path, path_info)) = resolve_php_path_info(service, &components).await { if let Some((script_path, path_info)) = resolve_script_path_info(service, &components).await {
let script_components = path_components(&script_path).unwrap_or_default(); let script_components = path_components(&script_path).unwrap_or_default();
if hardening_denied_path(service, &script_path) if hardening_denied_path(service, &script_path)
|| script_components.iter().any(|component| { || script_components.iter().any(|component| {
htaccess::protected_component(service.htaccess.as_ref(), component) htaccess::protected_component(service.htaccess.as_ref(), component)
}) })
|| htaccess::denied(service.htaccess.as_ref(), &script_path) || htaccess::denied(service.htaccess.as_ref(), &script_path, context.client_ip)
{ {
return builtin_error_response(StatusCode::FORBIDDEN, &method); return builtin_error_response(StatusCode::FORBIDDEN, &method);
} }
@@ -178,7 +179,7 @@ async fn serve_inner(
|| components || components
.iter() .iter()
.any(|component| htaccess::protected_component(service.htaccess.as_ref(), component)) .any(|component| htaccess::protected_component(service.htaccess.as_ref(), component))
|| htaccess::denied(service.htaccess.as_ref(), &effective_path) || htaccess::denied(service.htaccess.as_ref(), &effective_path, context.client_ip)
{ {
return builtin_error_response(StatusCode::FORBIDDEN, &method); return builtin_error_response(StatusCode::FORBIDDEN, &method);
} }
@@ -192,14 +193,14 @@ async fn serve_inner(
) => ) =>
{ {
if let Some((script_path, path_info)) = if let Some((script_path, path_info)) =
resolve_php_path_info(service, &components).await resolve_script_path_info(service, &components).await
{ {
let script_components = path_components(&script_path).unwrap_or_default(); let script_components = path_components(&script_path).unwrap_or_default();
if hardening_denied_path(service, &script_path) if hardening_denied_path(service, &script_path)
|| script_components.iter().any(|component| { || script_components.iter().any(|component| {
htaccess::protected_component(service.htaccess.as_ref(), component) htaccess::protected_component(service.htaccess.as_ref(), component)
}) })
|| htaccess::denied(service.htaccess.as_ref(), &script_path) || htaccess::denied(service.htaccess.as_ref(), &script_path, context.client_ip)
{ {
return builtin_error_response(StatusCode::FORBIDDEN, &method); return builtin_error_response(StatusCode::FORBIDDEN, &method);
} }
@@ -242,7 +243,10 @@ async fn serve_inner(
) )
.await; .await;
} }
if protected_script_without_handler(service, &public_path) { if protected_script_without_handler(service, &public_path)
|| service.php.as_ref().is_some_and(|php| php.handler == FastCgiHandler::Fcgiwrap)
{
// A CGI-only root must never expose any non-executed file.
return builtin_error_response(StatusCode::FORBIDDEN, &method); return builtin_error_response(StatusCode::FORBIDDEN, &method);
} }
if method != Method::GET && method != Method::HEAD { if method != Method::GET && method != Method::HEAD {
@@ -276,7 +280,9 @@ async fn serve_inner(
let mut script_path = effective_path.trim_end_matches('/').to_owned(); let mut script_path = effective_path.trim_end_matches('/').to_owned();
script_path.push('/'); script_path.push('/');
script_path.push_str(index); script_path.push_str(index);
if hardening_denied_path(service, &script_path) { if hardening_denied_path(service, &script_path)
|| htaccess::denied(service.htaccess.as_ref(), &script_path, context.client_ip)
{
return builtin_error_response(StatusCode::FORBIDDEN, &method); return builtin_error_response(StatusCode::FORBIDDEN, &method);
} }
let public_path = PathBuf::from(&script_path); let public_path = PathBuf::from(&script_path);
@@ -295,7 +301,9 @@ async fn serve_inner(
) )
.await; .await;
} }
if protected_script_without_handler(service, &public_path) { if protected_script_without_handler(service, &public_path)
|| service.php.as_ref().is_some_and(|php| php.handler == FastCgiHandler::Fcgiwrap)
{
return builtin_error_response(StatusCode::FORBIDDEN, &method); return builtin_error_response(StatusCode::FORBIDDEN, &method);
} }
if method != Method::GET && method != Method::HEAD { if method != Method::GET && method != Method::HEAD {
@@ -333,7 +341,8 @@ async fn serve_inner(
if method != Method::GET && method != Method::HEAD { if method != Method::GET && method != Method::HEAD {
return method_not_allowed_response(); return method_not_allowed_response();
} }
if !htaccess::directory_listing( if service.php.as_ref().is_some_and(|php| php.handler == FastCgiHandler::Fcgiwrap)
|| !htaccess::directory_listing(
service.htaccess.as_ref(), service.htaccess.as_ref(),
&components, &components,
service.directory_listing, service.directory_listing,
+231
View File
@@ -68,6 +68,7 @@ async fn serve_body_request(
server_port: 80, server_port: 80,
tls: false, tls: false,
version: Version::HTTP_11, version: Version::HTTP_11,
authenticated_user: None,
}, },
) )
.await .await
@@ -1126,6 +1127,62 @@ SetHandler application/x-httpd-php
assert!(error.contains("Files/FilesMatch")); assert!(error.contains("Files/FilesMatch"));
} }
#[tokio::test]
async fn htaccess_legacy_deny_from_all_is_enforced_even_in_non_strict_mode() {
let tmp = TempDir::new().unwrap();
std::fs::create_dir(tmp.path().join("private")).unwrap();
std::fs::write(tmp.path().join("index.html"), b"public").unwrap();
std::fs::write(tmp.path().join("private/secret.txt"), b"secret").unwrap();
std::fs::write(
tmp.path().join("private/.htaccess"),
b"Order allow,deny\nDeny from all\nErrorDocument 403 /denied.html\nOptions +FollowSymLinks\n",
).unwrap();
let mut configured = Service {
id: "htaccess-deny-all".into(),
name: "htaccess deny all".into(),
document_root: tmp.path().to_path_buf(),
htaccess: htaccess::Config { enabled: true, strict: false, ..Default::default() },
..Default::default()
};
configured.validate().unwrap();
let service = configured.compile().unwrap();
assert_eq!(service.htaccess.as_ref().unwrap().warnings.len(), 2);
assert_eq!(serve_request(&service, &request(Method::GET, "/index.html"), "/index.html").await.status(), StatusCode::OK);
assert_eq!(serve_request(&service, &request(Method::GET, "/private/secret.txt"), "/private/secret.txt").await.status(), StatusCode::FORBIDDEN);
}
#[test]
fn htaccess_legacy_order_and_ip_rules_follow_apache_22_precedence() {
let tmp = TempDir::new().unwrap();
let ht = tmp.path().join(".htaccess");
let config = htaccess::Config { enabled: true, strict: true, ..Default::default() };
std::fs::write(&ht, b"Order deny,allow\nDeny from all\nAllow from 192.0.2.0/24\n").unwrap();
let compiled = htaccess::compile(tmp.path(), &config).unwrap().unwrap();
assert!(htaccess::denied(Some(&compiled), "/index.html", "198.51.100.1".parse().unwrap()));
assert!(!htaccess::denied(Some(&compiled), "/index.html", "192.0.2.42".parse().unwrap()));
std::fs::write(&ht, b"Order allow,deny\nAllow from 192.0.2.0/24\nDeny from 192.0.2.42\n").unwrap();
let compiled = htaccess::compile(tmp.path(), &config).unwrap().unwrap();
assert!(!htaccess::denied(Some(&compiled), "/index.html", "192.0.2.41".parse().unwrap()));
assert!(htaccess::denied(Some(&compiled), "/index.html", "192.0.2.42".parse().unwrap()));
assert!(htaccess::denied(Some(&compiled), "/index.html", "198.51.100.1".parse().unwrap()));
std::fs::write(&ht, b"Order allow,deny\nAllow from 2001:db8::/32\nDeny from 2001:db8::bad\n").unwrap();
let compiled = htaccess::compile(tmp.path(), &config).unwrap().unwrap();
assert!(!htaccess::denied(Some(&compiled), "/index.html", "2001:db8::1".parse().unwrap()));
assert!(htaccess::denied(Some(&compiled), "/index.html", "2001:db8::bad".parse().unwrap()));
}
#[test]
fn htaccess_legacy_unsupported_hostnames_fail_closed_with_strict_disabled() {
let tmp = TempDir::new().unwrap();
std::fs::write(tmp.path().join(".htaccess"), b"Deny from protected.example\n").unwrap();
let config = htaccess::Config { enabled: true, strict: false, ..Default::default() };
let error = htaccess::compile(tmp.path(), &config).unwrap_err().to_string();
assert!(error.contains("only all, IP and CIDR are supported"), "{error}");
}
#[test] #[test]
fn htaccess_strict_mode_rejects_unsupported_directives() { fn htaccess_strict_mode_rejects_unsupported_directives() {
let tmp = TempDir::new().unwrap(); let tmp = TempDir::new().unwrap();
@@ -1221,6 +1278,7 @@ fn fastcgi_never_forwards_proxy_header_as_http_proxy() {
server_port: 80, server_port: 80,
tls: false, tls: false,
version: Version::HTTP_11, version: Version::HTTP_11,
authenticated_user: None,
}, },
) )
.unwrap(); .unwrap();
@@ -1272,6 +1330,7 @@ fn php_custom_fastcgi_params_and_php_values_are_validated() {
server_port: 443, server_port: 443,
tls: true, tls: true,
version: Version::HTTP_2, version: Version::HTTP_2,
authenticated_user: None,
}, },
) )
.unwrap(); .unwrap();
@@ -1327,6 +1386,7 @@ fn fastcgi_path_info_keeps_script_filename_separate() {
server_port: 80, server_port: 80,
tls: false, tls: false,
version: Version::HTTP_11, version: Version::HTTP_11,
authenticated_user: None,
}, },
) )
.unwrap(); .unwrap();
@@ -1539,6 +1599,7 @@ fn php_admin_values_are_operator_only_and_serialized() {
server_port: 8589, server_port: 8589,
tls: false, tls: false,
version: Version::HTTP_11, version: Version::HTTP_11,
authenticated_user: None,
}, },
) )
.unwrap(); .unwrap();
@@ -1596,6 +1657,7 @@ fn fastcgi_always_sets_http_host_for_http2_http3_wordpress_requests() {
server_port: 443, server_port: 443,
tls: true, tls: true,
version, version,
authenticated_user: None,
}, },
) )
.unwrap(); .unwrap();
@@ -1645,6 +1707,7 @@ fn fastcgi_http_host_keeps_explicit_host_and_port() {
server_port: 443, server_port: 443,
tls: true, tls: true,
version: Version::HTTP_11, version: Version::HTTP_11,
authenticated_user: None,
}, },
) )
.unwrap(); .unwrap();
@@ -2454,3 +2517,171 @@ fn sendfile_mode_is_backward_compatible_and_rejects_unknown_values() {
SendfileMode::Off SendfileMode::Off
); );
} }
#[test]
fn fastcgi_handler_is_backward_compatible_and_prevents_php_as_cgi() {
let legacy: Php = serde_json::from_str(r#"{"enabled":false}"#).unwrap();
assert_eq!(legacy.handler, FastCgiHandler::PhpFpm);
assert_eq!(legacy.script_name_prefix, "");
assert_eq!(
serde_json::from_str::<FastCgiHandler>(r#""fcgiwrap""#).unwrap(),
FastCgiHandler::Fcgiwrap
);
assert_eq!(
serde_json::from_str::<FastCgiHandler>(r#""fastcgi""#).unwrap(),
FastCgiHandler::Fastcgi
);
for handler in [FastCgiHandler::Fcgiwrap, FastCgiHandler::Fastcgi] {
let mut unsafe_php = Php {
enabled: true,
handler,
extensions: vec!["php".into()],
..Default::default()
};
assert!(unsafe_php.validate().is_err());
let mut unsafe_ini = Php {
enabled: true,
handler,
extensions: vec!["cgi".into()],
php_values: BTreeMap::from([("memory_limit".into(), "128M".into())]),
..Default::default()
};
assert!(unsafe_ini.validate().is_err());
}
let mut bad_prefix = Php {
enabled: true,
handler: FastCgiHandler::Fcgiwrap,
extensions: vec!["cgi".into()],
script_name_prefix: "/app/../admin".into(),
..Default::default()
};
assert!(bad_prefix.validate().is_err());
}
#[tokio::test]
async fn generic_fcgiwrap_mount_passes_public_script_name_without_exposing_other_files() {
let tmp = TempDir::new().unwrap();
std::fs::write(tmp.path().join("health.cgi"), b"#!/bin/sh\necho ok\n").unwrap();
std::fs::write(tmp.path().join("configuration.txt"), b"private CGI settings").unwrap();
let (address, received) = fastcgi_fixture_record_params().await;
let mut config = Service {
id: "cgi-app".into(),
name: "CGI app".into(),
document_root: tmp.path().to_path_buf(),
php: Php {
enabled: true,
handler: FastCgiHandler::Fcgiwrap,
extensions: vec!["cgi".into()],
endpoint: format!("tcp:{address}"),
path_info: true,
script_name_prefix: "/app/cgi-bin".into(),
..Default::default()
},
..Default::default()
};
config.validate().unwrap();
let service = config.compile().unwrap();
// The Vhost strips /app/cgi-bin before invoking the mounted Web Service.
let uri = "/app/cgi-bin/health.cgi/more?query=1";
let response = serve_request(&service, &request(Method::GET, uri), "/health.cgi/more").await;
assert_eq!(response.status(), StatusCode::OK);
let params = received.await.unwrap();
assert_eq!(params["SCRIPT_FILENAME"].as_str(), tmp.path().join("health.cgi").to_string_lossy().as_ref());
assert_eq!(params["SCRIPT_NAME"], "/app/cgi-bin/health.cgi");
assert_eq!(params["PATH_INFO"], "/more");
assert_eq!(params["REQUEST_URI"], uri);
assert_eq!(params["QUERY_STRING"], "query=1");
let forbidden = serve_request(
&service,
&request(Method::GET, "/app/cgi-bin/configuration.txt"),
"/configuration.txt",
).await;
assert_eq!(forbidden.status(), StatusCode::FORBIDDEN);
}
#[tokio::test]
async fn generic_fastcgi_responder_executes_only_configured_script_extensions() {
let tmp = TempDir::new().unwrap();
std::fs::write(tmp.path().join("handler.fcgi"), b"script").unwrap();
std::fs::write(tmp.path().join("public.txt"), b"public").unwrap();
let (address, received) = fastcgi_fixture_record_params().await;
let mut config = Service {
id: "responder".into(),
name: "FastCGI responder".into(),
document_root: tmp.path().to_path_buf(),
php: Php {
enabled: true,
handler: FastCgiHandler::Fastcgi,
extensions: vec!["fcgi".into()],
endpoint: format!("tcp:{address}"),
..Default::default()
},
..Default::default()
};
config.validate().unwrap();
let service = config.compile().unwrap();
let executed = serve_request(&service, &request(Method::GET, "/handler.fcgi"), "/handler.fcgi").await;
assert_eq!(executed.status(), StatusCode::OK);
assert_eq!(received.await.unwrap()["SCRIPT_NAME"], "/handler.fcgi");
let static_file = serve_request(&service, &request(Method::GET, "/public.txt"), "/public.txt").await;
assert_eq!(static_file.status(), StatusCode::OK);
assert_eq!(static_file.into_body().collect().await.unwrap().to_bytes(), "public");
}
#[tokio::test]
async fn htaccess_filesmatch_enforces_denial_including_directory_index() {
let tmp = TempDir::new().unwrap();
std::fs::write(tmp.path().join("index.html"), b"index").unwrap();
std::fs::write(tmp.path().join("secret.env"), b"secret").unwrap();
std::fs::write(tmp.path().join("public.txt"), b"public").unwrap();
std::fs::write(tmp.path().join(".htaccess"), r#"
<FilesMatch "^secret\.env$">
Require all denied
</FilesMatch>
<Files "index.html">
Deny from all
</Files>
"#).unwrap();
let mut config = Service {
id: "files-rule".into(),
name: "Files rule".into(),
document_root: tmp.path().to_path_buf(),
htaccess: htaccess::Config { enabled: true, ..Default::default() },
..Default::default()
};
config.validate().unwrap();
let service = config.compile().unwrap();
for path in ["/secret.env", "/", "/index.html"] {
let response = serve_request(&service, &request(Method::GET, path), path).await;
assert_eq!(response.status(), StatusCode::FORBIDDEN, "{path}");
}
let good = serve_request(&service, &request(Method::GET, "/public.txt"), "/public.txt").await;
assert_eq!(good.status(), StatusCode::OK);
}
#[tokio::test]
async fn htaccess_redirect_and_redirectmatch_are_applied_without_rewriteengine() {
let tmp = TempDir::new().unwrap();
std::fs::write(tmp.path().join(".htaccess"), r#"
Redirect permanent /old /new
RedirectMatch 302 ^/old-files/(.*)$ /archive/$1
ErrorDocument 404 /error.html
"#).unwrap();
let mut config = Service {
id: "redirects".into(),
name: "Redirects".into(),
document_root: tmp.path().to_path_buf(),
htaccess: htaccess::Config { enabled: true, strict: false, ..Default::default() },
..Default::default()
};
config.validate().unwrap();
let service = config.compile().unwrap();
let (_, warnings) = service.htaccess_diagnostics().unwrap();
assert_eq!(warnings.len(), 1); // ErrorDocument ignored in non-strict mode.
let redirect = serve_request(&service, &request(Method::GET, "/old/docs?a=1"), "/old/docs").await;
assert_eq!(redirect.status(), StatusCode::MOVED_PERMANENTLY);
assert_eq!(redirect.headers()[LOCATION], "/new/docs?a=1");
let regex = serve_request(&service, &request(Method::GET, "/old-files/file.txt"), "/old-files/file.txt").await;
assert_eq!(regex.status(), StatusCode::FOUND);
assert_eq!(regex.headers()[LOCATION], "/archive/file.txt");
}