Skip to contentSkip to conversation

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

PATCH In review Arne Schwabe 2 participants 2 messages Jul 22, 2022

lore
Share & tools
lore
#0 lore raw

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

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.

---
 src/openvpn/options.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/openvpn/options.c +6 -0
index abda8c379..e56df7d4c 100644
@@ -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-sigusr 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);
Signature · 1 line
2.32.1 (Apple Git-133)
#1 lore raw
Quoted 14 lines · Arne Schwabe

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.

---
 src/openvpn/options.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/openvpn/options.c +0 -0
index abda8c379..e56df7d4c 100644

src/openvpn/options.c options_postprocess_mutate(struct options *o, struct env_set *es) · line 3686

Quoted 7 lines
src/openvpn/options.c +4 -0
@@ -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-sigusr SIGHUP' are"
+                     "incompatible with each other.");

FWIW, the option is called remap-usr1, not remap-sigusr.

Regards,

Signature · 1 line
  Frank Lichtenheld