Commit Graph

85 Commits (34033822614bca7d1e66f719a17bbc61fcaf5959)

Author SHA1 Message Date
Glenn Strauss 3403382261 [mod_openssl] issue warning for deprecated options 3 years ago
Glenn Strauss d605c83a73 [mod_openssl] enable read-ahead, if set, after SNI
note: not disabling if enabled; extra blocks may already have been read
3 years ago
Glenn Strauss c18f442a63 [multiple] add summaries to top of some modules 3 years ago
Glenn Strauss acff179322 [mod_openssl] set chains from callback in 1.0.2+ (#2842)
mod_openssl leverages cert callback in openssl 1.0.2 and later
(SSL_CTX_set_cert_cb())

server certificate chain
  is now set in the cert callback

verify_store (for client certificate verification) (ssl.ca-file)
  is now set in the cert callback

more carefully load sensitive files and clear temporary storage
  (with openssl 1.1.1 and later)

x-ref:
  "Lighttpd Returns Wrong Cert In Multi-cert Set-up"
  https://redmine.lighttpd.net/issues/2842
3 years ago
Glenn Strauss 01b1f16b3f [mod_openssl] set cert from callback in 1.0.2+ (fixes #2842)
set server certificate from callback in openssl 1.0.2 and later
(SSL_CTX_set_cert_cb())

For existing versions of lighttpd, certificate selection influenced by
ssl.cipher-list which can be used to set server cipher order preference
(along with ssl.honor-cipher-order = "enable", which is the default)

x-ref:
  "Lighttpd Returns Wrong Cert In Multi-cert Set-up"
  https://redmine.lighttpd.net/issues/2842
  "lighttpd uses wrong pem-file"
  https://redmine.lighttpd.net/issues/3009
3 years ago
Glenn Strauss 2a5b7c648a [mod_openssl] rotate session ticket encryption key
server ticket encryption key (STEK) rotation occurs every 86400 seconds
and upon lighttpd server restart.  If using lighttpd with multiple
lighttpd workers, then restarting lighttpd keeps the STEK in sync
between lighttpd workers.
3 years ago
Glenn Strauss 68d626fa9f [mod_openssl] SSL_R_UNEXPECTED_EOF_WHILE_READING
report SSL_R_UNEXPECTED_EOF_WHILE_READING if debug.log-ssl-noise enabled

SSL_R_UNEXPECTED_EOF_WHILE_READING
added in openssl 1.1.1e and reverted in 1.1.1f, but kept in 3.0 branch
3 years ago
Glenn Strauss b33b6f9121 [mod_openssl] do not log ECONNRESET unless debug
do not log ECONNRESET to errorlog unless debug.log-ssl-noise = "enable"
3 years ago
Glenn Strauss ce7840504d [mod_openssl] disable cert vrfy if ALPN acme-tls/1
disable client cert verification if ALPN "acme-tls/1"
3 years ago
Glenn Strauss c752d4696e [multiple] correct misspellings in comments
x-ref:
  "Script for fixing spelling errors with codespell"
  https://redmine.lighttpd.net/boards/3/topics/8947
3 years ago
Glenn Strauss 7c7f8c467c [multiple] split con, request (very large change)
NB: r->tmp_buf == srv->tmp_buf (pointer is copied for quicker access)

NB: request read and write chunkqueues currently point to connection
    chunkqueues; per-request and per-connection chunkqueues are
    not distinct from one another
      con->read_queue  == r->read_queue
      con->write_queue == r->write_queue

NB: in the future, a separate connection config may be needed for
    connection-level module hooks.  Similarly, might need to have
    per-request chunkqueues separate from per-connection chunkqueues.
    Should probably also have a request_reset() which is distinct from
    connection_reset().
3 years ago
Glenn Strauss 100dfaa3f3 [core] move plugin_ctx into (request_st *)
NB: in the future, a separate plugin_ctx may be needed for
    connection-level plugins to keep state across multiple requests
3 years ago
Glenn Strauss 8131e4396d [core] move addtl request-specific struct members 3 years ago
Glenn Strauss 1dd58c5ad8 [multiple] con->proto_default_port 3 years ago
Glenn Strauss 034d7d6734 [core] http_request_host_policy w/ http_parseopts
pass http_parseopts arg (instead of con) to http_request_host_policy()
3 years ago
Glenn Strauss ca97505a72 [multiple] store srv->tmp_buf in tb var
rather than using srv->tmp_buf directly in code modifying temp buf (tb)
3 years ago
Glenn Strauss 0ff60d8218 [multiple] rename r to rc rv rd wr to be different
variable rename
3 years ago
Glenn Strauss 03b4c993d2 [multiple] generic config array type checking 3 years ago
Glenn Strauss b5775b9951 [multiple] reduce direct use of srv->errh 3 years ago
Glenn Strauss de73b190a4 [core] read up-to fixed size chunk before fionread 3 years ago
Glenn Strauss f24e6d696a [multiple] plugin_stats array
use global rather than passing around (server *) just for that

li_itostrn() and li_utostrn() return string length
(rather than requiring subsequent strlen() to find length)
3 years ago
Glenn Strauss 50bdb55de8 [multiple] connection hooks no longer get (srv *)
(explicit (server *) not passed; available in con->srv)
3 years ago
Glenn Strauss 010c28949c [multiple] prefer (connection *) to (srv *)
convert all log_error_write() to log_error() and pass (log_error_st *)

use con->errh in preference to srv->errh (even though currently same)

avoid passing (server *) when previously used only for logging (errh)
3 years ago
Glenn Strauss 24680a9142 [core] array_init() arg for initial size 3 years ago
Glenn Strauss b73949e03f [multiple] plugin.c handles common FREE_FUNC code
(simpler for modules; less boilerplate to cut-n-paste)
3 years ago
Glenn Strauss 83633a9f06 [mod_openssl] use config_plugin_values_init() 3 years ago
Glenn Strauss d23071a38f [core] config_get_config_cond_info()
isolate direct use of (data_config *)
3 years ago
Glenn Strauss e2de4e581e [core] const char *name in struct plugin
put void *data (always used) as first member of struct plugin

add int nconfig member to PLUGIN_DATA

calloc() inits p->data to NULL
3 years ago
Glenn Strauss 36f64b26a1 [core] simpler config_check_cond()
optimize for common case where condition has been evaluated for
the request and a cached result exists

(also: begin isolating data_config)
3 years ago
Glenn Strauss c2238256e2 [core] inline array as part of data_array value
(instead of value being (array *))
3 years ago
Glenn Strauss 6eb34ef5ab [core] add const to callers of http_header_*_get()
(The few places where value is modified in-place were not made const)
3 years ago
Glenn Strauss 601c572c39 [core] inline buffer as part of data_string value
(instead of value being (buffer *))
3 years ago
Glenn Strauss 47a758f959 [core] inline buffer key for *_patch_connection()
handle buffer key as part of DATA_UNSET in *_patch_connection()
(instead of key being (buffer *))
3 years ago
Glenn Strauss ad9b7e009b [core] inline buffer as part of DATA_UNSET key
(instead of key being (buffer *))
3 years ago
Glenn Strauss a7a721ab43 [core] treat con->conditional_is_valid as bitfield 3 years ago
Glenn Strauss 83535bbef3 [core] differentiate array_get_* for ro and rw
array_get_element_klen() is now intended for read-only access
array_get_data_unset() is used by config processing for r/w access
array_get_buf_ptr() is used for r/w access to ds->value (string buffer)
3 years ago
Glenn Strauss fa8856757c [mod_openssl] reject invalid ALPN 3 years ago
Glenn Strauss 1a325a196c [mod_openssl] use SSL_CTX_set_client_hello_cb()
use SSL_CTX_set_client_hello_cb() when available

(obsoletes SSL_CTX_set_tlsext_servername_callback()
 and SSL_CTX_set_tlsext_servername_arg())
4 years ago
Mohammed Sadiq 6a988bb0d0 [multiple] cleaner calloc use in SETDEFAULTS_FUNC
github: closes #99

x-ref:
  "cleaner calloc use in SETDEFAULTS_FUNC"
  https://github.com/lighttpd/lighttpd1.4/pull/99
4 years ago
Glenn Strauss 99f8ae0d0d [mod_openssl] use 16k static buffer instead of 64k
better match size used by openssl
(avoid unused, oversized reads)
4 years ago
Glenn Strauss 8efa6a34f4 [mod_openssl] default: ssl.cipher-list = "HIGH" 4 years ago
Glenn Strauss 3e200717cc [mod_openssl] inherit cipherlist from global scope
inherit cipherlist from global scope if not set in $SERVER["socket"]
4 years ago
Glenn Strauss 1542e44bb7 [core] use openssl to read,discard request body
use openssl to read,discard request body after response has been sent
on a TLS connection, at least until SSL close notify has been sent

x-ref:
  "HTTPS POST upload hangs when i reach maximum supported request size"
  https://redmine.lighttpd.net/boards/2/topics/8491
4 years ago
Glenn Strauss 2769f19ad3 [mod_openssl] ssl.privkey directive (optional)
ssl.privkey can be used to specify path to file containing private key
in lieu of concatenating certificate and private key into single .pem
4 years ago
Glenn Strauss b17d3c2407 [mod_openssl] ALPN and acme-tls/1 (fixes #2931)
ssl.acme-tls-1 = "/path/to/dir" containing .crt.pem and .key.pem
named with the SNI name ("<SNI>.crt.pem" and "<SNI>.key.pem")

x-ref:
  "Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension"
  https://tools.ietf.org/html/rfc7301
  "ACME TLS ALPN Challenge Extension" (TLS-ALPN-01)
  https://tools.ietf.org/html/draft-ietf-acme-tls-alpn-05
  "Support for TLS-ALPN-01"
  https://redmine.lighttpd.net/issues/2931
4 years ago
Glenn Strauss cef6ee675d [core] limit con->uri.authority < 1024 octets
(expect < 256 octets for DNS name)

Since limit is imposed, can use buffer_clear() instead of buffer_reset()
for con->uri.authority and con->server_name.  (Also, con->uri.scheme is
limited to "http" and "https", so use buffer_clear() for it, too)
5 years ago
Glenn Strauss 88ee73d0a2 [multiple] perf: simplify chunkqueue_get_memory() 5 years ago
Glenn Strauss a1cda77f9b [mod_openssl] prefer using TLS_server_method()
prefer TLS_server_method() instead of SSLv23_server_method()
(SSLv23_server_method() is deprecated in openssl 1.1.0)
5 years ago
Glenn Strauss d182e90bb1 [mod_openssl] SSL_read before second SSL_shutdown
call SSL_read() before calling SSL_shutdown() a second time.

Drain SSL read buffers in case pending records need processing.

x-ref:
  "New session ticket breaks bidirectional shutdown of TLS 1.3 connection"
  https://github.com/openssl/openssl/issues/6262
  reported to lighttpd by intexk
  https://www.lighttpd.net/2018/10/14/1.4.51/
5 years ago
Glenn Strauss 89062d8134 [mod_openssl] move SSL_shutdown() to separate func
mod_openssl_close_notify()
5 years ago