summaryrefslogtreecommitdiff
path: root/src/mod_auth.c
Commit message (Collapse)AuthorAgeFilesLines
...
* [mod_auth] "nonce_secret" option to validate nonce (fixes #2976)Glenn Strauss2020-07-081-62/+123
| | | | | | | | | | | | "nonce_secret" option to validate nonce was generated by the server Marginally hardens HTTP Digest Auth. Necessary piece, but not sufficient, to restrict re-use of nonce (mitigations for replay or limiting nonce count reuse via nc=... are not implemented) x-ref: "Digest auth nonces are not validated" https://redmine.lighttpd.net/issues/2976
* [multiple] split con, request (very large change)Glenn Strauss2020-07-081-87/+87
| | | | | | | | | | | | | | | | 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().
* [multiple] copy small struct instead of memcpy()Glenn Strauss2020-07-081-1/+2
| | | | when patching config
* [core] store subrequest_handler instead of modeGlenn Strauss2020-07-081-6/+6
| | | | store pointer to module in handler_module instead of con->mode id
* [core] move addtl request-specific struct membersGlenn Strauss2020-07-081-4/+4
|
* [core] move keep_alive flag into request_stGlenn Strauss2020-07-081-3/+3
|
* [multiple] generic config array type checkingGlenn Strauss2020-07-081-9/+2
|
* [multiple] reduce direct use of srv->errhGlenn Strauss2020-07-081-21/+21
|
* [multiple] extern log_epoch_secsGlenn Strauss2020-07-081-2/+2
| | | | replace srv->cur_ts
* [multiple] reduce direct use of srv->cur_tsGlenn Strauss2020-07-081-5/+8
|
* [multiple] plugin_stats arrayGlenn Strauss2020-07-081-12/+15
| | | | | | | 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)
* [multiple] connection hooks no longer get (srv *)Glenn Strauss2020-07-081-2/+1
| | | | (explicit (server *) not passed; available in con->srv)
* [multiple] prefer (connection *) to (srv *)Glenn Strauss2020-07-081-110/+119
| | | | | | | | 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)
* [core] array_init() arg for initial sizeGlenn Strauss2020-07-081-1/+1
|
* [mod_auth] inline arrays in http_auth_require_tGlenn Strauss2020-07-081-5/+5
| | | | also, keep ptr to const buffer *realm rather than copy
* [multiple] plugin.c handles common FREE_FUNC codeGlenn Strauss2020-07-081-13/+2
| | | | (simpler for modules; less boilerplate to cut-n-paste)
* [mod_auth*] use config_plugin_values_init()Glenn Strauss2020-07-081-125/+141
|
* [core] const char *name in struct pluginGlenn Strauss2020-05-231-3/+1
| | | | | | | | put void *data (always used) as first member of struct plugin add int nconfig member to PLUGIN_DATA calloc() inits p->data to NULL
* [core] simpler config_check_cond()Glenn Strauss2020-05-231-3/+2
| | | | | | | optimize for common case where condition has been evaluated for the request and a cached result exists (also: begin isolating data_config)
* [core] inline array as part of data_array valueGlenn Strauss2020-02-241-9/+9
| | | | (instead of value being (array *))
* [core] add const to callers of http_header_*_get()Glenn Strauss2020-02-241-4/+4
| | | | (The few places where value is modified in-place were not made const)
* [core] inline buffer as part of data_string valueGlenn Strauss2020-02-241-4/+4
| | | | (instead of value being (buffer *))
* [core] inline buffer key for *_patch_connection()Glenn Strauss2020-02-241-3/+3
| | | | | handle buffer key as part of DATA_UNSET in *_patch_connection() (instead of key being (buffer *))
* [core] inline buffer as part of DATA_UNSET keyGlenn Strauss2020-02-241-9/+8
| | | | (instead of key being (buffer *))
* [core] differentiate array_get_* for ro and rwGlenn Strauss2020-02-241-2/+2
| | | | | | 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)
* [core] remove unused array_reset()Glenn Strauss2020-02-241-1/+0
|
* [mod_auth] close connection after bad passwordGlenn Strauss2020-01-261-0/+3
| | | | | | | | mitigation slows down brute force password attacks x-ref: "Possible feature: authentication brute force hardening" https://redmine.lighttpd.net/boards/3/topics/8885
* [mod_auth] http_auth_const_time_memeq() (#2975, #2976)Glenn Strauss2019-09-081-1/+1
| | | | | | | | | | | | | use constant time comparison when comparing digests (mitigation for brute-force timing attacks against digests generated using the same nonce) x-ref: "Digest auth nonces are not validated" https://redmine.lighttpd.net/issues/2976 "safe_memcmp new function proposal" https://redmine.lighttpd.net/issues/2975
* [mod_auth] Authentication-Info: nextnonce=...Glenn Strauss2019-09-081-1/+33
| | | | send Authentication-Info nextnonce when nonce is approaching expiration
* [mod_auth] require digest uri= match original URIGlenn Strauss2019-09-081-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lighttpd requires a strict match between the request URI and the uri= auth-param provided in the Authenticate header. lighttpd does not attempt to determine if different URIs are semantically equivalent. This commit removes a condition which permitted an Authenticate header with a uri= containing a query-string to be used with the request-uri which did not contain any query-string. The condition was likely added in the original implementation which operated on lighttpd request.uri instead of the correct request.orig_uri (original URI sent to lighttpd). . HTTP Digest Access Authentication https://www.rfc-editor.org/rfc/rfc7616.txt 3.4.6. Various Considerations The authenticating server MUST assure that the resource designated by the "uri" parameter is the same as the resource specified in the Request-Line; if they are not, the server SHOULD return a 400 Bad Request error. (Since this may be a symptom of an attack, server implementers may want to consider logging such errors.) The purpose of duplicating information from the request URL in this field is to deal with the possibility that an intermediate proxy may alter the client's Request-Line. This altered (but presumably semantically equivalent) request would not result in the same digest as that calculated by the client. x-ref: "HTTP Digest Access Authentication" https://www.rfc-editor.org/rfc/rfc7616.txt "HTTP digest authentication not compatible with some clients" https://redmine.lighttpd.net/issues/2974
* [mod_auth] do not use quoted-string for algorithmGlenn Strauss2019-09-081-2/+2
| | | | | | | | | | | | https://www.rfc-editor.org/rfc/rfc7616.txt 3.3. The WWW-Authenticate Response Header Field ... For historical reasons, a sender MUST only generate the quoted string syntax values for the following parameters: realm, domain, nonce, opaque, and qop. For historical reasons, a sender MUST NOT generate the quoted string syntax values for the following parameters: stale and algorithm.
* [core] use buffer_eq_icase_ssn funcGlenn Strauss2019-06-061-2/+2
| | | | | | | | | specialized buffer_eq_icase_ssn func replace strncasecmp() in cases where string lengths are not known to be at least as large as the len being compared case-insensitively. (Separate commit in case any future changes modify the implementation to be unsafe for shorter strings, where strncasecmp() would stop at '\0' in either string)
* [multiple] replace strcasecmp() on short stringsGlenn Strauss2019-06-061-4/+4
|
* [multiple] cleaner calloc use in SETDEFAULTS_FUNCMohammed Sadiq2019-04-201-1/+1
| | | | | | | | github: closes #99 x-ref: "cleaner calloc use in SETDEFAULTS_FUNC" https://github.com/lighttpd/lighttpd1.4/pull/99
* [mod_auth] HTTP Auth Digest algorithm=SHA-256Glenn Strauss2019-03-071-107/+384
| | | | | | | | | | | | | | | (also support Digest algorithm=SHA-512-256 if library support present) enable additional algorithms by configuring lighttpd.conf auth.require with new optional keyword "algorithm" => "MD5|SHA-256" default algorithm remains MD5 if "algorithm" not specified Tested with: curl --digest -u "user:pass" ... (which supports SHA-256) x-ref: "HTTP Digest Access Authentication" https://tools.ietf.org/html/rfc7616
* [mod_auth] pass http_auth_require_t for 401 UnauthGlenn Strauss2019-03-071-10/+10
| | | | | pass (http_auth_require_t *) to mod_auth_send_401_unauthorized_digest() for configured digest algorithms for 401 Unauthorized
* [mod_auth] http_auth_info_t digest abstractionGlenn Strauss2019-03-071-4/+12
|
* [mod_auth] minor: adjust config validationGlenn Strauss2019-02-101-1/+1
| | | | | | | x-ref: "PVS-Studio Analysis Results" https://redmine.lighttpd.net/boards/3/topics/8459 http://www.fly-server.ru/pvs-studio/lighttpd/
* [core] prefer buffer_append_string_len()Glenn Strauss2018-09-231-1/+1
| | | | | prefer buffer_append_string_len() when string len is known (instead of buffer_append_string() which will recalculate strlen)
* [core] more memory-efficient fn table for data_*Glenn Strauss2018-09-231-6/+9
| | | | | | save 40 bytes (64-bit), or 16 bytes (32-bit) per data_* element at the cost of going through indirect function pointer to execute methods. At runtime, the reset() method is most used among them.
* [multiple] code reuse: using array_*() funcsGlenn Strauss2018-09-231-9/+6
|
* [multiple] code reuse: employ array_match_*()Glenn Strauss2018-09-231-15/+7
|
* [mod_auth] send 401 for mismatch HTTP auth scheme (fixes #2906)Glenn Strauss2018-09-231-2/+2
| | | | | | x-ref: "Lighttpd responds with 400 not 401" https://redmine.lighttpd.net/issues/2906
* [core] abstraction layer for HTTP header manipGlenn Strauss2018-09-231-20/+19
| | | | | | http_header.[ch] convert existing calls to manip request/response headers convert existing calls to manip environment array (often header-related)
* [core] some header cleanupGlenn Strauss2018-04-081-0/+1
| | | | | | | | | provide standard types in first.h instead of base.h provide lighttpd types in base_decls.h instead of settings.h reduce headers exposed by headers for core data structures do not expose <pcre.h> or <stdlib.h> in headers move stat_cache_entry to stat_cache.h reduce use of "server.h" and "base.h" in headers
* [mod_auth] check that digest realm matches configGlenn Strauss2018-03-111-0/+7
|
* [core] adjust li_rand_pseudo* interfacesGlenn Strauss2017-09-201-1/+1
|
* [core] attempt to quiet coverity false positivesGlenn Strauss2017-08-121-9/+10
|
* [core] attempt to quiet coverity false positivesGlenn Strauss2017-08-121-0/+10
|
* [mod_auth] Digest nonce on system with time <=1978Glenn Strauss2017-03-131-1/+1
| | | | | | | On systems with time prior to Jul 4 1978 21:24:15, the hex string of the timestamp is fewer than 8 chars. (thx daveoman)