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

Set HAProxy Diffie-Hellman key size to 2048 #685

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

AJRepo
Copy link
Contributor

@AJRepo AJRepo commented Oct 18, 2020

Testing the haproxy.cfg file using the version of haproxy installed by OctoPi generates a warning.

HA-Proxy version on RasPi Buster is
HA-Proxy version 1.8.19-1+rpi1 2019/03/14

To test the config file by haproxy use the '-c' (check) flag as
sudo haproxy -c -f /etc/haproxy/haproxy.cfg
which generates the warning

   [WARNING] 291/152612 (2843) : Setting tune.ssl.default-dh-param to 1024 by default,
   if your workload permits it you should set it to at least 2048.
   Please set a value >= 1024 to make this warning disappear.

HA-Proxy Documentation for tune.ssl.default-dh-param feature states
Higher values increase CPU load and may not be supported by some clients (IE:Java 7).

This only affects SSL traffic. Non-encrypted traffic is unaffected.

Adding tune.ssl.default-hd-param XXXX to haproxy.cfg file gets rid of haproxy
warning message where XXXX can be any positive integer.

Tested with values both at 1024 (default) and 2048 (recommended)

Tested on a RasPi 3B with ab -n 20 -c 1 ... and also tested by firefox browser
by refreshing the home page at about 1 request per second. (e.g. a few people
impatiently reloading the OctoPrint pages repeatedly).

Load tests showed no measurable difference in user load (uptime)
between a value of 1024 and the recommend value 2048.

Tests using ab showed no measurable difference in response time or failure rate
between 1024 and 2048 (2048 was actually faster, but might have been due to caching).

HA-Proxy recommended value of 2048 does not measurably impact
performance vs the default of 1024.

HA-Proxy version on RasPi Buster is
    HA-Proxy version 1.8.19-1+rpi1 2019/03/14

Running a test of the config file
   sudo haproxy -c -f /etc/haproxy/haproxy.cfg
Generates the warning
```
   [WARNING] 291/152612 (2843) : Setting tune.ssl.default-dh-param to 1024 by default,
   if your workload permits it you should set it to at least 2048.
   Please set a value >= 1024 to make this warning disappear.
```

Documentation for this feature states that higher values might increase server load.
Higher values increase CPU load and may not be supported by some clients (IE:Java 7).

Tested with values both at 1024 and 2048

Assuming that the use-case for OctoPrint is usually one user at a time,
tested on a RasPi 3B with `ab -n 20 -c 1 ...` and also tested by firefox browser
by refreshing the home page at about 1 request per second.

Load tests showed no measureable difference in user load (uptime)
between a value of 1024 and the recommend value 2048.

Tests using `ab` showed no measurable difference in response time or failure rate
between 1024 and 2048 (2048 was actually faster, but might have been due to caching).

Adding `tune.ssl.default-hd-param 2048` to haproxy.cfg file gets rid of
warning message and does not measurably impact performance
@chudsaviet
Copy link
Contributor

I would set the commit message to 'Set HAProxy Diffie-Hellman key size to 2048.'

@guysoft guysoft changed the title Fix for 'haprocy -c -f haproxy.cfg' warning Set HAProxy Diffie-Hellman key size to 2048 Oct 26, 2020
@guysoft guysoft merged commit 6165470 into guysoft:devel Oct 26, 2020
@guysoft guysoft mentioned this pull request Nov 4, 2020
@guysoft guysoft mentioned this pull request Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants