[Openvpn-devel] Error out if both remap-usr1 SIGHUP and config stdin are used

Message ID 20220722130224.2442759-1-arne@rfc2549.org
State Accepted
Headers show
Series [Openvpn-devel] Error out if both remap-usr1 SIGHUP and config stdin are used | expand

Commit Message

Arne Schwabe July 22, 2022, 3:02 a.m. UTC
OpenVPN for Android uses config stdin to avoid writing the config
file containing private keys to 'disk'. However using stdin means
that config cannot be reread using SIGHUP. While there might be other
corner cases that trigger SIGHUP, this is an obvious one, so we
error out if we detect this misconfiguration.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/options.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Gert Doering July 22, 2022, 3:12 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

All bugs fixed, SOB added, v2 implied!  Does what it says on the lid...

$ openvpn --config stdin --remap-usr1 SIGHUP --dev null
<ctrl-d>
Options error: Options 'config stdin' and 'remap-usr1 SIGHUP' are incompatible with each other.

Your patch has been applied to the master branch.

commit 4df50030fb7ef8b36fa7a6ef451603263c760f11
Author: Arne Schwabe
Date:   Fri Jul 22 15:02:24 2022 +0200

     Error out if both remap-usr1 SIGHUP and config stdin are used

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220722130224.2442759-1-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24720.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index abda8c379..b9de2e5d0 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -3680,6 +3680,12 @@  options_postprocess_mutate(struct options *o, struct env_set *es)
         o->verify_hash_no_ca = true;
     }
 
+    if (streq(o->config, "stdin") && o->remap_sigusr1 == SIGHUP)
+    {
+        msg(M_USAGE, "Options 'config stdin' and 'remap-usr1 SIGHUP' are "
+            "incompatible with each other.");
+    }
+
     /* check if any option should force disabling DCO */
 #if defined(TARGET_LINUX)
     o->tuntap_options.disable_dco = !dco_check_option_conflict(D_DCO, o);