Project

General

Profile

Actions

Feature #2642

closed

add option for "fail on warning"

Added by odoto about 9 years ago. Updated about 8 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

I'd really like to see an option to treat warnings as errors, ergo terminate execution if a warning occurs, somewhat like the -Werror option of gcc.

The reason behind this is, that I'd rather like my web server not to start at all than have it go up in a potentially insecure configuration due to accidental misconfiguration.

If for instance an unknown config-key warning occurs, it makes sense to sort that out before resuming operation, as it indicates that the config is not understood by lighttpd in the way the user intended.

Since I assume that not everybody shares my "safety first" attitude regarding this matter, I propose to make that behaviour optional, perhaps by adding a command line parameter or an option in the config file.

Actions #1

Updated by gstrauss about 8 years ago

This might be obtainable with lighttpd config test mode:

 -t         test the config-file, and exit

If successful, "Syntax OK" is printed to stdout. You might treat any warning output (to stderr) as indication of a config error.

Actions #2

Updated by stbuehler about 8 years ago

  • Target version set to 1.4.x
Actions #4

Updated by gstrauss about 8 years ago

  • Status changed from New to Fixed
  • Target version changed from 1.4.x to 1.4.40

https://github.com/lighttpd/lighttpd1.4/pull/44 was committed in r3130

lighttpd -tt (two -tt) processes the config file up through the unknown config key warnings, actually initializing all modules (except binding to sockets and opening log files). While this exits 0 unless there is an error, you can easily write a script to capture stderr and to treat any output to stderr as an error.

Actions #5

Updated by gstrauss about 8 years ago

  • Status changed from Fixed to Patch Pending

I missed adding preflight checks around mod_fastcgi and mod_scgi spawning of local backend processes. Please apply this additional patch.

diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c
index 9c50fa7..a9c300a 100644
--- a/src/mod_fastcgi.c
+++ b/src/mod_fastcgi.c
@@ -1428,7 +1428,8 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
                                                                                "\n\tcurrent:", pno, "/", host->max_procs);
                                                        }

-                                                       if (fcgi_spawn_connection(srv, p, host, proc)) {
+                                                       if (!srv->srvconf.preflight_check
+                                                           && fcgi_spawn_connection(srv, p, host, proc)) {
                                                                log_error_write(srv, __FILE__, __LINE__, "s",
                                                                                "[ERROR]: spawning fcgi failed.");
                                                                fastcgi_process_free(proc);
diff --git a/src/mod_scgi.c b/src/mod_scgi.c
index b7b6b3b..308c9df 100644
--- a/src/mod_scgi.c
+++ b/src/mod_scgi.c
@@ -1189,7 +1189,8 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
                                                                                "\n\tcurrent:", pno, "/", df->min_procs);
                                                        }

-                                                       if (scgi_spawn_connection(srv, p, df, proc)) {
+                                                       if (!srv->srvconf.preflight_check
+                                                           && scgi_spawn_connection(srv, p, df, proc)) {
                                                                log_error_write(srv, __FILE__, __LINE__, "s",
                                                                                "[ERROR]: spawning fcgi failed.");
                                                                scgi_process_free(proc);
Actions #6

Updated by gstrauss about 8 years ago

  • Status changed from Patch Pending to Fixed

updated in c4edd356

Actions

Also available in: Atom