1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-10-03 21:20:45 +00:00
Commit graph

2157 commits

Author SHA1 Message Date
Peter Bieringer
120fbb7328 Fix: out-of-range timestamp on 32-bit systems 2025-10-01 20:36:12 +02:00
Peter Marschall
2d9830fb6a LDAP auth: add my Copyright to radicale/auth/ldap.py 2025-09-29 20:17:16 +02:00
Peter Marschall
f0626a8dde LDAP auth: change 'ldap_ssl_verify_mode' to NONE for ldapi://
For ldapi:// connections, which connect - by definition - to a local UNIX
socket, lower the value of config setting 'ldap_ssl_verify_mode' to "NONE"
to avoid certificate validation failures.
The UNIX socket address can NEVER match any DNS name from a certificate,
making the whole certificate validation moot.

This is a workaround for a limitation of Python's LDAP modules, that do not
consider this edge case.
2025-09-29 20:15:33 +02:00
Peter Marschall
bcba53ed8d LDAP auth: re-factor handling of 'ldap_ssl_verify_mode'
* treat 'ldap_ssl_verify_mode' as string
* perform check for accepted values; fail on illegal ones
* translate to the values nbeeded by the respective LDAP module
  when doing the login, based on a module specific dictionary
2025-09-29 20:15:33 +02:00
Peter Marschall
7df4c070e1 LDAP auth: fail on illegal values for config settings
Thr config settings 'ldap_security' and 'ldap_ssl_verify_mode' only
accept a specific set of values: fail if other values are provided.
2025-09-29 20:15:33 +02:00
Peter Marschall
b6ee3b6991 LDAP auth: align values when logging config options
In addition, log 'ldap_ssl_verify_mode' and 'ldap_ssl_ca_file' unconditionally.
2025-09-29 20:15:33 +02:00
Peter Marschall
44c64d70f5 LDAP auth: _login2: re-bind as user within same connection
Python's ldap module, which is modelled along OpenLDAP's API, allows us to
keep the connection and doing a new bind as a different user, superseding
the previous bind.
Use this to simplify the code and avoid duplication.
2025-09-29 20:15:33 +02:00
Peter Marschall
2d7a9b001c LDAP auth: support TLS & start_tls also with python-ldap
Until now, every connection to the LDAP server was silently unencryptedr
when using Python's ldap module instead of the ldap3 module.
I.e. using Python's ldap module was inherently insecure, as there was not
even a hint that the config settings for encryption were ignored.

This commit changes this and brings LDAP authentication based on the ldap
module feature-wise on par with the one based on the ldap3 module.
2025-09-29 20:15:33 +02:00
Peter Marschall
f8b15eb122 LDAP auth: get rid of helper property '_use_encryption'
Inferring 'ldap_security' in earlier commits, allows us to get rid of
the helper property '_use_encryption', streamlining the code.
2025-09-29 20:15:33 +02:00
Peter Marschall
b21549b998 LDAP auth: warn if 'ldap_ssl_ca_file' is set without LDAP encryption 2025-09-29 20:15:33 +02:00
Peter Marschall
73b77defe4 LDAP auth: warn on unset ldap_ssl_ca_file when certificate verification is wanted 2025-09-29 20:15:33 +02:00
Peter Marschall
c58eef4bac LDAP auth: infer 'ldap_security = tls' from the URL prefix: ldaps:// => LDAPS
LDAP URIs starting with the scheme 'ldaps' are - by definition - meant to use
LDAPS instead of plain LDAP: infer 'ldap_security' = "tls" if it is not set.
2025-09-29 20:15:33 +02:00
Peter Marschall
7eb0c66512 LDAP auth: refactor dealing with 'ldap_use_ssl'
* stop treating it as class property
* refactor to consolidate logic into one big 'if' statement
  (for easier removal when the config option gets removed in the future)
* make deprecation warning for 'ldap_use_ssl' more urgent
* raise error if conflicting settings 'ldap_security' = "starttls" and
  'ldap_use_ssl' = True are set together
* if not set, infer  'ldap_security' = "tls" from 'ldap_use_ssl' = True,
  logging  a warning for the admin to update the config
2025-09-29 20:15:33 +02:00
Peter Marschall
caab7d3712 LDAP auth: load SSL/TLS config unconditionally
Currently it is not used by _login2(), but it does not hurt to have it
available.
It is a preparation for supporting encrypted connections in _login2().
2025-09-29 20:15:33 +02:00
Peter Bieringer
d83f9fe29d extend copyright related to https://github.com/Kozea/Radicale/pull/1883 2025-09-26 07:53:28 +02:00
Peter Marschall
5f89d18df6 LDAP auth: move evaluation of quirk for Authentik where it belongs
The evaluation of the quirk for the Authentik LDAP server changes the behaviour
of Python's `ldap3` module, and that module only.
Evaluating the quirk in `__init__` which is used for both, `ldap` and `ldap3`
is thus wrong, and may lead to errors when this setting is used together with
the `ldap` module.

Signed-off-by: Peter Marschall <peter@adpm.de>
2025-09-25 18:09:43 +02:00
Peter Bieringer
63b160c2b0 move evaluation of quirk for Authentik where it belongs, superseeds https://github.com/Kozea/Radicale/pull/1877 2025-09-25 15:29:04 +02:00
Peter Bieringer
7604d44701 make flake8 happy 2025-09-24 21:36:33 +02:00
Peter Bieringer
2899c677c1 revert improper PR#1839, finally fix #1812 and #1880 2025-09-24 21:31:27 +02:00
Peter Bieringer
77e7745f93 make mypy happy 2025-09-24 21:30:06 +02:00
Peter Bieringer
ec9ef124ff add new test cases for #1880 and #1812 2025-09-24 21:17:37 +02:00
Peter Bieringer
d1679a53b1 new test items 2025-09-24 21:17:13 +02:00
Peter Bieringer
b46916fca9 fix according to https://github.com/Kozea/Radicale/issues/1878#issue-3438629348 2025-09-24 06:35:27 +02:00
Johannes Berg
256ca59aaf auth: clean up remote IP parameter/documentation
Make the remote IP parameter more generic and make it an enum
determining the source instead of a boolean. Also fix the
changelog entry.

Both as requested, I managed to miss those comments previously.
2025-09-09 20:25:49 +02:00
Johannes Berg
b5a1ea911d auth: dovecot: pass remote IP (rip=) to auth server
If known, let the auth server know where the client came
from, using REMOTE_ADDR or, optionally/configurably, the
X-Remote-Addr header value (which is needed when running
behind a trusted proxy.)

Addresses #1859.
2025-09-09 12:10:00 +02:00
Peter Marschall
57a4d8d47d LDAP auth: update, consolidate & extend documentation 2025-09-08 22:01:13 +02:00
Peter Marschall
9eb9556536 LDAP auth: decode UTF-8 byte sequences to strings only if necessary 2025-09-07 15:05:47 +02:00
Peter Marschall
cde4c5f2e8 LDAP auth: stop giving type hints for local list variables 2025-09-07 14:44:03 +02:00
Peter Marschall
9b216a9f24 LDAP auth: define fallback value for _use_encryption 2025-09-07 11:38:08 +02:00
Peter Marschall
5c4a0578b0 LDAP auth: fix _login2() by importing ldap.filter 2025-09-07 11:38:08 +02:00
Peter Marschall
5a183e3c2b LDAP auth: make flake8 happy
"fix" small lint to keep flake8 happy.
2025-09-07 11:38:08 +02:00
Peter Marschall
5f677fc77e LDAP auth: document all paramters at the top of the file 2025-09-07 11:38:08 +02:00
Peter Marschall
8821612fa8 LDAP auth: allow finding groups based on separate search
Instead of searching for the membership attribute on the user side
(usually AD: memberOf, Novell eDirectory: groupMembership) to determine
the groups the user loging on is a member of, allow performing a separate
search for the groups having the user as member and use the found groups' DNs.

The group search is performed in the context of 'ldap_reader_dn', after
the user DN has been found in the directory, but before the authentication
has been performed by doing an LDAP bind in the user's context.

Although this may - in the case of unsuccessful login attempts -
double the number of queries to the LDAP server, it has been done
this way to keep the number of LDAP contexts minimal.

Doing the group search in the context of the user logging on is no viable
option, because there are known implementations where regular users do not
have the necessary permissions to query the groups they are a member in.
2025-09-07 11:38:08 +02:00
Peter Bieringer
ca3fd9a3ff Improve: user/group retrievement for running service and directories 2025-09-01 20:31:23 +02:00
David Fernandez Alcoba
550f522e9d Fix broken start when UID does not exist 2025-08-29 13:00:23 +02:00
Peter Bieringer
6d3cd8146f fix lint issue related to 9d5772901d 2025-08-24 10:14:28 +02:00
Jochen Sprickerhof
5f7f410310
Fix acquire_lock interface signature
See multifilesystem/lock.py and different calls.
2025-08-23 20:59:37 +02:00
Peter Bieringer
9d5772901d run rabbitmq tests only if module pika is available 2025-08-23 07:29:45 +02:00
Peter Bieringer
8e4447e95b conditional log level for base_prefix strip action 2025-08-22 08:49:24 +02:00
Peter Bieringer
7f28f69452 extend test for items having tzinfo only on dtstart or dtend set for whatever reason, overtake tzinfo from the other one 2025-08-22 07:51:15 +02:00
Peter Bieringer
2a808fd373 test items having tzinfo only on dtstart or dtend set for whatever reason 2025-08-22 07:50:47 +02:00
Peter Bieringer
e1b19f1a22 catch items having tzinfo only on dtstart or dtend set for whatever reason, overtake tzinfo from the other one 2025-08-22 07:49:54 +02:00
Peter Bieringer
74d21f011c enrich for optional tzinfo 2025-08-22 07:49:09 +02:00
Peter Bieringer
c74ac9c225
Merge pull request #1829 from nwithan8/email
Improve email notification hook by determining event update type
2025-08-22 06:15:55 +02:00
Nate Harris
998b2e2121 - Fix unit tests for hook email trigger conditional based on end date 2025-08-21 00:21:11 -06:00
Georgiy
7ce41aee37 (#1845) Fix expanded item copying 2025-08-17 20:06:37 +03:00
Nate Harris
9b6ba72fa0 - Fix dryrun property 2025-08-14 00:10:16 -06:00
Nate Harris
f32e50bc9d - Add unit tests to confirm emails not triggered when adding/deleting event with past end date 2025-08-14 00:06:55 -06:00
Nate Harris
208dd22a42 - Do not send notifications if end time is more than 1 minute in the past (buffer) 2025-08-13 23:46:26 -06:00
Nate Harris
74bc78aac4 - Linting 2025-08-13 23:46:26 -06:00