Skip to content

Stateless three-way handshake and control channel improvements

Arne Schwabe openvpn-devel 1 version NAK

Status from this message: NACK, compile error.

Get series with b4
b4 am [email protected]...

Versions newest first

  1. v1 Latest28 patches 47 repliesNAK

Patches in v1

#Subject and filesSizeRepliesApplied
1/28Remove tls_init_control_channel_frame_parameters wrapper functionsrc/openvpn/init.c src/openvpn/ssl.c src/openvpn/ssl.h+6 -171 reply
2/28Remove dead PID_TEST codesrc/openvpn/init.c src/openvpn/packet_id.c src/openvpn/packet_id.h+0 -711 reply
3/28Move pre decrypt lite check to its own functionsrc/openvpn/mudp.c+15 -27 replies
4/28Add documentation for swap_hmac functionsrc/openvpn/ssl.c+18 -43 replies
5/28Extend tls_pre_decrypt_lite to return type of packet and keep statesrc/openvpn/mudp.c src/openvpn/ssl.c src/openvpn/ssl.h+99 -251 reply
6/28Move ssl function related to control channel wrap/unwrap to ssl_pkt.c/hsrc/openvpn/Makefile.am src/openvpn/mudp.c src/openvpn/openvpn.vcxproj +9 more+600 -5051 reply
7/28Add unit tests for test_tls_decrypt_litetests/unit_tests/openvpn/Makefile.am tests/unit_tests/openvpn/test_pkt.c+370 -11 reply
8/28Split out reliable_ack_parse from reliable_ack_readsrc/openvpn/reliable.c src/openvpn/reliable.h src/openvpn/ssl.c+56 -272 replies
9/28Remove inc_pid argument from reliable_mark_deleted that is always truesrc/openvpn/reliable.c src/openvpn/reliable.h src/openvpn/ssl.c+4 -71 reply
10/28Remove EXPONENTIAL_BACKOFF definesrc/openvpn/reliable.c src/openvpn/reliable.h+0 -71 reply
11/28Refactor tls-auth/tls-crypt wrapping into into own functionsrc/openvpn/ssl_pkt.c+50 -322 replies
12/28Extract session_move_pre_start as own function, use local buffer variablesrc/openvpn/ssl.c+50 -342 replies
13/28Change FULL_SYNC macro to no_pending_reliable_packets functionsrc/openvpn/ssl.c+57 -431 reply
14/28Move tls_process_state into its own functionsrc/openvpn/ssl.c+228 -2163 replies
15/28Remove pointless indentation from tls_process.src/openvpn/ssl.c+27 -292 replies
16/28Move CRL reload to key_state_init from S_START transitionsrc/openvpn/ssl.c+11 -124 replies
17/28Implement constructing a control channel reset client as standalone fucntionsrc/openvpn/packet_id.h src/openvpn/ssl.h src/openvpn/ssl_pkt.c +2 more+149 -92 replies
18/28Implement stateless, HMAC basedsesssion id three way handshakedoc/doxygen/doc_protocol_overview.h src/openvpn/init.c src/openvpn/mudp.c +8 more+542 -544 replies
19/28Make buf_write_u8/16/32 take the type they pretend to takesrc/openvpn/buffer.h+6 -72 replies
20/28Change reliable_get_buf_sequenced to reliable_get_entry_sequencedsrc/openvpn/reliable.c src/openvpn/reliable.h src/openvpn/ssl.c+10 -103 replies
21/28Extract read_incoming_tls_ciphertext into functionsrc/openvpn/ssl.c+33 -202 replies
22/28Implement HMAC based session id for tls-crypt v2Changes.rst doc/man-sections/tls-options.rst doc/tls-crypt-v2.txt +10 more+333 -4615 replies
23/28Optimise three-way handshake condition for S_PRE_START to S_STARTsrc/openvpn/ssl.c tests/unit_tests/openvpn/test_pkt.c+9 -142 replies
24/28Extract read_incoming_tls_plaintext into its own functionsrc/openvpn/ssl.c+23 -154 replies
25/28Ensure that control channel packet are respecting tls-mtusrc/openvpn/reliable.c src/openvpn/reliable.h src/openvpn/ssl.c +4 more+229 -714 replies
26/28Allow setting control channel packet size with tls-mtuChanges.rst doc/man-sections/link-options.rst src/openvpn/init.c +5 more+57 -196 replies
27/28Add unit test for reliable_get_num_output_sequenced_availabletests/unit_tests/openvpn/Makefile.am tests/unit_tests/openvpn/mock_get_random.c tests/unit_tests/openvpn/test_packet_id.c+69 -11 reply
28/28Always include ACKs for the last seen control packetssrc/openvpn/reliable.c src/openvpn/reliable.h src/openvpn/ssl.c +3 more+125 -91 reply

Reviews trailers per patch

23 of 28 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGert DoeringFrank LichtenheldAntonio Quartulli
SeriesA-b
1/28A-b
2/28A-b
3/28A-b
4/28A-b
5/28A-b
6/28A-b
7/28A-b
8/28A-b
9/28A-b
10/28A-b
11/28A-b
12/28A-b
13/28
14/28A-b
15/28A-b
16/28A-b
17/28
18/28A-b
19/28A-b
20/28A-b
21/28Ack-By
22/28A-b A-b A-b
23/28A-b
24/28A-b
25/28
26/28
27/28A-b
28/28A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [Openvpn-devel] [PATCH 00/28] Stateless three-way handshake and control channel improvements

OpenVPN currently has a bit of a weakness in its early three way handshake

A single client reset packet (first packet of the handshake) will
- trigger creating session on the server side leading to poential ressource exhaustian
- make the server respond with 3 answers trying to get an ACK for its answer making it a amplification

This patch series intends to solve this problem and since the patches revolve a lot around control channel behaviour, I discovered and fixed a number of other weaknesses in the control channel implementation:

- Implementing an HMAC based scheme to offer a stateless three way handshake for the server that avoids the previous mentioned problems.
- Restricting control channel packet size is now possible without breaking the protocol (--tls-mtu)
- Server and client will now always repeat previous ACKs to avoid the peer resending a packet if an ACK is gone missing. (Similar to what cumulative ACKs in other protocols achieve).

Arne Schwabe (28):
Remove tls_init_control_channel_frame_parameters wrapper function Remove dead PID_TEST code
Move pre decrypt lite check to its own function
Add documentation for swap_hmac function
Extend tls_pre_decrypt_lite to return type of packet and keep state Move ssl function related to control channel wrap/unwrap to

    ssl_pkt.c/h

Add unit tests for test_tls_decrypt_lite
Split out reliable_ack_parse from reliable_ack_read
Remove inc_pid argument from reliable_mark_deleted that is always true Remove EXPONENTIAL_BACKOFF define
Refactor tls-auth/tls-crypt wrapping into into own function Extract session_move_pre_start as own function, use local buffer
variable
Change FULL_SYNC macro to no_pending_reliable_packets function Move tls_process_state into its own function
Remove pointless indentation from tls_process.
Move CRL reload to key_state_init from S_START transition Implement constructing a control channel reset client as standalone
fucntion
Implement stateless, HMAC basedsesssion id three way handshake Make buf_write_u8/16/32 take the type they pretend to take Change reliable_get_buf_sequenced to reliable_get_entry_sequenced Extract read_incoming_tls_ciphertext into function Implement HMAC based session id for tls-crypt v2
Optimise three-way handshake condition for S_PRE_START to S_START Extract read_incoming_tls_plaintext into its own function Ensure that control channel packet are respecting tls-mtu Allow setting control channel packet size with tls-mtu
Add unit test for reliable_get_num_output_sequenced_available Always include ACKs for the last seen control packets

 Changes.rst                                |   16 +
 doc/doxygen/doc_protocol_overview.h        |    2 +
 doc/man-sections/link-options.rst          |    7 +
 doc/man-sections/tls-options.rst           |   14 +
 doc/tls-crypt-v2.txt                       |   41 +
 src/openvpn/Makefile.am                    |    1 +
 src/openvpn/buffer.h                       |   13 +-
 src/openvpn/crypto.h                       |    8 +
 src/openvpn/init.c                         |   28 +-
 src/openvpn/mtu.h                          |    5 +
 src/openvpn/mudp.c                         |  164 ++-
 src/openvpn/multi.h                        |    3 +
 src/openvpn/openvpn.h                      |    6 +
 src/openvpn/openvpn.vcxproj                |    2 +
 src/openvpn/openvpn.vcxproj.filters        |    3 +
 src/openvpn/options.c                      |   27 +
 src/openvpn/options.h                      |    4 +
 src/openvpn/packet_id.c                    |   56 -
 src/openvpn/packet_id.h                    |   25 +-
 src/openvpn/reliable.c                     |  209 +++-
 src/openvpn/reliable.h                     |   84 +-
 src/openvpn/ssl.c                          | 1312 ++++++++++----------
 src/openvpn/ssl.h                          |   97 +-
 src/openvpn/ssl_backend.h                  |    8 +-
 src/openvpn/ssl_common.h                   |    1 +
 src/openvpn/ssl_mbedtls.c                  |   19 +-
 src/openvpn/ssl_mbedtls.h                  |    4 +
 src/openvpn/ssl_openssl.c                  |   22 +-
 src/openvpn/ssl_openssl.h                  |    7 +
 src/openvpn/ssl_pkt.c                      |  549 ++++++++
 src/openvpn/ssl_pkt.h                      |  295 +++++
 tests/unit_tests/openvpn/Makefile.am       |   29 +-
 tests/unit_tests/openvpn/mock_get_random.c |   10 +
 tests/unit_tests/openvpn/test_packet_id.c  |   90 ++
 tests/unit_tests/openvpn/test_pkt.c        |  620 +++++++++
 35 files changed, 2825 insertions(+), 956 deletions(-)
 create mode 100644 src/openvpn/ssl_pkt.c
 create mode 100644 src/openvpn/ssl_pkt.h
 create mode 100644 tests/unit_tests/openvpn/test_pkt.c
Signature · 1 line
2.32.0 (Apple Git-132)