• last updated 6 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Stronger password hashes for OpenACS

This change introduces the possibility to use either the classical

OpenACS password hash algorithm "salted-sha1" or the SCRAM passord

function "scram-sha-256". The latter can be used by (a) using the

most recent version of NaviServer (from Sept 28, 2021 or newer) and

(b) by configuring the password hash preferences via Kernel package

parameter "PasswordHashAlgorithm". The package parameter can contain a

list of multiple hash algorithms in preference order. The most

preferred available algorithm is chosen.

By default, the "PasswordHashAlgorithm" is "salted-sha1", and the

behavior is as before. After upgrading to the new version of acs-tcl

and acs-kernel, the preference list can be configured. When a user

logs in and the preferred available algorithm is different from the

previously used algorithm, the upgrade is performed for the user

automatically.

The usage of SHA1 in OpenACS is easily target of security audits (see

[1]). The biggest danger is that if somebody gets full access to the

"users" table (e.g. when decommissioning a hard disk). In this case

the hashes can be attacked with dictionaries by using some crypto

hardware (when someone gets raw access to the DB, one has usually some

other big problems). However, by using the "scram-sha-256" hash

function this danger is substantially reduced. This function computes

a password hash using PBKDF2 (Password-Based Key Derivation Function

2). This function is used to reduce vulnerabilities of brute-force

attacks against password hashes. The hash function of SCRAM is PBKDF2

[RFC2898] with HMAC as the pseudorandom function (PRF) and with dkLen

== output length of HMAC == output length of the digest function. So,

it uses a better hash algorithm (sha-256 vs. sha1) and applies this a

high number of times (15K times for a password hash computation).

NaviServer supports as well the even better SCRYPT algorithm, but this

is only available when NaviServer is compiled with OpenSSL 3.0 or

newer. On the contrary, scram-sha-256 (actually PKCS5_PBKDF2_HMAC) is

available since OpenSSL 1.0.0 (2015).

All the improved hash functions require NaviServer with its tight

integration to the crypto functions of OpenSSL.

[1] https://openacs.org/forums/message-view?message_id=5522562

  1. … 6 more files in changeset.
Mark 'sec_get_random_cached_token_id' as public, as it is used in 'acs-subsite'

Improve robustness over invalid configurations

Previouly, the configuration of invalid hostnames (i.e. hostnames,

which cannot be resolved via the OS means) for a network driver

lead to runtime errors under certain conditions.

Make api public, complies with acs-api-browser.graph__bad_calls automated test

  1. … 2 more files in changeset.
remove protection "private", since function has to be called from other packages

  1. … 6 more files in changeset.
mark functions called only internally as private

  1. … 15 more files in changeset.
improve comment

avoid array notation for per_thread caches to ease flushing

  1. … 5 more files in changeset.
make call more robust in case "location" is not provided via config file

use 'self' for "security::csp::require object-src" instead of 'none' since the latter is non-incremental

Fix acs-tcl.logout_from_everywhere test case and support again invalidating of all existing user logins, useful e.g. to make sure no device still holds a valid login when we change our password on a device

Don't rely on configured "location" value of driver, since this does not work for virtual hosting

Instead, get the "host", "port" and "defaultport" directly from "ns_driver info" when available

"ns_driver info" has no key "host", but "address" (which might be multiple addresses)

avoid burst cache hits by using nsvs instead of ns_cache for secret token caching

The problem with the prevision version was that ns_cache has no equivalent

to nsv_array to get in an atomic fashion all key value pairs from the cache.

thefore, for the per-thread caching, a tight loop was used processing

the result of ns_cache_keys. If this was necessary in a high number of

threads, higher lock times were possible (~100ms). The new version

should not face this problem.

Prefer 'namespace which' over 'info commands', as it is faster (on local tests, around 2x) and returns a single value. Many thanks to Nathan Coulter.

  1. … 58 more files in changeset.
Convert content of host header field to lower case, since domain names are case insensitive

improve warning message in case invalid characters are passed in

whitespace changes

relax default samesite setting for login and session cookies to lax

This change was made because otherwise the "keep me logged in"

is often lost, e.g. also with toplevel navigation requests

(e.g. when navigating to the site via Google)

improve spelling

  1. … 16 more files in changeset.
prefer "ns_conn isconnected" over "ad_conn isconnected", since the latter might not notice changes in the connect state

  1. … 18 more files in changeset.
improve spelling: move closer to the linux documentation recommendations

  1. … 34 more files in changeset.
report peeraddr and URL in warning, add comment

fine tuing for ad_log vs ns_log

don't depend on the node-id cache, which is only available, when xotcl-core is loaded

  1. … 4 more files in changeset.
acs::per_request_cache: standardize per-request caching

- added per-request cache verfsy similar to acs::per_thread_cache

- use per-request-cache on several occasions

- bump version number of acs-tcl to 5.10.0d35

  1. … 9 more files in changeset.
fix typos

  1. … 1 more file in changeset.
move ad_get_host_node_map and security-locations-host-names from db_cache_pool to partitioned cache

  1. … 3 more files in changeset.
update comments concering CSP "report-to" directive

remove useless semicolon