Commit Graph

4410 Commits (93bc7f269521b368806d0f0e09f9bf25fbf8a236)

Author SHA1 Message Date
Glenn Strauss 93bc7f2695 [core] allow tests/tmp/bind.conf override (#3137)
optional bind spec override for tests/*.conf,
e.g. for use on platforms w/o socket activation

x-ref:
  "TRACEME environment option in tests broken with LISTEN_PID"
  https://redmine.lighttpd.net/issues/3137
2022-01-10 22:38:32 -05:00
Glenn Strauss 1e335b3724 [core] allow LISTEN_PID to be ppid if TRACEME (fixes #3137)
allow LISTEN_PID to be ppid (parent pid) if TRACEME set in environment
(e.g. for strace, gdb on Linux; valgrind starts lighttpd as LISTEN_PID)

x-ref:
  "TRACEME environment option in tests broken with LISTEN_PID"
  https://redmine.lighttpd.net/issues/3137
2022-01-10 22:38:32 -05:00
Glenn Strauss aeba314454 [build] check headers before some funcs
skip some func checks (slow) if expected header does not exist
2022-01-10 22:38:27 -05:00
Glenn Strauss 618fb436f2 [build] rm redundant check for -lnetwork on Haiku 2022-01-08 18:09:42 -05:00
Glenn Strauss c0ced4e82b [build] collect Sun-specific headers and funcs
sendfilev() is Solaris-specific (and other OS have other alternatives)
2022-01-08 18:09:42 -05:00
Glenn Strauss 448621e026 [build] collect Sun-specific headers and funcs 2022-01-08 14:07:54 -05:00
Glenn Strauss f95ca5ef3b [build] use -fstack-protector-strong w/ extra warn
use -fstack-protector-strong if configured with --enable-extra-warnings
2022-01-08 13:33:02 -05:00
povcfe 8c62a890e2 [mod_extforward] fix out-of-bounds (OOB) write (fixes #3134)
(thx povcfe)

(edited: gstrauss)

There is a potential remote denial of service in lighttpd mod_extforward
under specific, non-default and uncommon 32-bit lighttpd mod_extforward
configurations.

Under specific, non-default and uncommon lighttpd mod_extforward
configurations, a remote attacker can trigger a 4-byte out-of-bounds
write of value '-1' to the stack. This is not believed to be exploitable
in any way beyond triggering a crash of the lighttpd server on systems
where the lighttpd server has been built 32-bit and with compiler flags
which enable a stack canary -- gcc/clang -fstack-protector-strong or
-fstack-protector-all, but bug not visible with only -fstack-protector.

With standard lighttpd builds using -O2 optimization on 64-bit x86_64,
this bug has not been observed to cause adverse behavior, even with
gcc/clang -fstack-protector-strong.

For the bug to be reachable, the user must be using a non-default
lighttpd configuration which enables mod_extforward and configures
mod_extforward to accept and parse the "Forwarded" header from a trusted
proxy. At this time, support for RFC7239 Forwarded is not common in CDN
providers or popular web server reverse proxies. It bears repeating that
for the user to desire to configure lighttpd mod_extforward to accept
"Forwarded", the user must also be using a trusted proxy (in front of
lighttpd) which understands and actively modifies the "Forwarded" header
sent to lighttpd.

lighttpd natively supports RFC7239 "Forwarded"
hiawatha natively supports RFC7239 "Forwarded"

nginx can be manually configured to add a "Forwarded" header
https://www.nginx.com/resources/wiki/start/topics/examples/forwarded/

A 64-bit build of lighttpd on x86_64 (not known to be affected by bug)
in front of another 32-bit lighttpd will detect and reject a malicious
"Forwarded" request header, thereby thwarting an attempt to trigger
this bug in an upstream 32-bit lighttpd.

The following servers currently do not natively support RFC7239 Forwarded:
nginx
apache2
caddy
node.js
haproxy
squid
varnish-cache
litespeed

Given the general dearth of support for RFC7239 Forwarded in popular
CDNs and web server reverse proxies, and given the prerequisites in
lighttpd mod_extforward needed to reach this bug, the number of lighttpd
servers vulnerable to this bug is estimated to be vanishingly small.
Large systems using reverse proxies are likely running 64-bit lighttpd,
which is not known to be adversely affected by this bug.

In the future, it is desirable for more servers to implement RFC7239
Forwarded.  lighttpd developers would like to thank povcfe for reporting
this bug so that it can be fixed before more CDNs and web servers
implement RFC7239 Forwarded.

x-ref:
  "mod_extforward plugin has out-of-bounds (OOB) write of 4-byte -1"
  https://redmine.lighttpd.net/issues/3134
  (not yet written or published)
  CVE-2022-22707
2022-01-08 13:07:12 -05:00
Glenn Strauss 51e141c803 [multiple] remove buffer_init_buffer()
remove (minor) convenience func; easy to replace

Like buffer_init_string(), buffer_init_buffer() was used in only a few
places at startup or in cold funcs, so better off removed from buffer.c
2022-01-07 02:06:08 -05:00
Glenn Strauss bade1c0319 [multiple] remove buffer_init_string()
remove (minor) convenience func; easy to replace
2022-01-07 02:06:08 -05:00
Glenn Strauss 10b307bd00 [core] (const char *) for srvconf.modules_dir
no need to be allocated (buffer *)
2022-01-07 02:06:08 -05:00
Glenn Strauss e563ae0173 [build] adjust help strings for pcre2 default 2022-01-07 02:06:08 -05:00
Glenn Strauss 9fcb03b68f [mod_authn_gssapi] reduce KRB5CCNAME mem alloc
reuse KRB5CCNAME path saved in r->env

request_reset() calls plugin cleanups (where KRB5CCNAME path unlinked)
before freeing the string from r->env.
2022-01-07 02:06:08 -05:00
Glenn Strauss 2e0b7cfb07 [mod_authn_gssapi] code reuse: fdevent_mkostemp() 2022-01-07 02:06:08 -05:00
Glenn Strauss e174e7dfe3 [core] buffer_copy_string() use "" if s is NULL
same for buffer_append_string()
2022-01-07 02:06:08 -05:00
Stefan Bühler f6d6295ab4 [ci] add cmake-asan build type 2022-01-06 19:30:56 -05:00
Stefan Bühler ae2fb97494 [array] use speaking names for array "fn" vtables for better debugging experience 2022-01-06 16:24:35 +01:00
Stefan Bühler f3052d6a5d [asan tests] fix memory leaks 2022-01-06 16:24:32 +01:00
Stefan Bühler 61fa90bbc0 [cmake] add address/undefined sanitize compile options 2022-01-06 16:23:52 +01:00
Stefan Bühler a092235121 [cmake] raise minimum version to 3.7
cmake 3.7.0 was tagged on 2016-11-11
debian stretch (currentyl oldoldstable): 3.7.2
ubuntu bionic (18.04LTS): 3.10.2
2022-01-06 15:49:16 +01:00
Glenn Strauss 8ebe1c5333 [lemon] silence coverity warnings 2022-01-06 05:00:40 -05:00
David Carlier c0f040eae7 [build] Haiku build fix (fixes #3136)
Haiku needs to link to additional lib -lnetwork for socket funcs
(similar to Solaris need for -lsocket -lnsl)

(edited: gstrauss)

x-ref:
  "haiku build fix proposal"
  https://redmine.lighttpd.net/issues/3136
2022-01-06 02:03:31 -05:00
Glenn Strauss 1b11cd7aeb [build] feature consistency between build types 2022-01-05 07:28:21 -05:00
David Carlier b6bd11c15e [core] server.core-files support for solaris (fixes #3135)
server.core-files support for solaris based systems.

- using setpflags and disable process tracing protection for the current process.

(edited: gstrauss)

x-ref:
  "server.core-files support on Solaris based system"
  https://redmine.lighttpd.net/issues/3135
2022-01-05 06:52:24 -05:00
Glenn Strauss 3d0f648948 [core] /dev/null is a symlink on Illumos (fixes #3132)
(thx devnexen)

also fix IPv6 detection on Illumos in CMake

x-ref:
  "Solaris little nit build fix and startup fix"
  https://redmine.lighttpd.net/issues/3132
2022-01-05 03:02:13 -05:00
Glenn Strauss 94a16b2b53 [build] meson crypt and dl detection on *BSD (fixes #3133)
(thx devnexen)

x-ref:
  "netbsd meson build fix"
  https://redmine.lighttpd.net/issues/3133
2022-01-04 21:27:51 -05:00
Glenn Strauss fa1ee081c3 [build] adjust .gitignore for macOS 2022-01-04 21:27:51 -05:00
Glenn Strauss f72de7113f [build] cmake: skip "-Wl,-export-dynamic" Illumos
(thx devnexen)

cmake: do not pass "-Wl,-export-dynamic" to Sun ld on Illumos

x-ref:
  "Solaris build fix proposal"
  https://redmine.lighttpd.net/issues/3130
2022-01-04 21:27:51 -05:00
Glenn Strauss d6741c58ce [build] meson misdetects mempcpy on some platforms
(thx devnexen)

x-ref:
  "Meson misdetects some functions with mingw-w64"
  https://github.com/mesonbuild/meson/issues/3672
  "Solaris build fix proposal"
  https://redmine.lighttpd.net/issues/3130
  "netbsd meson build fix"
  https://redmine.lighttpd.net/issues/3133
2022-01-04 21:27:51 -05:00
Glenn Strauss e3c3f27134 [mod_webdav] define HAVE_RENAMEAT2 earlier
(including linux/fs.h later might reveal RENAME_NOREPLACE)
2022-01-04 21:27:51 -05:00
Glenn Strauss 0c22c6433e [mod_webdav] copy acceleration
* copy acceleration
* safety for accelerated copying of files > 2 GB on 32-bit systems
* disable hard linking when "deprecated-unsafe-partial-put" => "enable"
  (In normal operation, hard-linking is safe for copying since WebDAV
   modification of any file involves full upload of file and atomic
   replacement, which severs any hard-links.  When deprecated unsafe
   partial PUT is permitted, that is not the case.)

x-ref:
  https://man7.org/linux/man-pages/man2/copy_file_range.2.html
  https://www.freebsd.org/cgi/man.cgi?query=copy_file_range&sektion=2&n=1
  https://man7.org/linux/man-pages/man2/ioctl_ficlone.2.html
  https://keith.github.io/xcode-man-pages/clonefile.2.html
  https://keith.github.io/xcode-man-pages/copyfile.3.html
2022-01-04 21:27:51 -05:00
Glenn Strauss 8b38a6eb35 [core] errno_t and rsize_t detection on Illumos
(thx devnexen)
2022-01-04 04:25:26 -05:00
Glenn Strauss 7eac25ac7f [core] hide bsd_accept_filter code on OpenBSD (fixes #3131)
(thx devnexen)

OpenBSD does not provide SO_ACCEPTFILTER

(This patch shows a good example of why cuddled-else should be avoided)

x-ref:
  "Remove unneeded connection bsd filter handling for OpenBSD"
  https://redmine.lighttpd.net/issues/3131
2022-01-04 04:25:26 -05:00
Glenn Strauss b9d58fa723 [build] cmake,meson socket libs for win32, Illumos (fixes #3130)
(thx devnexen)

cmake, meson: specify socket libs for win32, Illumos

x-ref:
  "Solaris build fix proposal"
  https://redmine.lighttpd.net/issues/3130
2022-01-04 04:25:26 -05:00
Glenn Strauss a931b1fce2 [core] define __EXTENSIONS__ on Illumos
(thx devnexen)
2022-01-04 04:25:21 -05:00
Glenn Strauss 7ead56183b [build] meson: find pcre2 w/o pkg-config
meson: find pcre2 on Illumos w/o pkg-config
2022-01-04 03:22:41 -05:00
Glenn Strauss 0aa6f73532 [build] cmake build now defaults to C11
cmake build now defaults to C11, like meson build
2022-01-03 04:31:52 -05:00
Glenn Strauss b9706ac49b [core] errno_t detection on Illumos
(thx devnexen)
2022-01-03 04:29:19 -05:00
Glenn Strauss 2c39174649 [build] update tests/SConscript 2022-01-03 04:25:11 -05:00
Glenn Strauss 9abc08d7d0 [build] adjust trace for regex-conditionals
adjust trace for regex-conditionals features to include pcre and pcre2
2022-01-03 03:08:33 -05:00
Glenn Strauss d587265992 [core] "server.graceful-shutdown-timeout" => 8
default "server.graceful-shutdown-timeout" => 8

previous default 0; disabled, so infinite timeout
configure previous behavior with:
  server.feature-flags += ("server.graceful-shutdown-timeout" => 0)
2022-01-03 02:28:08 -05:00
Glenn Strauss 750414d3bb [build] default --with-pcre2 unless --with-pcre 2022-01-03 02:28:08 -05:00
Glenn Strauss 86c2d30936 [multiple] remove long-deprecated modules
x-ref:
  https://wiki.lighttpd.net/Docs_ConfigurationOptions#Deprecated
2022-01-03 02:28:08 -05:00
Glenn Strauss 1334dd4ad5 [core] CCRandomGenerateBytes() for rand on macOS (fixes #3129)
(thx devnexen)

x-ref:
  "rand macOs case handling update"
  https://redmine.lighttpd.net/issues/3129
2022-01-03 02:23:07 -05:00
Glenn Strauss c5d55a9970 [build] cmake build now defaults to C11
cmake build now defaults to C11, like meson build
2022-01-03 01:42:05 -05:00
Glenn Strauss c7c342017f [build] feature consistency between build types
upate config.h.cmake for missing defines
minor adjustments to other builds for features consistency
2022-01-03 01:42:05 -05:00
Glenn Strauss d8bceb1472 [mod_webdav] copy_file_range() new in FreeBSD 13
(take 2)

adjust feature defines for header visibility of copy_file_range()
(introduced in FreeBSD 13)

x-ref:
  https://redmine.lighttpd.net/issues/3128
  https://github.com/freebsd/freebsd-src/blob/main/sys/sys/cdefs.h#L634
2022-01-02 03:43:55 -05:00
Glenn Strauss 5567fb6495 [mod_webdav] copy_file_range() new in FreeBSD 13
(thx devnexen)

adjust feature defines for header visibility of copy_file_range()
(introduced in FreeBSD 13)

x-ref:
  https://redmine.lighttpd.net/issues/3128
  https://github.com/freebsd/freebsd-src/blob/main/sys/sys/cdefs.h#L634
2022-01-01 19:09:27 -05:00
Glenn Strauss 8e1ad363d1 [mod_webdav] detect truncated copy_file_range()
detect truncated file when using copy_file_range(), even though
this should not happen with lighttpd-created temporary files
2022-01-01 18:30:18 -05:00
Glenn Strauss 5b310b36fb [mod_extforward] support longer PROXY v2 TLV vec
support longer HAProxy PROXY protocol v2 TLV vector
(allow up to 2k total for header + TLVs, saved on stack,
 and expecting <= MTU size (typically 1536 bytes))
2022-01-01 17:40:21 -05:00