[stunnel-users] Question about "forground = yes" and "output = FILE" combined options
mgebis at countertack.com
Wed Oct 14 21:42:12 CEST 2015
I have a question about the combination of the "foreground = yes"
option combined with the "output = FILE" option.
The man page says this:
foreground = yes | no (Unix only)
Stay in foreground (don’t fork) and log to stderr instead of via
syslog (unless output is specified).
This implies that if you set both "foreground = yes" and "output =
FILE", the log messages will not be sent to stderr and will instead be
sent to the log file only. We'd like this behavior--it makes it
easier for our scripts to distinguish startup errors parsing the
config file (which are sent to stderr, since the log file isn't
configured yet) vs. normal operation after the config file is parsed
and the log file is established.
However, it appears that if you specify "foreground = yes" and "output
= FILE", log messages will go to *both* stderr and the output file.
I guess I'm asking: is the documentation in conflict with the
behavior, and if so, which is correct?
It's possible I'm just misreading the man page. But in any case, here
is a simple patch which changes the behavior to match our reading of
the man page. It is against stunnel-5.22 but I believe it should be
applicable to later versions as well.
diff -ru stunnel-5.22.orig/src/log.c stunnel-5.22-foreground-outfile/src/log.c
--- stunnel-5.22.orig/src/log.c 2015-06-16 06:16:35.000000000 -0700
+++ stunnel-5.22-foreground-outfile/src/log.c 2015-10-14
@@ -243,7 +243,8 @@
+ global_options.option.foreground &&
More information about the stunnel-users