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

haproxy: prefer ssl-min-ver with haproxy 2.2+ #275

Merged
merged 2 commits into from
Nov 24, 2024

Conversation

gstrauss
Copy link
Collaborator

haproxy: prefer ssl-min-ver with haproxy 2.2+

closes: #152
closes: #206

x-ref:
  "HA-Proxy no-sslv3/no-tlsv1x are ignored"
  mozilla#152
  "Config for old client (TLS 1.0 / 1.1) won't work, for (at least) HAProxy 2.4."
  mozilla#206

github: closes mozilla#152
github: closes mozilla#206
@gstrauss
Copy link
Collaborator Author

Interesting to note that when testing "Old" config (using 1024-bit generated dhparam for ssl-dh-param-file) with my 2048-bit RSA certificate in /path/to/example.pem, HAProxy 3.0.5 issued WARNING:

[NOTICE]   (411938) : haproxy version is 3.0.5-8e879a5
[WARNING]  (411938) : config : parsing [/dev/shm/haproxy.cfg:38] : 'bind :443' in section 'frontend' : 
  unable to use the global DH parameter for certificate '/path/to/example.pem', DH ciphers won't be available.

@gstrauss gstrauss merged commit efe8567 into mozilla:master Nov 24, 2024
3 checks passed
@janbrasna
Copy link
Collaborator

Interesting to note that when testing "Old" config (using 1024-bit generated dhparam […] HAProxy 3.0.5 issued WARNING: […] unable to use the global DH parameter for certificate '/path/to/example.pem', DH ciphers won't be available.

That's the ordering issue haproxy/haproxy#2468 I've been mentioning in OpenSSL 3 compatibility PR, so here you can see it IRL. They set @SECLEVEL for protocols and ciphers to work, but way after initing the DH values. They introduced http://docs.haproxy.org/dev/configuration.html#ssl-security-level workaround for it.

@gstrauss
Copy link
Collaborator Author

gstrauss commented Nov 28, 2024

The following might be a workaround. I'll test this later today. Have to run out ATM. (Aside: this is ugly in Handlebars and why regular javascript is as-good-as or better than the templating for this type of complex logic.)

 {{#if output.usesDhe}}
 
     {{#if (minver "1.6.0" form.serverVersion)}}
     # {{output.dhCommand}} > /path/to/dhparam
+    {{#if (eq output.dhParamSize 1024)}}
+    {{#if (minver "3.0.0" form.opensslVersion)}}
+    {{#if (minver "3.0.0" form.serverVersion)}}
+    {{#if (includes "TLSv1" output.protocols)}}
+    ssl-security-level 0
+    {{else}}
+    ssl-security-level 1
+    {{/if}}
+    {{/if}}
+    {{/if}}
+    {{/if}}
     ssl-dh-param-file /path/to/dhparam
     {{else}}
     tune.ssl.default-dh-param 2048
     {{/if}}
 {{/if}}

... And Mozilla security can't update the guidelines soon enough. When that (eventually) happens, the update will likely make dhParamSize 2048 and obviate the need for this kludge.

@gstrauss
Copy link
Collaborator Author

The above (edited) patch works after some minor tweaks. I'll merge a PR shortly with the additional splat for low-security configurations using outdated Mozilla guidelines now over 4 years old.

gstrauss added a commit to gstrauss/ssl-config-generator that referenced this pull request Nov 28, 2024
@gstrauss gstrauss deleted the haproxy-ssl-min-ver branch November 28, 2024 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants