]> 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:04:05 +0000 (08:04 +0100)
commitb520c68c67b6e52cd71b16675f1c436abf18d4dc
treeb03fe03246675c5195c106e08f6a339bacea9920
parent16d7f2cd4d904274580b2f031e92dde2f7f260c9
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>
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]