]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Add connect-freq-initial option to limit initial connection responses
authorArne Schwabe <arne@rfc2549.org>
Tue, 10 Jan 2023 01:59:01 +0000 (02:59 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 10 Jan 2023 07:05:13 +0000 (08:05 +0100)
commit93d8d92319816a36f53ef8772bd6705f6abc2df9
tree8527366ae3b4f4346c33e3d3cce0ccaba7072e65
parentd9906d1523a8ed46fce81cb8d559279e345bf849
Add connect-freq-initial option to limit initial connection responses

This limits the number of packets OpenVPN will respond to. This avoids
OpenVPN servers being abused for refelection attacks in a large scale
as we gotten a lot more efficient with the cookie approach in our
initial connection handling.

The defaults of 100 attempts per 10s should work for most people,
esepcially since completed three way handshakes are not counted. So
the default will throttle connection attempts on server with high packet
loss or that are actually under a DOS.

The 100 per 10s are similar in size to the old 2.5 and earlier behaviour
where every initial connection attempt would take up a slot of the
max-clients sessions and those would only expire after the TLS timeout.
This roughly translates to 1024 connection attempts in 60s on an
empty server.

OpenVPN will announce once per period when starting to drop packets and
ultimatively how many packets it dropped:

    Connection Attempt Note: --connect-freq-initial 100 10 rate limit
    exceeded, dropping initial handshake packets for the next 10 seconds

    Connection Attempt Dropped 217 initial handshake packets due to
    --connect-freq-initial 100 10

to inform an admin about the consequences of this feature.

Patch v2: use strtol instead of atoi to be able to differentiate between
          an error parsing and parsing 0. Use int64_t instead int to
          avoid overflow errors.

Patch v3: Add message when we start dropping. Add a few fixes to the logic.
          improve docs

Patch v4: missing missing return statement.
Patch v5: add build files for msvc build

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20230110015901.933522-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25938.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit b520c68c67b6e52cd71b16675f1c436abf18d4dc)
Changes.rst
doc/man-sections/server-options.rst
src/openvpn/Makefile.am
src/openvpn/mudp.c
src/openvpn/multi.c
src/openvpn/multi.h
src/openvpn/openvpn.vcxproj
src/openvpn/options.c
src/openvpn/options.h
src/openvpn/reflect_filter.c [new file with mode: 0644]
src/openvpn/reflect_filter.h [new file with mode: 0644]