Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add even more features #1855

Merged
merged 2 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[#1421] Add support for multiple listening ports in server-stream con…
…figuration
  • Loading branch information
TheophileDiot committed Jan 1, 2025
commit f0021701c0154008ae136e30068d9e91c1b248d5
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [FEATURE] Add configurable limit for SecRequestBodyNoFilesLimit in ModSecurity via the `MODSECURITY_REQ_BODY_NO_FILES_LIMIT` setting
- [FEATURE] Add multi-user support in `Auth basic` plugin
- [FEATURE] Add support for TCP toggle listening in server-stream configuration (now UDP doesn't replace TCP when activated)
- [FEATURE] Made `LISTEN_STREAM_PORT` and `LISTEN_STREAM_PORT_SSL` settings multiples to allow listening on multiple ports
- [DEPRECATION] Remove `X-XSS-Protection` header from the `header` plugin as it is deprecated
- [DEPS] Updated coreruleset-v4 version to v4.10.0

Expand Down
30 changes: 15 additions & 15 deletions src/common/confs/server-stream/server-stream.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ server {
server_name '{{ SERVER_NAME.split(" ")[0] }}';

# listen
{% if LISTEN_STREAM == "yes" +%}
{% if USE_TCP == "yes" %}
listen 0.0.0.0:{{ LISTEN_STREAM_PORT }} reuseport{% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol {% endif %};
{% endif %}
{% if USE_UDP == "yes" %}
listen 0.0.0.0:{{ LISTEN_STREAM_PORT }} udp reuseport{% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol {% endif %};
{% endif %}
{% endif %}
{% if USE_IPV6 == "yes" +%}
{% if USE_TCP == "yes" %}
listen [::]:{{ LISTEN_STREAM_PORT }} reuseport{% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol {% endif %};
{% endif %}
{% if USE_UDP == "yes" %}
listen [::]:{{ LISTEN_STREAM_PORT }} udp reuseport{% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol {% endif %};
{% endif %}
{% if LISTEN_STREAM == "yes" %}
{%- set protocols = [] %}
{%- if USE_TCP == "yes" %}{% if protocols.append("tcp") %}{% endif %}{% endif %}
{%- if USE_UDP == "yes" %}{% if protocols.append("udp") %}{% endif %}{% endif %}

{%- for k, listen_stream_port in all.items() if k.startswith("LISTEN_STREAM_PORT") and not k.startswith("LISTEN_STREAM_PORT_SSL") %}
{% for proto in protocols %}
{% set udp_directive = " udp" if proto == "udp" else "" %}
{% set proxy_directive = " proxy_protocol" if USE_PROXY_PROTOCOL == "yes" else "" %}
listen 0.0.0.0:{{ listen_stream_port }}{{ udp_directive }} reuseport{{ proxy_directive }};
{% if USE_IPV6 == "yes" %}
listen [::]:{{ listen_stream_port }}{{ udp_directive }} reuseport{{ proxy_directive }};
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}

# custom config
Expand Down
10 changes: 7 additions & 3 deletions src/common/confs/server-stream/ssl-certificate-stream-lua.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ ssl_dhparam /etc/nginx/dhparam;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
{% endif %}

listen 0.0.0.0:{{ LISTEN_STREAM_PORT_SSL }} ssl {% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol {% endif %};
{% if USE_IPV6 == "yes" +%}
listen [::]:{{ LISTEN_STREAM_PORT_SSL }} ssl {% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol {% endif %};
{% if LISTEN_STREAM == "yes" %}
{% for k, port in all.items() if k.startswith("LISTEN_STREAM_PORT_SSL") %}
listen 0.0.0.0:{{ port }} ssl{% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol{% endif %};
{% if USE_IPV6 == "yes" %}
listen [::]:{{ port }} ssl{% if USE_PROXY_PROTOCOL == "yes" %} proxy_protocol{% endif %};
{% endif %}
{% endfor %}
{% endif %}

ssl_certificate_by_lua_block {
Expand Down
6 changes: 4 additions & 2 deletions src/common/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@
"id": "listen-stream-port",
"label": "Listen stream port",
"regex": "^[0-9]+$",
"type": "text"
"type": "text",
"multiple": "listen-stream-ports"
},
"LISTEN_STREAM_PORT_SSL": {
"context": "multisite",
Expand All @@ -278,7 +279,8 @@
"id": "listen-stream-port-ssl",
"label": "Listen stream port ssl",
"regex": "^[0-9]+$",
"type": "text"
"type": "text",
"multiple": "listen-stream-ports-ssl"
},
"USE_TCP": {
"context": "multisite",
Expand Down
Loading