Commit Graph

82 Commits

Author SHA1 Message Date
Glenn Strauss 49c74fff65 [core] compile with upcoming openssl 1.1.0 release (fixes #2727)
(thx falemagn)

x-ref:
  "Won't compile with OpenSSL 1.1.0"
  https://redmine.lighttpd.net/issues/2727
2016-04-24 20:28:03 -04:00
Glenn Strauss 7f942ce09a remove handle_joblist hook
remove handle_joblist hook and remove the hooks defined in
mod_fastcgi and mod_scgi.  The calls made to fdevent management
are redundant.  If the calls were actually needed, then
mod_proxy would have needed a handle_joblist handler, too.
2016-04-18 06:19:03 -04:00
Glenn Strauss 71ed1912c7 [config] server.listen-backlog option (fixes #1825, #2116)
See doc/config/lighttpd.conf for explanation of listen() backlog queue

Additionally, mod_fastcgi and mod_scgi backend servers can now also be
configured with separate listen-backlog settings per server

x-ref:
  "add server.listen-backlog option instead of hard-coded value (128 * 8) for listen()"
  https://redmine.lighttpd.net/issues/2116
  "Don't disable backend when overloaded"
  https://redmine.lighttpd.net/issues/1825

github:
Closes #50
2016-04-18 04:29:28 -04:00
Glenn Strauss 292309f88b [core] lighttpd -tt performs preflight startup checks (fixes #411)
lighttpd -t loads config file and performs syntax check
lighttpd -tt (new) performs preflight startup checks,
  including loading and initializing modules, but skipping any
  potentially destructive actions which might affect an already
  running server (separate instance).  These currently include:
  - skipping pidfile modification
  - skipping bind() to network sockets
  - skipping open of error and access logs

From: Glenn Strauss <gstrauss@gluelogic.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3130 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-26 13:39:54 +00:00
Glenn Strauss 8abd06a7ff consistent inclusion of config.h at top of files (fixes #2073)
From: Glenn Strauss <gstrauss@gluelogic.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3113 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-19 15:14:35 +00:00
Stefan Bühler 00063098c1 [ssl] support disabling ssl.verifyclient.activate in SNI callback (fixes #2531)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3107 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-19 13:27:13 +00:00
Stefan Bühler 70036ff572 [core] accept $SERVER["socket"] without port, use server.port as fallback (fixes #2204)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3105 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-19 13:06:56 +00:00
Glenn Strauss d85bdab43f [core] more careful parse of $SERVER["socket"] config str (prepare #2204)
detect unix domain socket path earlier
detect IPv6 addr without port (might contain ':' within addr, e.g. [::])

From: Glenn Strauss <gstrauss@gluelogic.com>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3104 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-03-19 13:06:54 +00:00
Stefan Bühler c033a1966e [core] improve conditional enabling (thx Gwenlliana, #2598)
instead of looping over all config blocks for each conditional var that
gets enabled, enable them all and run over them once.

Right now it seems we actually set all variables at once in normal
config handling (SNI only sets a subset); future modifications
might introduce new variables which are activated at a later stage
(physical path related for example).

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3083 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-02-21 18:32:17 +00:00
Stefan Bühler 566cf8decb add force_assert for more allocation results
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3072 152afb58-edef-0310-8abb-c4023f1b3aa9
2016-01-30 13:59:07 +00:00
Stefan Bühler 593599f14a rewrite network (write) backends
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3012 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-08-22 16:00:59 +00:00
Stefan Bühler 6afad87d2e fix buffer, chunk and http_chunk API
* remove unused structs and functions
    (buffer_array, read_buffer)
  * change return type from int to void for many functions,
    as the return value (indicating error/success) was never checked,
    and the function would only fail on programming errors and not on
    invalid input; changed functions to use force_assert instead of
    returning an error.
  * all "len" parameters now are the real size of the memory to be read.
    the length of strings is given always without the terminating 0.
  * the "buffer" struct still counts the terminating 0 in ->used,
    provide buffer_string_length() to get the length of a string in a
    buffer.
    unset config "strings" have used == 0, which is used in some places
    to distinguish unset values from "" (empty string) values.
  * most buffer usages should now use it as string container.
  * optimise some buffer copying by "moving" data to other buffers
  * use (u)intmax_t for generic int-to-string functions
  * remove unused enum values: UNUSED_CHUNK, ENCODING_UNSET
  * converted BUFFER_APPEND_SLASH to inline function (no macro feature
    needed)
  * refactor: create chunkqueue_steal: moving (partial) chunks into another
    queue
  * http_chunk: added separate function to terminate chunked body instead of
    magic handling in http_chunk_append_mem().
    http_chunk_append_* now handle empty chunks, and never terminate the
    chunked body.

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2975 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-02-08 12:37:10 +00:00
Stefan Bühler b0a632f253 [network] fix compile break in calculation of sockaddr_un size if SUN_LEN is not defined (fixes #2609)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2972 152afb58-edef-0310-8abb-c4023f1b3aa9
2015-02-07 11:33:30 +00:00
Stefan Bühler efc41b2bb1 check length of unix domain socket filenames
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2958 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-02-16 13:08:43 +00:00
Stefan Bühler 9f2be4882d force assertion: setting FD_CLOEXEC must work (if available)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2952 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-02-16 13:08:29 +00:00
Stefan Bühler fba7dd6f43 fix resource leaks in error cases on config parsing and other initializations
None of this matters - lighttpd will terminate anyway. Still helps the
  code to get cleaner, and makes reviewing output of static analyzers
  easier.

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2947 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-02-14 21:06:19 +00:00
Stefan Bühler bcd35cc264 remove logical dead code
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2945 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-02-14 21:06:14 +00:00
Stefan Bühler a7396296da [network/ssl] fix build error if TLSEXT is disabled
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2937 152afb58-edef-0310-8abb-c4023f1b3aa9
2014-01-20 21:31:26 +00:00
Stefan Bühler c8fbc16985 [ssl] fix regression from CVE-2013-4508 (client-cert sessions were broken)
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2925 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-11-13 17:18:39 +00:00
Stefan Bühler 6f208cfde1 fix/silence bugs reported by ccc-analyzer (clang)
These should all be non critical:
 * memory leaks on startup in error cases (which lead to
   immediate shutdowns anyway)
 * http_auth/ldap: passing uninitialized "ret" to ldap_err2string
 * sizeof(T) not matching the target pointer in malloc/calloc calls;
   those cases were either:
   * T being the wrong pointer type - shouldn't matter as long as all
     pointers have same size
   * T being larger than the type needed
 * mod_accesslog: direct use after free in cleanup (server shutdown);
   could crash before "clean" shutdown
 * some false positives (mod_compress, mod_expire)
 * assert(srv->config_context->used > 0); - this is always the case,
   as there is always a global config block

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2920 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-11-13 11:43:26 +00:00
Stefan Bühler 1af871fcef [ssl] fix SNI handling; only use key+cert+verify-client from SNI specific config (fixes #2525, CVE-2013-4508)
pull all ssl.ca-file values into all SSL_CTXs, but use only the local
ssl.ca-file for verify-client; correct SNI name is no requirement,
so enforcing verification for a subset of SNI names doesn't actually
protect those.

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2913 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-11-05 15:29:07 +00:00
Stefan Bühler 3ce548c8d0 remove unused members from struct server_socket
From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2912 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-11-05 15:29:04 +00:00
Stefan Bühler 93fd9ea7a4 [ssl] add option ssl.empty-fragments, defaulting to disabled (fixes #2492)
if ssl.empty-fragments is set to enabled, but the openssl version used
  to compile lighttpd doesn't support empty fragments, a warning is
  displayed (it might still work).

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2891 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-08-30 13:14:50 +00:00
Stefan Bühler 6d4d2118c3 [ssl] accept ssl renegotiations if they are not disabled (fixes #2491)
* don't fiddle with ssl internals
 * renegotiations should be safe with recent openssl versions,
   openssl itself should reject unsafe renegotiations

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2890 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-08-30 13:14:48 +00:00
Stefan Bühler 05858f6cf2 [ssl] Fix $HTTP["scheme"] conditional, could be "http" for ssl connections if the ssl $SERVER["socket"] conditional was nested (fixes #2501)
con->conf.is_ssl got removed and replaced by:
 * con->conf.ssl_enabled for the config var "ssl.engine" - it is only
   used to determine which server-sockets should use ssl. (usually not
   needed as it is mandatory and enough to set ssl.pemfile anyway)
 * con->srv_socket->is_ssl to detect the actual ssl status of the
   bound socket, which is the same as the ssl status of the connection
 * con->uri.scheme for the actual $HTTP["scheme"] value, also used for
   the CGI "HTTPS=ON" variable. This defaults to "https" if the
   connection uses ssl, but can be changed for example by mod_extforward
   if X-Forwarded-Proto: is set to either "http" or "https" (other values
   are ignored right now)

Also removed the broken srv_socket->is_proxy_ssl as it was a connection
value in a server_socket struct...

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2887 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-07-31 20:23:21 +00:00
Stefan Bühler 6cdb46587c [ssl] use DH only if openssl supports it (fixes #2479)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2884 152afb58-edef-0310-8abb-c4023f1b3aa9
2013-06-29 12:46:00 +00:00
Stefan Bühler c3a9948c75 network_server_init: fix double free and memleak on error (fixes #2440, thx kyprizel)
this is not really critical - lighty will terminate anyway after hitting
this, and this is before connections are accepted.

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2855 152afb58-edef-0310-8abb-c4023f1b3aa9
2012-11-09 14:23:22 +00:00
Stefan Bühler 35875cd515 [ssl] include more headers explicitly
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2825 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-12-27 13:45:36 +00:00
Stefan Bühler 456d7f4790 fix compile error when ssl is not enabled
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2812 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-11-30 20:57:54 +00:00
Stefan Bühler 0f96222e7e [ssl] add option to honor server cipher order, true by default (fixes #2364)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2810 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-11-30 19:59:24 +00:00
Stefan Bühler 8c482a496d remove copy/paste remainings from previous commit
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2809 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-11-30 19:59:20 +00:00
Stefan Bühler a94bdd07df [ssl] count renegotiations to prevent client renegotiations
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2808 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-11-30 18:40:08 +00:00
Stefan Bühler cbf1baacc9 [ssl] fix build errors when Elliptic-Curve Diffie-Hellman is disabled
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2802 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-08-22 15:32:55 +00:00
Stefan Bühler f434d514ad Limit amount of bytes we send in one go; fixes stalling in one connection and timeouts on slow systems.
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2801 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-08-22 15:12:28 +00:00
Stefan Bühler 55e1dc1825 [ssl/build] some minor fixes; fix compile without ssl, cleanup ssl config buffers
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2789 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-04-24 16:02:55 +00:00
Stefan Bühler f610f894a3 ssl: Support for Diffie-Hellman and Elliptic-Curve Diffie-Hellman key exchange (fixes #2301, #2246, #2239)
- add ssl.use-sslv3
 - load all algorithms

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2780 152afb58-edef-0310-8abb-c4023f1b3aa9
2011-03-13 18:00:09 +00:00
Stefan Bühler 7e5b0fe9ab Rename fdevent_event_add to _set to reflect what the function does. Fix some handlers.
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2765 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-08-17 09:54:42 +00:00
Stefan Bühler e23e999089 bind to IPV6-only if ipv6 address was specified (http://redmine.lighttpd.net/projects/lighttpd/wiki/IPv6-Config)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2758 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-08-07 13:16:16 +00:00
Stefan Bühler 4ae13c32b1 only require FDEVENT_IN bit to be set for listening connections (fixes #2227)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2753 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-08-06 21:57:19 +00:00
Stefan Bühler 38f2d1ddd7 cleanup fdevent code, removed linux-rtsig handler, replaced some fprintf calls
* use log functions
 * convert flags
 * fix handler callback prototype

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2752 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-08-06 21:57:15 +00:00
Stefan Bühler b3892c1410 Reset uri.authority before TLS servername handling, reset all "keep-alive" data in connection_del (fixes #2125)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2724 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-04-28 19:08:11 +00:00
Stefan Bühler 34fb1258e4 Fix handling return value of SSL_CTX_set_options (fixes #2157, thx mlcreech)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2716 152afb58-edef-0310-8abb-c4023f1b3aa9
2010-02-28 11:48:05 +00:00
Stefan Bühler 1d5d55a484 Don't print ssl error if client didn't support TLS SNI
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2666 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-16 22:06:22 +00:00
Stefan Bühler b987643307 Add SSL Client Certificate verification (#1288)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2654 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-14 18:19:19 +00:00
Stefan Bühler 97cec38a3b Fix compile error if TLS SNI isn't supported
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2652 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-14 17:46:23 +00:00
Stefan Bühler 7322d53684 Fix some warnings in previous commit (TLS SNI)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2650 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-14 14:32:24 +00:00
Peter Colberg 8b6dae4139 Add TLS servername indication (SNI) support (fixes #386, thx Peter Colberg <peter@colberg.org>)
* This patch may "break" some configs, if they do stupid things. Like setting
  ssl.pemfile to a not existing file in a "non-socket/non-ssl" block.
  Fix them! :)

From: Peter Colberg <peter@colberg.org>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2648 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-14 13:39:59 +00:00
Stefan Bühler 22e8b456a9 Fix header inclusion order, always include "config.h" before any system header
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2624 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-10-11 14:31:42 +00:00
Stefan Bühler f9e65e8500 Fixed some small non-critical leaks reported by cppcheck
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2618 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-09-01 14:03:59 +00:00
Stefan Bühler 4df22f2a32 Fix issues found with clang analyzer
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2594 152afb58-edef-0310-8abb-c4023f1b3aa9
2009-07-21 20:35:27 +00:00