• last updated 14 mins ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
New feature: cookie namespaces

So far, all OpenACS versions used "ad_" as a prefix for cookies (such

as ad_login, ad_session_id, ...). In certain situations this can lead

to confusion, since cookies are managed by browsers via domain names,

and running multiple OpenACS instances in the same domain will cause

overwriting of such cookies by these instances. The can happen e.g.

when running multiple instances on the same machine, or using

port-forwarding to virtual machines/containers, using reverse proxies,

etc. Note that the cookie overwriting problem does not exist for

host-node-mapped subsites, since host-node-mapping depends on domain

names.

One could consider using the port in the cookie name (as

sometimes noted as an option), but this would not work, in case the

same server should be reachable over multiple ports.

Therefore, one can now specify a "CookieNamespace" in the OpenACS

configuration file, which is per default "ad_", which is sufficient

for the majority of installations. In cases, where it is needed, a

different CookieNamespace can now be configured.

To manage the cookie names internally, OpenACS provides a new API call

security::cookie_name to derive the namespaced cookie name from a stem.

Snippet of the OpenACS configuration file for setting the CookieNamespace

#---------------------------------------------------------------------

# OpenACS specific settings (per server)

#---------------------------------------------------------------------

ns_section ns/server/${server}/acs {

ns_param CookieNamespace "ad_"

...

}

  1. … 2 more files in changeset.
check that provided signature is a list, otherwise lassign will fail afterwards

improve spelling

  1. … 2 more files in changeset.
improve comment

align to the usual naming convention (use "_not_cached" suffix)

added comments and portlets locations for default ports

security::locations: return configured servers from the driver/servers section

additionally, improve caching

  1. … 1 more file in changeset.
improve spelling

added support for SCRYPT (RFC 7914) as password hash function.

The use of scrypt requires NaviServer compiled with OpenSSL 3.0 or newer

  1. … 1 more file in changeset.
stick to the original names with the "-" since this is also the naming convention outside of OpenACS (e.g. "scram-sha-256")

  1. … 7 more files in changeset.
Complete reform introduced in https://cvs.openacs.org/changelog/OpenACS?cs=oacs-5-10%3Agustafn%3A20210928124647

- add datamodel change to the creation script

- refactor algorithm names in a way that the new procs will comply with acs-tcl.naming__proc_naming automated test

  1. … 6 more files in changeset.
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)