Commit Graph

4601 Commits (f86b448799fc7f55274a1d61583ff3d390f58e0b)
 

Author SHA1 Message Date
Glenn Strauss d0273c8af5 [mod_magnet] defer req_env init unless needed
defer req_env initialization unless req_env might be needed by script
1 year ago
Glenn Strauss a162fc70e9 [core] prep server_tag at startup for h2 resp hdr 1 year ago
Glenn Strauss 14e5404af9 [mod_deflate] improve loop compressing file chunk 1 year ago
Glenn Strauss 129cbc1ef9 [mod_deflate] use pread if available 1 year ago
Glenn Strauss e05ce80502 [multiple] shared code for struct chunk and mmap
chunkqueue_chunk_file_view()

reduces size of struct chunk

use mmap with mod_deflate libdeflate, if mmap available,
  even when lighttpd not built with --enable-mmap

avoid using mmap on temp files in chunkqueue (c->file.is_temp)
  since pread() with a reasonable block size is typically as fast
  or faster than mmap on files read sequentially and used only once,
  especially when writing results to limited-size socket buffers
  (and lighttpd temp files are, in most cases, by default about 1 MB)
  (Exception: sometimes mmap is used for convenience or to fulfill
   a requirement, e.g. one-shot libdeflate in mod_deflate)
  (There are many factors which influence speed of mmap versus pread,
   so this should not be construed as generic usage advice.)
1 year ago
Glenn Strauss 9b55ac6da5 [multiple] pedantic chunk.c checks for 0-len chunk 1 year ago
Glenn Strauss 6cd3b5f8af [multiple] use new sys_setjmp_eval3() interface
wrap system os setjmp or compiler try/catch and access mmap inside
callback to protect against SIGBUS (or _WIN32 EXCEPTION_IN_PAGE_ERROR)
1 year ago
Glenn Strauss a314b8d031 [core] network_write_file_chunk_remap separate fn 1 year ago
Glenn Strauss 6eeb45f1f9 [core] include guard consistency in sys-time.h
include guard consistency with other lighttpd sys-*.h headers
1 year ago
Glenn Strauss 6d5ecb6155 [mod_magnet] check lighty.result.content b4 setjmp
check lighty.result.content exists before setjmp() to avoid setjmp()
overhead if there is no content set via lua lighty.result.content

(response body could have been set via lua lighty.r.resp_body.* instead)
1 year ago
Glenn Strauss 9357da4126 [core] sys-setjmp.[ch]
wrap system setjmp or compiler C try/catch mechanism
1 year ago
Glenn Strauss d662fae369 [mod_deflate] mark input bytes const 1 year ago
Glenn Strauss d68fc6394f [mod_deflate] --with-libdeflate to use libdeflate
configure --with-libdeflate option to use libdeflate
(must also configure --enable-mmap for mod_deflate to use libdeflate
 on input files larger than 64kB; libdeflate not used on files <= 64kB)
1 year ago
Glenn Strauss 46110127f7 [mod_deflate] prototype using libdeflate w/ mmap 1 year ago
Glenn Strauss a78f447c35 [mod_deflate] collect mmap code
mmap entire file to compress on 64-bit systems
1 year ago
Glenn Strauss bfa89204f4 [mod_mbedtls] set usekeysize for mbedtls 3.2.0+ 1 year ago
Glenn Strauss 25f83b84b6 [core] feature flag to allow Range w/ HTTP/1.0
server.feature-flags += ( "http10.range" => "enable" )

The Range request header is HTTP/1.1, not HTTP/1.0.

Intermediate HTTP/1.0 proxies might mishandle or incorrectly cache
responses to HTTP/1.1 Range requests, so the default in lighttpd is
to ignore Range requests sent with HTTP/1.0.

This feature flag changes the default if an admin desires to support
dumb HTTP/1.0 clients that might (incorrectly) send Range requests
with HTTP/1.0.  Those client really ought to grow HTTP/1.1 support:
add support to receive HTTP/1.1 Transfer-Encoding: chunked responses,
and then those client may safely send HTTP/1.1 Range requests
(and in many cases, also Connection: close).
1 year ago
Glenn Strauss 422d0355f5 [core] Illumos epoll incompatible w/ lighttpd impl
Illumos POLLRDHUP != EPOLLRDHUP; lighttpd implementation asserts()
(since lighttpd implementation defines FDEVENT_RDHUP as POLLRDHUP)
1 year ago
Glenn Strauss 2759d1eb00 [mod_deflate] fix to return 304 with If-None-Match (fixes #3143)
(thx meier22)

Bug in lighttpd 1.4.51 - lighttpd 1.4.64

x-ref:
  "mod_deflate not returning 304 Not Modified for If-None-Match request"
  https://redmine.lighttpd.net/issues/3143
  "How to get 304 Not Modified - response with mod_deflate"
  https://redmine.lighttpd.net/boards/2/topics/10253
1 year ago
Glenn Strauss 4432e34253 [mod_webdav] no COPYFILE_CLONE_FORCE on OSX <10.12 (fixes #3142)
(thx ryandesign)

There is no COPYFILE_CLONE_FORCE on OSX <10.12  so fall back to using
fcopyfile() to avoid race condition on source (if changed to dir) if
using copyfile() with flags equivalent to COPYFILE_CLONE_FORCE, but
without the 'force' flag.

x-ref:
  "error: use of undeclared identifier 'COPYFILE_CLONE_FORCE'"
  https://redmine.lighttpd.net/issues/3142
1 year ago
Glenn Strauss 7901259fbb [core] fix HMAC with openssl 3.0
(thx ryandesign)

x-ref:
  https://redmine.lighttpd.net/boards/2/topics/10240
1 year ago
Glenn Strauss d7a76d109e [core] parse conf cmds with SHELL or /bin/sh
(thx ryandesign)

Use $SHELL -c to execute commands if SHELL is set and is not set to
/usr/bin/false or /bin/false, else use /bin/sh -c

x-ref:
  https://redmine.lighttpd.net/boards/2/topics/10240
1 year ago
Glenn Strauss c0803bec08 [core] use diff var name w/ CCRandomGenerateBytes (fixes #3141)
(thx ryandesign)

CCRandomGenerateBytes is a fallback and might be present alongside
crypto libraries which (previously) used the same variable name.

x-ref:
  "error: redefinition of 'i'"
  https://redmine.lighttpd.net/issues/3141
1 year ago
Glenn Strauss 6791f71b20 [core] avoid CCRandomGenerateBytes on MacOS <10.12 (fixes #3140)
(thx ryandesign)

x-ref:
  "lighttpd build failure on macOS 10.13 and earlier"
  https://redmine.lighttpd.net/issues/3140
1 year ago
Glenn Strauss 7792bc7230 [build] meson -Dlua_version=... to specify lua ver
(thx herbmillerjr)

x-ref:
  https://github.com/gentoo/gentoo/pull/23857
1 year ago
Glenn Strauss 37dd53bae9 [build] autoconf: report if building with zstd 1 year ago
Glenn Strauss 876a1e1b2c [build] meson: fix typo in variable name 1 year ago
Glenn Strauss 2a683cf25d - next is 1.4.65 1 year ago
Glenn Strauss 73bd6b41d3 [doc] NEWS 1 year ago
Glenn Strauss 274f8ce0bc [mod_mbedtls] mbedtls_ssl_conf_groups for 3.1.0
use mbedtls_ssl_conf_groups() for mbedtls 3.1.0
(replaces deprecated mbedtls_ssl_conf_curves())
1 year ago
Glenn Strauss 4f48825542 [mod_mbedtls] remove use of out_left in mbedtls 3
remove use of ssl->out_left in mbedtls 3.0.0

Discussed in https://github.com/ARMmbed/mbedtls/issues/5331,
the current implementations of mbedtls_net_send() and mbedtls_net_recv()
return MBEDTLS_ERR_SSL_WANT_WRITE only when there is a partial write
(though there is theoretical issue if writes are mixed with TLS alerts)

x-ref:
  "issues migrating lighttpd mod_mbedtls to mbedtls 3.0.0"
  https://github.com/ARMmbed/mbedtls/issues/5331
1 year ago
Glenn Strauss 955c95bf51 [mod_mbedtls] changes to build with mbedtls 3.0.0
x-ref:
  "issues migrating lighttpd mod_mbedtls to mbedtls 3.0.0"
  https://github.com/ARMmbed/mbedtls/issues/5331
1 year ago
Glenn Strauss 6f65dae4a5 [mod_mbedtls] reconstruct SSL_CLIENT_S_DN
reconstruct SSL_CLIENT_S_DN in lighttpd due to limitations of
mbedtls_x509_dn_gets().  Adds support for non-ASCII UTF-8,
but loses support for multi-valued RDNs.

x-ref:
  "Add access to mbedtls_x509_name::next_merged"
  https://github.com/ARMmbed/mbedtls/issues/5431
1 year ago
Glenn Strauss a300c87b86 [mod_openssl] do not esc UTF-8 in cert subject
unset flag which escapes chars with most-significant-bit set
for clean display of non-ASCII UTF-8 chars in cert subject

x-ref:
  man X509_NAME_oneline
  man ASN1_STRING_print_ex
1 year ago
Glenn Strauss 3426faf5ae [multiple] permit UTF-8 in SSL_CLIENT_S_DN_*
permit non-ASCII UTF-8 in SSL_CLIENT_S_DN_*

x-ref:
  https://github.com/ARMmbed/mbedtls/pull/3326#issuecomment-1013921672
1 year ago
Glenn Strauss 3ac377177b [mbedtls] save (mbedtls_ssl_config *) in hctx
(cleaner approach and compatible with mbedtls 3.0.0)
1 year ago
Glenn Strauss efcc51c129 [mod_mbedtls] lift size check out of DN loop
lift size check out of client Subject DN loop
move loop invariant into for() declaration
1 year ago
Glenn Strauss 8a46e0b941 [mod_gnutls] lift size check out of DN loop
lift size check out of client Subject DN loop
1 year ago
Glenn Strauss d1b5f52e96 [tests] revert _WIN32 adjustments in LightyTest.pm
This reverts commit c1bc5efe9a.
1 year ago
Glenn Strauss c1bc5efe9a [tests] _WIN32 adjustments in LightyTest.pm
separate cygwin paths from Windows native paths

remove unnecessary variables
remove unnecessary file copies
1 year ago
Glenn Strauss faa134cad5 [mod_webdav] no sys/ioctl.h on _WIN32 1 year ago
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
1 year ago
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
1 year ago
Glenn Strauss aeba314454 [build] check headers before some funcs
skip some func checks (slow) if expected header does not exist
1 year ago
Glenn Strauss 618fb436f2 [build] rm redundant check for -lnetwork on Haiku 1 year ago
Glenn Strauss c0ced4e82b [build] collect Sun-specific headers and funcs
sendfilev() is Solaris-specific (and other OS have other alternatives)
1 year ago
Glenn Strauss 448621e026 [build] collect Sun-specific headers and funcs 1 year ago
Glenn Strauss f95ca5ef3b [build] use -fstack-protector-strong w/ extra warn
use -fstack-protector-strong if configured with --enable-extra-warnings
1 year ago
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
1 year ago
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
1 year ago