Skip to contentSkip to conversation

Collections of miscellenaous patches

PATCH In review Arne Schwabe 3 participants 18 messages Feb 10, 2023 – Mar 22, 2023

lore
Share & tools
lore
#0 lore raw

cover Collections of miscellenaous patches

These are a few random patches that could have been sent as single patches to the list but I bundle them here to indicate their "low priority"/impact.

Arne Schwabe (4):
Combine extra_tun/frame parameter of frame_calculate_payload_overhead Update the last sections in the man page to a be a bit less outdated Revise the cipher negotiation about OpenVPN3 in the man page Reduce initialisation spam from verb <= 3 and print summary instead

 doc/man-sections/cipher-negotiation.rst |   5 +-
 doc/openvpn.8.rst                       |  11 +-
 src/openvpn/crypto.c                    |   4 +-
 src/openvpn/errlevel.h                  |   1 +
 src/openvpn/init.c                      | 143 +++++++++++++++++++++++-
 src/openvpn/mss.c                       |   2 +-
 src/openvpn/mtu.c                       |  14 +--
 src/openvpn/mtu.h                       |   6 +-
 src/openvpn/occ.c                       |   3 +-
 src/openvpn/occ.h                       |  16 +++
 src/openvpn/sig.c                       |  15 ---
 src/openvpn/ssl.c                       |   5 -
 src/openvpn/ssl_ncp.c                   |   2 +-
 13 files changed, 178 insertions(+), 49 deletions(-)
Signature · 1 line
2.37.1 (Apple Git-137.1)
#1 lore raw

PATCH 1/2 Add 'allow-compression stub-only and refuse framing with 'allow-compression no'

This changes the "no" setting of allow-compression to also refuse framing. This is important for our DCO implementation as these do not implement framing.

This behaviour surfaced when a commercial VPN provider was pushing "comp-lzo no" to a client with DCO. While we are technically at fault here for announcing comp-lzo no support by announcing IV_LZO_STUB=1, the VPN provider continues to push "comp-lzo no" even in absense of that flag.

As the new default we default to allow-compression stub-only if a stub option is found in the config and to allow-compression no otherwise. This ensures that we only enable DCO when no compression framing is used.

---
 Changes.rst                           |  5 +++
 doc/man-sections/protocol-options.rst |  3 ++
 src/openvpn/comp.c                    | 32 +++++++++--------
 src/openvpn/comp.h                    |  2 +-
 src/openvpn/dco.c                     |  4 +--
 src/openvpn/options.c                 | 50 +++++++++++++++++++++------
 6 files changed, 66 insertions(+), 30 deletions(-)
Changes.rst +5 -0
index c5335ce93..3a573cc9a 100644
@@ -223,6 +223,11 @@ User-visible Changes
   compatibility with older versions. See the manual page on the
   ``--compat-mode`` for details.
 
+- (OpenVPN 2.6.1) ``--allow-compression no`` has been changed to not allow
+  compression or compression framing at all now and is the new default.
+  Use ``--allow-compression stub-only`` for the old ``no`` behaviour of OpenVPN
+  2.5 and OpenVPN 2.6.0.
+
 Common errors with OpenSSL 3.0 and OpenVPN 2.6
 ----------------------------------------------
 Both OpenVPN 2.6 and OpenSSL 3.0 tighten the security considerable, so some
doc/man-sections/protocol-options.rst +3 -0
index 248f65cfd..76c323413 100644
@@ -25,6 +25,9 @@ configured in a compatible way between both the local and remote side.
       compression at the same time is not a feasible option.
 
   :code:`no`  (default)
+      OpenVPN will refuse any compression or compression framing (stub).
+
+  :code:`stub-only`
       OpenVPN will refuse any non-stub compression.
 
   :code:`yes`
src/openvpn/comp.c +17 -15
index 3b8d78996..c7ec6c7f5 100644
@@ -134,27 +134,29 @@ comp_print_stats(const struct compress_context *compctx, struct status_output *s
 void
 comp_generate_peer_info_string(const struct compress_options *opt, struct buffer *out)
 {
-    if (opt)
+    if (!opt || opt->flags & COMP_F_ALLOW_NOCOMP_ONLY)
+    {
+        return;
+    }
+
+    bool lzo_avail = false;
+    if (!(opt->flags & COMP_F_ADVERTISE_STUBS_ONLY))
     {
-        bool lzo_avail = false;
-        if (!(opt->flags & COMP_F_ADVERTISE_STUBS_ONLY))
-        {
 #if defined(ENABLE_LZ4)
-            buf_printf(out, "IV_LZ4=1\n");
-            buf_printf(out, "IV_LZ4v2=1\n");
+        buf_printf(out, "IV_LZ4=1\n");
+        buf_printf(out, "IV_LZ4v2=1\n");
 #endif
 #if defined(ENABLE_LZO)
-            buf_printf(out, "IV_LZO=1\n");
-            lzo_avail = true;
+        buf_printf(out, "IV_LZO=1\n");
+        lzo_avail = true;
 #endif
-        }
-        if (!lzo_avail)
-        {
-            buf_printf(out, "IV_LZO_STUB=1\n");
-        }
-        buf_printf(out, "IV_COMP_STUB=1\n");
-        buf_printf(out, "IV_COMP_STUBv2=1\n");
     }
+    if (!lzo_avail)
+    {
+        buf_printf(out, "IV_LZO_STUB=1\n");
+    }
+    buf_printf(out, "IV_COMP_STUB=1\n");
+    buf_printf(out, "IV_COMP_STUBv2=1\n");
 }
 
 #endif /* USE_COMP */
src/openvpn/comp.h +1 -1
index 685f40391..027fa0593 100644
@@ -60,7 +60,7 @@
                                             * we still accept other compressions to be pushed */
 #define COMP_F_MIGRATE              (1<<5) /* push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */
 #define COMP_F_ALLOW_ASYM           (1<<6) /* Compression was explicitly set to allow asymetric compression */
-
+#define COMP_F_ALLOW_NOCOMP_ONLY    (1<<7) /* Do not allow compression framing like stub v2 or comp-lzo no. Breaks DCO */
 
 /*
  * Length of prepended prefix on compressed packets
src/openvpn/dco.c +1 -3
index 3087a0df8..10337b964 100644
@@ -410,9 +410,7 @@ dco_check_option(int msglevel, const struct options *o)
     }
 
 #if defined(USE_COMP)
-    if (o->comp.alg != COMP_ALG_UNDEF
-        || o->comp.flags & COMP_F_ALLOW_ASYM
-        || o->comp.flags & COMP_F_ALLOW_COMPRESS)
+    if (o->comp.alg != COMP_ALG_UNDEF || !(o->comp.flags & COMP_F_ALLOW_NOCOMP_ONLY))
     {
         msg(msglevel, "Note: '--allow-compression' is not set to 'no', disabling data channel offload.");
 
src/openvpn/options.c +39 -11

99 lines not on this page · raw message

Signature · 1 line
2.37.1 (Apple Git-137.1)
#2 lore raw

PATCH v2 1/1 Add 'allow-compression stub-only and refuse framing with 'allow-compression no'

This changes the "no" setting of allow-compression to also refuse framing. This is important for our DCO implementation as these do not implement framing.

This behaviour surfaced when a commercial VPN provider was pushing "comp-lzo no" to a client with DCO. While we are technically at fault here for announcing comp-lzo no support by announcing IV_LZO_STUB=1, the VPN provider continues to push "comp-lzo no" even in absense of that flag.

As the new default we default to allow-compression stub-only if a stub option is found in the config and to allow-compression no otherwise. This ensures that we only enable DCO when no compression framing is used.

This will now also bail out if the server pushes a compression setting that we do not support as mismatching compression is almost never a working connection. In my lz4-v2 and lzo-v2 you might have a connection that works mostly but some packets will be dropped since they compressed which is not desirable either since it becomes very hard to debug.

Patch v2: bail out if server pushes an unsupported method. Also include this
bail out logic when OpenVPN is compiled without compression support.

Change-Id Ieefb501038b06c7520ed105c660a1c79887476f3
---
 Changes.rst                           |   6 ++
 doc/man-sections/protocol-options.rst |   3 +
 src/openvpn/comp.c                    |  32 +++---
 src/openvpn/comp.h                    |  44 ++++----
 src/openvpn/dco.c                     |   4 +-
 src/openvpn/init.c                    |  12 ++-
 src/openvpn/options.c                 | 150 ++++++++++++++++----------
 src/openvpn/options.h                 |   2 -
 8 files changed, 156 insertions(+), 97 deletions(-)
Changes.rst +6 -0
index dedb97ee4..17b4c4d04 100644
@@ -232,6 +232,12 @@ User-visible Changes
 - The ``client-pending-auth`` management command now requires also the
   key id. The management version has been changed to 5 to indicate this change.
 
+- (OpenVPN 2.6.2) ``--allow-compression no`` has been changed to not allow
+  compression or compression framing at all now and is the new default.
+  Use ``--allow-compression stub-only`` for the old ``no`` behaviour of OpenVPN
+  2.5 and OpenVPN 2.6.0.
+
+
 Common errors with OpenSSL 3.0 and OpenVPN 2.6
 ----------------------------------------------
 Both OpenVPN 2.6 and OpenSSL 3.0 tighten the security considerable, so some
doc/man-sections/protocol-options.rst +3 -0
index 248f65cfd..76c323413 100644
@@ -25,6 +25,9 @@ configured in a compatible way between both the local and remote side.
       compression at the same time is not a feasible option.
 
   :code:`no`  (default)
+      OpenVPN will refuse any compression or compression framing (stub).
+
+  :code:`stub-only`
       OpenVPN will refuse any non-stub compression.
 
   :code:`yes`
src/openvpn/comp.c +17 -15
index 3b8d78996..c7ec6c7f5 100644
@@ -134,27 +134,29 @@ comp_print_stats(const struct compress_context *compctx, struct status_output *s
 void
 comp_generate_peer_info_string(const struct compress_options *opt, struct buffer *out)
 {
-    if (opt)
+    if (!opt || opt->flags & COMP_F_ALLOW_NOCOMP_ONLY)
+    {
+        return;
+    }
+
+    bool lzo_avail = false;
+    if (!(opt->flags & COMP_F_ADVERTISE_STUBS_ONLY))
     {
-        bool lzo_avail = false;
-        if (!(opt->flags & COMP_F_ADVERTISE_STUBS_ONLY))
-        {
 #if defined(ENABLE_LZ4)
-            buf_printf(out, "IV_LZ4=1\n");
-            buf_printf(out, "IV_LZ4v2=1\n");
+        buf_printf(out, "IV_LZ4=1\n");
+        buf_printf(out, "IV_LZ4v2=1\n");
 #endif
 #if defined(ENABLE_LZO)
-            buf_printf(out, "IV_LZO=1\n");
-            lzo_avail = true;
+        buf_printf(out, "IV_LZO=1\n");
+        lzo_avail = true;
 #endif
-        }
-        if (!lzo_avail)
-        {
-            buf_printf(out, "IV_LZO_STUB=1\n");
-        }
-        buf_printf(out, "IV_COMP_STUB=1\n");
-        buf_printf(out, "IV_COMP_STUBv2=1\n");
     }
+    if (!lzo_avail)
+    {
+        buf_printf(out, "IV_LZO_STUB=1\n");
+    }
+    buf_printf(out, "IV_COMP_STUB=1\n");
+    buf_printf(out, "IV_COMP_STUBv2=1\n");
 }
 
 #endif /* USE_COMP */
src/openvpn/comp.h +23 -21

62 lines not on this page · raw message

src/openvpn/dco.c +1 -3
index 308578b47..c514bb143 100644
@@ -408,9 +408,7 @@ dco_check_option(int msglevel, const struct options *o)
     }
 
 #if defined(USE_COMP)
-    if (o->comp.alg != COMP_ALG_UNDEF
-        || o->comp.flags & COMP_F_ALLOW_ASYM
-        || o->comp.flags & COMP_F_ALLOW_COMPRESS)
+    if (o->comp.alg != COMP_ALG_UNDEF || !(o->comp.flags & COMP_F_ALLOW_NOCOMP_ONLY))
     {
         msg(msglevel, "Note: '--allow-compression' is not set to 'no', disabling data channel offload.");
 
src/openvpn/init.c +10 -2
index 3a6f624fd..2108efa90 100644
@@ -2634,14 +2634,22 @@ do_deferred_options(struct context *c, const unsigned int found)
         }
     }
 
-#ifdef USE_COMP
     if (found & OPT_P_COMP)
     {
+        if (c->options.comp.flags & COMP_F_INVALID_SETTING)
+        {
+            msg(D_PUSH_ERRORS, "OPTIONS ERROR: server pushed compression "
+                "settings that are not allowed and will result "
+                "in a non-working connection. "
+                "See also allow-compression in the manual.");
+            return false;
+        }
+#ifdef USE_COMP
         msg(D_PUSH_DEBUG, "OPTIONS IMPORT: compression parms modified");
         comp_uninit(c->c2.comp_context);
         c->c2.comp_context = comp_init(&c->options.comp);
-    }
 #endif
+    }
 
     if (found & OPT_P_SHAPER)
     {
src/openvpn/options.c +96 -54

223 lines not on this page · raw message

src/openvpn/options.h +0 -2
index 2f25f5d07..c56ef5e5e 100644
@@ -395,9 +395,7 @@ struct options
     /* optimize TUN/TAP/UDP writes */
     bool fast_io;
 
-#ifdef USE_COMP
     struct compress_options comp;
-#endif
 
     /* buffer sizes */
     int rcvbuf;
Signature · 1 line
2.37.1 (Apple Git-137.1)
#3 lore raw

PATCH 1/4 Combine extra_tun/frame parameter of frame_calculate_payload_overhead

In reply to Arne Schwabe

Instead of passing a value and a bool just pass the value and 0 if the caller does not want the value to be added. This also allows the function to be used by a function without a frame struct.

---
 src/openvpn/mss.c |  2 +-
 src/openvpn/mtu.c | 14 +++++---------
 src/openvpn/mtu.h |  6 +++---
 src/openvpn/occ.c |  3 +--
 4 files changed, 10 insertions(+), 15 deletions(-)
src/openvpn/mss.c +1 -1
index 429aa1e93..98d540688 100644
@@ -303,7 +303,7 @@ frame_calculate_mssfix(struct frame *frame, struct key_type *kt,
 
     /* Calculate the number of bytes that the payload differs from the payload
      * MTU. This are fragment/compression/ethernet headers */
-    payload_overhead = frame_calculate_payload_overhead(frame, options, kt, true);
+    payload_overhead = frame_calculate_payload_overhead(frame->extra_tun, options, kt);
 
     /* We are in a "liberal" position with respect to MSS,
      * i.e. we assume that MSS can be calculated from MTU
src/openvpn/mtu.c +5 -9
index 1d9ebe011..56ea67061 100644
@@ -108,20 +108,16 @@ frame_calculate_protocol_header_size(const struct key_type *kt,
 
 
 size_t
-frame_calculate_payload_overhead(const struct frame *frame,
+frame_calculate_payload_overhead(size_t extra_tun,
                                  const struct options *options,
-                                 const struct key_type *kt,
-                                 bool extra_tun)
+                                 const struct key_type *kt)
 {
     size_t overhead = 0;
 
     /* This is the overhead of tap device that is not included in the MTU itself
      * i.e. Ethernet header that we still need to transmit as part of the
-     * payload */
-    if (extra_tun)
-    {
-        overhead += frame->extra_tun;
-    }
+     * payload, this is set to 0 by caller if not applicable */
+    overhead += extra_tun;
 
 #if defined(USE_COMP)
     /* v1 Compression schemes add 1 byte header. V2 only adds a header when it
@@ -158,7 +154,7 @@ frame_calculate_payload_size(const struct frame *frame,
                              const struct key_type *kt)
 {
     size_t payload_size = options->ce.tun_mtu;
-    payload_size += frame_calculate_payload_overhead(frame, options, kt, true);
+    payload_size += frame_calculate_payload_overhead(frame->extra_tun, options, kt);
     return payload_size;
 }
 
src/openvpn/mtu.h +3 -3
index 0ff4f7bfa..21dbcee7f 100644
@@ -217,10 +217,10 @@ frame_calculate_payload_size(const struct frame *frame,
  * *  [IP][UDP][OPENVPN PROTOCOL HEADER][ **PAYLOAD incl compression header** ]
  */
 size_t
-frame_calculate_payload_overhead(const struct frame *frame,
+frame_calculate_payload_overhead(size_t extra_tun,
                                  const struct options *options,
-                                 const struct key_type *kt,
-                                 bool extra_tun);
+                                 const struct key_type *kt);
+
 
 /**
  * Calculates the size of the OpenVPN protocol header. This includes
src/openvpn/occ.c +1 -2
index 0fa803cdb..94b82e0f5 100644
@@ -305,8 +305,7 @@ check_send_occ_msg_dowork(struct context *c)
             const struct key_type *kt = &c->c1.ks.key_type;
 
             /* OCC message have comp/fragment headers but not ethernet headers */
-            payload_hdr = frame_calculate_payload_overhead(&c->c2.frame, &c->options,
-                                                           kt, false);
+            payload_hdr = frame_calculate_payload_overhead(0, &c->options, kt);
 
             /* Since we do not know the payload size we just pass 0 as size here */
             proto_hdr = frame_calculate_protocol_header_size(kt, &c->options, false);
Signature · 1 line
2.37.1 (Apple Git-137.1)
Acked-by on v1 1/4
#4 lore raw

Re: [Openvpn-devel] [PATCH 1/4] Combine extra_tun/frame parameter of frame_calculate_payload_overhead

Quoted 3 lines · Arne Schwabe

Instead of passing a value and a bool just pass the value and 0 if the caller does not want the value to be added. This also allows the function to be used by a function without a frame struct.

Makes sense to me.

Signature · 1 line
  Frank Lichtenheld
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: Combine extra_tun/frame parameter of frame_calculate_payload_overhead

In reply to Arne Schwabe

Indeed, makes sense :-)

Stared-at-code, smoke tested on GH actions to be sure.

Your patch has been applied to the master and release/2.6 branch.

commit e759c0ea6fe8679edf4d5208f2f0dc8cee5e948c (master) commit e1fac38c29e0d26eb3bd13812529721d9ba0591e (release/2.6)

Author: Arne Schwabe
Date:   Fri Feb 10 15:27:06 2023 +0100
     Combine extra_tun/frame parameter of frame_calculate_payload_overhead

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26223.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw

PATCH 1/1 Fix LibreSSL not building in Github Actions

In reply to Arne Schwabe

During the build of LibreSSL portable it pulls in a branch from OpenBSD upstream. Unfortunately they use master there instead of a fixed branch. So we work around this issue.

---
 .github/workflows/build.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
.github/workflows/build.yaml +8 -0
index 132624547..5888e91e5 100644
@@ -415,6 +415,14 @@ jobs:
           path: libressl
           repository: libressl-portable/portable
           ref: v3.7.0
+      # LibreSSL has master in the OPENBSD_BRANCH by default even in the tagged releases
+      # Manually use the OpenBSD branch that is more appropiate and remove git pull that
+      # breaks when checking out a tag instead of branch
+      - name: "libressl: fix build"
+        run: |
+           echo libressl-v3.7.0 > OPENBSD_BRANCH
+           sed -i -e 's/ git pull --rebase//' update.sh
+        working-directory: libressl
       - name: "libressl: autogen.sh"
         run: ./autogen.sh
         working-directory: libressl
Signature · 1 line
2.37.1 (Apple Git-137.1)
#7 lore raw

PATCH 2/2 Add debug output for sent IV variables in client mode with verb 7

In reply to Arne Schwabe

This helps debugging what information a client is sending without having to use a debugger or to look at the server log.

---
 src/openvpn/ssl.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
src/openvpn/ssl.c +19 -0
index 016bdc57f..1138dc4e7 100644
@@ -1970,6 +1970,20 @@ read_string_alloc(struct buffer *buf)
     return str;
 }
 
+static void
+print_client_peer_info(struct buffer *out, struct gc_arena *gc)
+{
+    struct buffer buf = alloc_buf_gc(buf_len(out), gc);
+    buf_copy(&buf, out);
+
+    char line[256];
+
+    while (buf_parse(&buf, '\n', line, sizeof(line)))
+    {
+        chomp(line);
+        msg(D_PUSH_DEBUG, "sending peer info: %s", line);
+    }
+}
 /**
  * Prepares the IV_ and UV_ variables that are part of the
  * exchange to signal the peer's capabilities. The amount
@@ -2119,6 +2133,11 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
             }
         }
 
+        if (check_debug_level(D_PUSH_DEBUG))
+        {
+            print_client_peer_info(&out, &gc);
+        }
+
         if (!write_string(buf, BSTR(&out), -1))
         {
             goto error;
Signature · 1 line
2.37.1 (Apple Git-137.1)
#8 lore raw

PATCH 2/4 Update the last sections in the man page to a be a bit less outdated

In reply to Arne Schwabe
---
 doc/openvpn.8.rst | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
doc/openvpn.8.rst +6 -5
index 995467478..415f210ce 100644
@@ -97,6 +97,8 @@ https://community.openvpn.net/openvpn/wiki/FAQ
 
 HOWTO
 =====
+The manual ``openvpn-examples``\(5) give some examples, especially for
+small setups.
 
 For a more comprehensive guide to setting up OpenVPN in a production
 setting, see the OpenVPN HOWTO at
@@ -107,18 +109,17 @@ https://openvpn.net/community-resources/how-to/
 PROTOCOL
 ========
 
-For a description of OpenVPN's underlying protocol, see
-https://openvpn.net/community-resources/openvpn-protocol/
-
+An ongoing effort to document the OpenVPN protocol can be found under
+https://github.com/openvpn/openvpn-rfc
 
 
 WEB
 ===
 
-OpenVPN's web site is at https://openvpn.net/
+OpenVPN's web site is at https://community.openvpn.net/
 
 Go here to download the latest version of OpenVPN, subscribe to the
-mailing lists, read the mailing list archives, or browse the SVN
+mailing lists, read the mailing list archives, or browse the Git
 repository.
 
 
Signature · 1 line
2.37.1 (Apple Git-137.1)
Acked-by on v1 2/4
#9 lore raw

Re: [Openvpn-devel] [PATCH 2/4] Update the last sections in the man page to a be a bit less outdated

Quoted 10 lines · Arne Schwabe
---
 doc/openvpn.8.rst | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
doc/openvpn.8.rst +0 -0
index 995467478..415f210ce 100644

doc/openvpn.8.rst https://community.openvpn.net/openvpn/wiki/FAQ · line 100

Quoted 4 lines
doc/openvpn.8.rst +1 -0
@@ -97,6 +97,8 @@ https://community.openvpn.net/openvpn/wiki/FAQ
 
 HOWTO
 =====
+The manual ``openvpn-examples``\(5) give some examples, especially for

"gives"

doc/openvpn.8.rst https://community.openvpn.net/openvpn/wiki/FAQ · line 101

Quoted 1 line
doc/openvpn.8.rst +1 -0
+small setups.

Other than that

Regards,

Signature · 1 line
  Frank Lichtenheld
#10 lore raw

[Openvpn-devel] [PATCH applied] Re: Update the last sections in the man page to a be a bit less outdated

In reply to Arne Schwabe

Nothing to test here :-) - "gives" fix applied as requested.

Your patch has been applied to the master and release/2.6 branch.

commit 48d27e29e68c6049872abbee38b1375522de249f (master) commit 8cbe09dc98824d992fde0ce1d4f218dd46e0bf2f (release/2.6)

Author: Arne Schwabe
Date:   Fri Feb 10 15:27:09 2023 +0100
     Update the last sections in the man page to a be a bit less outdated

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26224.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#11 lore raw

PATCH 3/4 Revise the cipher negotiation about OpenVPN3 in the man page

In reply to Arne Schwabe

Newer OpenVPN 3 core versions now allow limited configuration of ciphers:

    // Allow usage of legacy (cipher) algorithm that are no longer considered safe
    // This includes BF-CBC, single DES and RC2 private key encryption.
    // With OpenSSL 3.0 this also instructs OpenSSL to load the legacy provider.
    bool enableLegacyAlgorithms = false;

    // By default modern OpenVPN version (OpenVPN 2.6 and OpenVPN core 3.7) will only allow
    // preferred algorithms (AES-GCM, Chacha20-Poly1305) that also work with the newer DCO
    // implementations. If this is enabled, we fall back to allowing all algorithms (if these are
    // supported by the crypto library)
    bool enableNonPreferredDCAlgorithms = false;

Adjust the man page section accordingly but only really mention the AEAD ciphers to be always present and that they should be included in the data-ciphers option.

---
 doc/man-sections/cipher-negotiation.rst | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
doc/man-sections/cipher-negotiation.rst +3 -2
index b07176cd2..66afeb835 100644
@@ -42,8 +42,9 @@ options to avoid this behaviour.
 OpenVPN 3 clients
 -----------------
 Clients based on the OpenVPN 3.x library (https://github.com/openvpn/openvpn3/)
-do not have a configurable ``--ncp-ciphers`` or ``--data-ciphers`` option. Instead
-these clients will announce support for all their supported AEAD ciphers
+do not have a configurable ``--ncp-ciphers`` or ``--data-ciphers`` option. Newer
+version by default will disable legacy AES-CBC, BF-CBC, and, DES-CBC ciphers.
+These clients will always announce support for all their supported AEAD ciphers
 (`AES-256-GCM`, `AES-128-GCM` and in newer versions also `Chacha20-Poly1305`).
 
 To support OpenVPN 3.x based clients at least one of these ciphers needs to be
Signature · 1 line
2.37.1 (Apple Git-137.1)
#12 lore raw

Re: [Openvpn-devel] [PATCH 3/4] Revise the cipher negotiation about OpenVPN3 in the man page

Quoted 26 lines · Arne Schwabe

Newer OpenVPN 3 core versions now allow limited configuration of ciphers:

    // Allow usage of legacy (cipher) algorithm that are no longer considered safe
    // This includes BF-CBC, single DES and RC2 private key encryption.
    // With OpenSSL 3.0 this also instructs OpenSSL to load the legacy provider.
    bool enableLegacyAlgorithms = false;

    // By default modern OpenVPN version (OpenVPN 2.6 and OpenVPN core 3.7) will only allow
    // preferred algorithms (AES-GCM, Chacha20-Poly1305) that also work with the newer DCO
    // implementations. If this is enabled, we fall back to allowing all algorithms (if these are
    // supported by the crypto library)
    bool enableNonPreferredDCAlgorithms = false;

Adjust the man page section accordingly but only really mention the AEAD ciphers to be always present and that they should be included in the data-ciphers option.

---
 doc/man-sections/cipher-negotiation.rst | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
doc/man-sections/cipher-negotiation.rst +0 -0
index b07176cd2..66afeb835 100644

doc/man-sections/cipher-negotiation.rst options to avoid this behaviour. · line 46

Quoted 7 lines
doc/man-sections/cipher-negotiation.rst +2 -2
@@ -42,8 +42,9 @@ options to avoid this behaviour.
 OpenVPN 3 clients
 -----------------
 Clients based on the OpenVPN 3.x library (https://github.com/openvpn/openvpn3/)
-do not have a configurable ``--ncp-ciphers`` or ``--data-ciphers`` option. Instead
-these clients will announce support for all their supported AEAD ciphers
+do not have a configurable ``--ncp-ciphers`` or ``--data-ciphers`` option. Newer
+version by default will disable legacy AES-CBC, BF-CBC, and, DES-CBC ciphers.

"versions"
Remove comma in "and,"
Remove "will"

Quoted 4 lines
doc/man-sections/cipher-negotiation.rst +1 -0
+These clients will always announce support for all their supported AEAD ciphers
 (`AES-256-GCM`, `AES-128-GCM` and in newer versions also `Chacha20-Poly1305`).
 
 To support OpenVPN 3.x based clients at least one of these ciphers needs to be
Signature · 1 line
  Frank Lichtenheld
Acked-by on v1 3/4
#13 lore raw

[Openvpn-devel] [PATCH applied] Re: Revise the cipher negotiation about OpenVPN3 in the man page

In reply to Arne Schwabe

"Seems to make sense". Language fixes from Frank included.

Your patch has been applied to the master and release/2.6 branch.

commit 4da513d584b4e7521de5a47a95cc27fa8a342fd3 (master) commit cfbfb801e6432382edbbec758335d7c142707206 (release/2.6)

Author: Arne Schwabe
Date:   Fri Feb 10 15:27:10 2023 +0100
     Revise the cipher negotiation about OpenVPN3 in the man page

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26226.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#14 lore raw

PATCH 4/4 Reduce initialisation spam from verb <= 3 and print summary instead

In reply to Arne Schwabe

The messages about cipher initialisation are currently very noisy, especially if tls-auth/tls-crypt is in use.

Typically messages like this is display for AES-256-CBC with SHA256:

Outgoing Data Channel: Cipher 'AES-256-CBC' initialized with 256 bit key Outgoing Data Channel: Using 256 bit message hash 'SHA256' for HMAC authentication Incoming Data Channel: Cipher 'AES-256-CBC' initialized with 256 bit key Incoming Data Channel: Using 256 bit message hash 'SHA256' for HMAC authentication

in addition to the tls-crypt/tls-auth messages that has the amount of messages.

These message are not that helpful. The only meaningful information is better suited in compat messages. This commit moves the spammy messages to verb 4 and consistently prints out the cipher/auth used in the data channel instead on verb 2:

Data Channel: cipher 'AES-256-CBC' auth 'SHA256'

This patches also summarises other aspects of the imported options for VPN connection and prints them (even if not coming from pulled options):

Data Channel: cipher 'AES-256-GCM'
Timers: ping 8, ping-restart 40
Protocol options: explicit-exit-notify 1, protocol-flags tls-ekm

And move the OPTIONS IMPORT: xx modified that are included in the new messages to D_PUSH_DEBUG (verb 7) since they do not add any useful information anymore.

---
 src/openvpn/crypto.c   |   4 +-
 src/openvpn/errlevel.h |   1 +
 src/openvpn/init.c     | 143 +++++++++++++++++++++++++++++++++++++++--
 src/openvpn/occ.h      |  16 +++++
 src/openvpn/sig.c      |  15 -----
 src/openvpn/ssl.c      |   5 --
 src/openvpn/ssl_ncp.c  |   2 +-
 7 files changed, 159 insertions(+), 27 deletions(-)
src/openvpn/crypto.c +2 -2
index 073f47e47..5e1c495b0 100644
@@ -835,7 +835,7 @@ init_key_ctx(struct key_ctx *ctx, const struct key *key,
         cipher_ctx_init(ctx->cipher, key->cipher, kt->cipher, enc);
 
         const char *ciphername = cipher_kt_name(kt->cipher);
-        msg(D_HANDSHAKE, "%s: Cipher '%s' initialized with %d bit key",
+        msg(D_CIPHER_INIT, "%s: Cipher '%s' initialized with %d bit key",
             prefix, ciphername, cipher_kt_key_size(kt->cipher) * 8);
 
         dmsg(D_SHOW_KEYS, "%s: CIPHER KEY: %s", prefix,
@@ -850,7 +850,7 @@ init_key_ctx(struct key_ctx *ctx, const struct key *key,
         ctx->hmac = hmac_ctx_new();
         hmac_ctx_init(ctx->hmac, key->hmac, kt->digest);
 
-        msg(D_HANDSHAKE,
+        msg(D_CIPHER_INIT,
             "%s: Using %d bit message hash '%s' for HMAC authentication",
             prefix, md_kt_size(kt->digest) * 8, md_kt_name(kt->digest));
 
src/openvpn/errlevel.h +1 -0
index c69ea91d6..4699d1ac2 100644
@@ -105,6 +105,7 @@
 #define D_MTU_INFO           LOGLEV(4, 61, 0)        /* show terse MTU info */
 #define D_PID_DEBUG_LOW      LOGLEV(4, 63, 0)        /* show low-freq packet-id debugging info */
 #define D_PID_DEBUG_MEDIUM   LOGLEV(4, 64, 0)        /* show medium-freq packet-id debugging info */
+#define D_CIPHER_INIT        LOGLEV(4, 65, 0)        /* show messages about cipher init */
 
 #define D_LOG_RW             LOGLEV(5, 0,  0)        /* Print 'R' or 'W' to stdout for read/write */
 
src/openvpn/init.c +139 -4

179 lines not on this page · raw message

src/openvpn/occ.h +16 -0
index 4320bd119..e382482f6 100644
@@ -153,4 +153,20 @@ check_send_occ_msg(struct context *c)
     }
 }
 
+/**
+ * Small helper function to determine if we should send the exit notification
+ * via control channel.
+ * @return control channel exit message should be used */
+static inline bool
+cc_exit_notify_enabled(struct context *c)
+{
+    /* Check if we have TLS active at all */
+    if (!c->c2.tls_multi)
+    {
+        return false;
+    }
+
+    const struct key_state *ks = get_primary_key(c->c2.tls_multi);
+    return (ks->crypto_options.flags & CO_USE_CC_EXIT_NOTIFY);
+}
 #endif /* ifndef OCC_H */
src/openvpn/sig.c +0 -15
index 0d5346010..5b89bb42b 100644
@@ -342,21 +342,6 @@ print_status(const struct context *c, struct status_output *so)
 }
 
 
-/* Small helper function to determine if we should send the exit notification
- * via control channel */
-static inline bool
-cc_exit_notify_enabled(struct context *c)
-{
-    /* Check if we have TLS active at all */
-    if (!c->c2.tls_multi)
-    {
-        return false;
-    }
-
-    const struct key_state *ks = get_primary_key(c->c2.tls_multi);
-    return (ks->crypto_options.flags & CO_USE_CC_EXIT_NOTIFY);
-}
-
 /*
  * Handle the triggering and time-wait of explicit
  * exit notification.
src/openvpn/ssl.c +0 -5
index 016bdc57f..47f3702b2 100644
@@ -1730,11 +1730,6 @@ tls_session_update_crypto_params_do_work(struct tls_multi *multi,
         return true;
 
     }
-    if (strcmp(options->ciphername, session->opt->config_ciphername))
-    {
-        msg(D_HANDSHAKE, "Data Channel: using negotiated cipher '%s'",
-            options->ciphername);
-    }
 
     init_key_type(&session->opt->key_type, options->ciphername,
                   options->authname, true, true);
src/openvpn/ssl_ncp.c +1 -1
index fe6f6fa7c..97619be5e 100644
@@ -318,7 +318,7 @@ check_pull_client_ncp(struct context *c, const int found)
 {
     if (found & OPT_P_NCP)
     {
-        msg(D_PUSH, "OPTIONS IMPORT: data channel crypto options modified");
+        msg(D_PUSH_DEBUG, "OPTIONS IMPORT: data channel crypto options modified");
         return true;
     }
 
Signature · 1 line
2.37.1 (Apple Git-137.1)
#15 lore raw

PATCH v2 4/4 Reduce initialisation spam from verb <= 3 and print summary instead

The messages about cipher initialisation are currently very noisy, especially if tls-auth/tls-crypt is in use.

Typically messages like this is display for AES-256-CBC with SHA256:

Outgoing Data Channel: Cipher 'AES-256-CBC' initialized with 256 bit key Outgoing Data Channel: Using 256 bit message hash 'SHA256' for HMAC authentication Incoming Data Channel: Cipher 'AES-256-CBC' initialized with 256 bit key Incoming Data Channel: Using 256 bit message hash 'SHA256' for HMAC authentication

in addition to the tls-crypt/tls-auth messages that has the amount of messages.

These message are not that helpful. The only meaningful information is better suited in compat messages. This commit moves the spammy messages to verb 4 and consistently prints out the cipher/auth used in the data channel instead on verb 2:

Data Channel: cipher 'AES-256-CBC' auth 'SHA256'

This patches also summarises other aspects of the imported options for VPN connection and prints them (even if not coming from pulled options):

Data Channel: cipher 'AES-256-GCM'
Timers: ping 8, ping-restart 40
Protocol options: explicit-exit-notify 1, protocol-flags tls-ekm

And move the OPTIONS IMPORT: xx modified that are included in the new messages to D_PUSH_DEBUG (verb 7) since they do not add any useful information anymore.

Patch v2: also compile with compression disabled

---
 src/openvpn/crypto.c   |   4 +-
 src/openvpn/errlevel.h |   1 +
 src/openvpn/init.c     | 145 +++++++++++++++++++++++++++++++++++++++--
 src/openvpn/occ.h      |  16 +++++
 src/openvpn/sig.c      |  15 -----
 src/openvpn/ssl.c      |   5 --
 src/openvpn/ssl_ncp.c  |   2 +-
 7 files changed, 161 insertions(+), 27 deletions(-)
src/openvpn/crypto.c +2 -2
index 073f47e47..5e1c495b0 100644
@@ -835,7 +835,7 @@ init_key_ctx(struct key_ctx *ctx, const struct key *key,
         cipher_ctx_init(ctx->cipher, key->cipher, kt->cipher, enc);
 
         const char *ciphername = cipher_kt_name(kt->cipher);
-        msg(D_HANDSHAKE, "%s: Cipher '%s' initialized with %d bit key",
+        msg(D_CIPHER_INIT, "%s: Cipher '%s' initialized with %d bit key",
             prefix, ciphername, cipher_kt_key_size(kt->cipher) * 8);
 
         dmsg(D_SHOW_KEYS, "%s: CIPHER KEY: %s", prefix,
@@ -850,7 +850,7 @@ init_key_ctx(struct key_ctx *ctx, const struct key *key,
         ctx->hmac = hmac_ctx_new();
         hmac_ctx_init(ctx->hmac, key->hmac, kt->digest);
 
-        msg(D_HANDSHAKE,
+        msg(D_CIPHER_INIT,
             "%s: Using %d bit message hash '%s' for HMAC authentication",
             prefix, md_kt_size(kt->digest) * 8, md_kt_name(kt->digest));
 
src/openvpn/errlevel.h +1 -0
index c69ea91d6..4699d1ac2 100644
@@ -105,6 +105,7 @@
 #define D_MTU_INFO           LOGLEV(4, 61, 0)        /* show terse MTU info */
 #define D_PID_DEBUG_LOW      LOGLEV(4, 63, 0)        /* show low-freq packet-id debugging info */
 #define D_PID_DEBUG_MEDIUM   LOGLEV(4, 64, 0)        /* show medium-freq packet-id debugging info */
+#define D_CIPHER_INIT        LOGLEV(4, 65, 0)        /* show messages about cipher init */
 
 #define D_LOG_RW             LOGLEV(5, 0,  0)        /* Print 'R' or 'W' to stdout for read/write */
 
src/openvpn/init.c +141 -4

181 lines not on this page · raw message

src/openvpn/occ.h +16 -0
index 4320bd119..e382482f6 100644
@@ -153,4 +153,20 @@ check_send_occ_msg(struct context *c)
     }
 }
 
+/**
+ * Small helper function to determine if we should send the exit notification
+ * via control channel.
+ * @return control channel exit message should be used */
+static inline bool
+cc_exit_notify_enabled(struct context *c)
+{
+    /* Check if we have TLS active at all */
+    if (!c->c2.tls_multi)
+    {
+        return false;
+    }
+
+    const struct key_state *ks = get_primary_key(c->c2.tls_multi);
+    return (ks->crypto_options.flags & CO_USE_CC_EXIT_NOTIFY);
+}
 #endif /* ifndef OCC_H */
src/openvpn/sig.c +0 -15
index 0d5346010..5b89bb42b 100644
@@ -342,21 +342,6 @@ print_status(const struct context *c, struct status_output *so)
 }
 
 
-/* Small helper function to determine if we should send the exit notification
- * via control channel */
-static inline bool
-cc_exit_notify_enabled(struct context *c)
-{
-    /* Check if we have TLS active at all */
-    if (!c->c2.tls_multi)
-    {
-        return false;
-    }
-
-    const struct key_state *ks = get_primary_key(c->c2.tls_multi);
-    return (ks->crypto_options.flags & CO_USE_CC_EXIT_NOTIFY);
-}
-
 /*
  * Handle the triggering and time-wait of explicit
  * exit notification.
src/openvpn/ssl.c +0 -5
index 016bdc57f..47f3702b2 100644
@@ -1730,11 +1730,6 @@ tls_session_update_crypto_params_do_work(struct tls_multi *multi,
         return true;
 
     }
-    if (strcmp(options->ciphername, session->opt->config_ciphername))
-    {
-        msg(D_HANDSHAKE, "Data Channel: using negotiated cipher '%s'",
-            options->ciphername);
-    }
 
     init_key_type(&session->opt->key_type, options->ciphername,
                   options->authname, true, true);
src/openvpn/ssl_ncp.c +1 -1
index fe6f6fa7c..97619be5e 100644
@@ -318,7 +318,7 @@ check_pull_client_ncp(struct context *c, const int found)
 {
     if (found & OPT_P_NCP)
     {
-        msg(D_PUSH, "OPTIONS IMPORT: data channel crypto options modified");
+        msg(D_PUSH_DEBUG, "OPTIONS IMPORT: data channel crypto options modified");
         return true;
     }
 
Signature · 1 line
2.37.1 (Apple Git-137.1)
Acked-by on v2 4/4
#16 lore raw

[Openvpn-devel] [PATCH applied] Re: Reduce initialisation spam from verb <= 3 and print summary instead

This is a useful change.

I have stared a bit at the code, and it does what it wants to achieve.

I do not exactly like the "add_delim_if_non_empty()" approach, but this seems to be an ever-recurring topic ("how to build a string with lots of optional parts and delimiters in between") which is ugly even in language with good string support...

Not sure why the patch moves cc_exit_notify_enabled() to occ.h, as it's still only called from sig.c - but "static inline in .h" is our usual convention.

I have very unscientifically connected to a few destinations with verb 3 / verb 4 and compared the results (yep, nice, and all the details are still there if you really want them) and pushed to GH and buildbot for "will it break $randomthing?". Does not break any compile variants.

Your patch has been applied to the master and release/2.6 branch.

commit c333a0c05f9d454efb38fc04c1dca1413bfc48ff (master) commit 7538557108f6add04f835eb161cb0a33610c6b14 (release/2.6)

Author: Arne Schwabe
Date:   Tue Feb 14 12:20:44 2023 +0100
     Reduce initialisation spam from verb <= 3 and print summary instead

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26249.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#17 lore raw

PATCH v2 5/5 Add building unit tests with mingw to github actions

In reply to Arne Schwabe

This runs each test in its own action since order of stderr and stdout is seemingly random in github action Windows output and this way at least tests outputs are groups gy test

Patch v2: use -static-libgcc to avoid comping gcc runtime libraries.

---
 .github/workflows/build.yaml | 111 ++++++++++++++++++++++++++++++++++-
 1 file changed, 109 insertions(+), 2 deletions(-)
.github/workflows/build.yaml +109 -2
index 5888e91e5..a1026fddb 100644
@@ -55,9 +55,10 @@ jobs:
       PKCS11_HELPER_VERSION: "1.29.0"
       OPENSSL_VERSION: "${{ matrix.osslver }}"
       TAP_WINDOWS_VERSION: "9.23.3"
+      CMOCKA_VERSION: "1.1.5"
     steps:
       - name: Install dependencies
-        run: sudo apt update && sudo apt install -y mingw-w64 libtool automake autoconf man2html unzip
+        run: sudo apt update && sudo apt install -y mingw-w64 libtool automake autoconf man2html unzip cmake ninja-build build-essential wget
       - name: Checkout OpenVPN
         uses: actions/[email protected]...
         with:
@@ -72,7 +73,7 @@ jobs:
         uses: actions/[email protected]...
         with:
           path: '~/mingw/'
-          key: ${{ matrix.target }}-mingw-${{ matrix.osslver }}-${{ env.LZO_VERSION }}-${{ env.PKCS11_HELPER_VERSION }}-${{ env.TAP_WINDOWS_VERSION }}
+          key: ${{ matrix.target }}-mingw-${{ matrix.osslver }}-${{ env.LZO_VERSION }}-${{ env.PKCS11_HELPER_VERSION }}-${{ env.TAP_WINDOWS_VERSION }}--${{ env.CMOCKA_VERSION }}
 
       # Repeating  if: steps.cache.outputs.cache-hit != 'true'
       # on every step for building dependencies is ugly but
@@ -84,12 +85,33 @@ jobs:
           wget -c -P download-cache/ "https://build.openvpn.net/downloads/releases/tap-windows-${TAP_WINDOWS_VERSION}.zip"
           wget -c -P download-cache/ "https://www.oberhumer.com/opensource/lzo/download/lzo-${LZO_VERSION}.tar.gz"
           wget -c -P download-cache/ "https://github.com/OpenSC/pkcs11-helper/releases/download/pkcs11-helper-${PKCS11_HELPER_VERSION}/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.bz2"
+          wget -c -P download-cache/ "https://github.com/coreboot/cmocka/archive/refs/tags/cmocka-${CMOCKA_VERSION}.tar.gz"
           tar jxf "download-cache/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.bz2"
           wget -c -P download-cache/ "https://www.openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz" || wget -c -P download-cache/ "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
           tar zxf "download-cache/openssl-${OPENSSL_VERSION}.tar.gz"
           tar zxf "download-cache/lzo-${LZO_VERSION}.tar.gz"
+          tar zxf "download-cache/cmocka-${CMOCKA_VERSION}.tar.gz"
           unzip download-cache/tap-windows-${TAP_WINDOWS_VERSION}.zip
 
+      - name: create cmocka build directory
+        if: steps.cache.outputs.cache-hit != 'true'
+        run: mkdir cmocka-build
+
+      - name: configure cmocka
+        if: steps.cache.outputs.cache-hit != 'true'
+        working-directory: "./cmocka-build"
+        run: cmake -GNinja -DCMAKE_C_COMPILER=${{ matrix.chost }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.chost }}-g++ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SHARED_LINKER_FLAGS=-static-libgcc -DCMAKE_PREFIX_PATH=${HOME}/mingw/opt/lib/pkgconfig/ -DCMAKE_INCLUDE_PATH=${HOME}/mingw/opt/lib/include -DCMAKE_LIBRARY_PATH=${HOME}/mingw/opt/lib -DCMAKE_INSTALL_PREFIX=${HOME}/mingw/opt/ ../cmocka-cmocka-${{ env.CMOCKA_VERSION }}
+
+      - name: build cmocka
+        if: steps.cache.outputs.cache-hit != 'true'
+        working-directory: "./cmocka-build"
+        run: ninja
+
+      - name: install cmocka
+        if: steps.cache.outputs.cache-hit != 'true'
+        working-directory: "./cmocka-build"
+        run: ninja install
+
       - name: Configure OpenSSL
         if: steps.cache.outputs.cache-hit != 'true'
         run: ./Configure --cross-compile-prefix=${{ matrix.chost }}- shared ${{ matrix.target }} no-capieng --prefix="${HOME}/mingw/opt" --openssldir="${HOME}/mingw/opt" -static-libgcc
@@ -154,6 +176,90 @@ jobs:
       - name: build OpenVPN
         run: make -j3
         working-directory: openvpn
+      - name: build OpenVPN unittests
+        run: make -j3 check
+        working-directory: openvpn
+
+      # We use multiple upload-artifact here, so it becomes a flat folder
+      # structure since we need the dlls on the same level as the binaries
+      - name: Archive cmocka/openssl/lzo dlls
+        uses: actions/[email protected]...
+        with:
+          retention-days: 1
+          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-dlls
+          path: '~/mingw/opt/bin/*.dll'
+
+      # libtool puts some wrapper binaries in openvpn/tests/unit_tests/openvpn/
+      # and the real binaries in openvpn/tests/unit_tests/openvpn/.libs/
+      - name: Archive unittest artifacts
+        uses: actions/[email protected]...
+        with:
+          retention-days: 1
+          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-tests
+          path: openvpn/tests/unit_tests/openvpn/.libs/*.exe
+
+      # Currently not used by the unit test but might in the future and also
+      # helpful if manually downloading and running openvpn.exe from a mingw
+      # build
+      - name: Archive openvpn binary
+        uses: actions/[email protected]...
+        with:
+          retention-days: 1
+          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-tests
+          path: openvpn/src/openvpn/.libs/*.exe
+
+  mingw-unittest:
+    needs: [ mingw ]
+    strategy:
+      fail-fast: false
+      matrix:
+        osslver: [ 1.1.1q, 3.0.5 ]
+        target: [ mingw64, mingw ]
+
+    runs-on: windows-latest
+    name: "mingw unittests - ${{matrix.target}} - OSSL ${{ matrix.osslver }}"
+    steps:
+      - name: Retrieve mingw unittest dlls
+        uses: actions/[email protected]...
+        with:
+          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-dlls
+          path: unittests
+
+      - name: Retrieve mingw unittest
+        uses: actions/[email protected]...
+        with:
+          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-tests
+          path: unittests
+
+      - name: List unittests directory
+        run: "dir unittests"
+
+      - name: Run argvunit test
+        run: ./unittests/argv_testdriver.exe
+
+      - name: Run auth_tokenunit test
+        run: ./unittests/auth_token_testdriver.exe
+
+      - name: Run bufferunit test
+        run: ./unittests/buffer_testdriver.exe
+
+      - name: Run cryptounit test
+        run: ./unittests/crypto_testdriver.exe
+
+      - name: Run miscunit test
+        run: ./unittests/misc_testdriver.exe
+
+      - name: Run ncpunit test
+        run: ./unittests/ncp_testdriver.exe
+
+      - name: Run packet idunit test
+        run: ./unittests/packet_id_testdriver.exe
+
+      - name: Run pktunit test
+        run: ./unittests/pkt_testdriver.exe
+
+      - name: Run providerunit test
+        run: ./unittests/provider_testdriver.exe
 
   ubuntu:
     strategy:
@@ -450,3 +556,4 @@ jobs:
         run: make -j3
       - name: make check
         run: make check
+
Signature · 1 line
2.37.1 (Apple Git-137.1)