4008 Commits

Author SHA1 Message Date
Andrew Ruthven
4d06333f7e Drop the memcache only test, make the ldap+memcache test stage more comprehensive
The old memcache suite was gutted as it wasn't really much use and needed
LDAP to actually test auth caching correctly.
2024-05-27 09:46:12 +12:00
Andrew Ruthven
07c32697dd More testing of cached auth credentials
Test more scenarios, to make sure the cache is used or not used when
it should be.
2024-05-27 09:46:12 +12:00
Andrew Ruthven
d686ea4c3f Allow tests to dynamically set the DAViCal configuration 2024-05-27 09:46:12 +12:00
Andrew Ruthven
341707b045 Allow multiple curl requests per test file
This could still do with some more work to allow clearing previous settings,
it does now allow repeated URL lines per test file.
2024-05-03 23:35:26 +12:00
Andrew Ruthven
1077714a83 Make the log lines have consistent prefixes 2024-05-03 23:35:26 +12:00
Andrew Ruthven
af458f9d90 Remove default expiry times, make 0 disabled. 2024-05-03 23:35:26 +12:00
Andrew Ruthven
3c475a283c Switch to using hash_hmac, SHA256 and bcrypt for caching credentials
We also use a locally set password (aka a pepper) to ensure that the contents
of memcached isn't sufficient to perform dictionary attacks on the cached
credentials.
2024-05-03 23:35:26 +12:00
Andrew Ruthven
55feb03139 Include the username in the log messages. 2024-05-03 23:35:26 +12:00
Andrew Ruthven
ee26ee730f get can return the empty string, check for that.
While the credential checks were correctly failing when salt was the
empty string, it was giving confusing i.e., no log messages.
2024-05-03 23:35:26 +12:00
Andrew Ruthven
0b709c791d Fix the storing of cached credentials when an authentication hook is used.
Thank you LDAP tests for picking up this issue!
2024-05-03 23:35:26 +12:00
Andrew Ruthven
521594bc3f Add testing for LDAP with memcache 2024-05-03 23:35:25 +12:00
Andrew Ruthven
bd6a47bee6 Add tests for memcache 2024-05-03 23:34:43 +12:00
Andrew Ruthven
5826f5c3cf Cache password credentials received, and if they succeed or fail.
This is intended to reduce the load on external authentication sources
as most (all?) CalDAV clients use HTTPBasicAuth to authenticate and
if an external source is used, every request we receive requires
external authentication. This can place a large load on those external
sources.

Closes #254.
2024-05-03 23:34:42 +12:00
Andrew Ruthven
8f7da93a0d Return the Request ID if auth fails
Still only return it if in test_mode.
2024-05-03 23:33:25 +12:00
Andrew Ruthven
a02fffa4ca Ensure that request_id has no \r or \n characters. 2024-05-03 23:33:25 +12:00
Andrew Ruthven
87c3df891b Fix typo, remove sleep 60!! 2024-05-01 22:32:33 +12:00
Andrew Ruthven
fcbd72e310 Fix an exception if a LDAP group mentions a user that doesn't exist
This tickles a bug as reported by Thorsten Marquardt in
https://sourceforge.net/p/davical/mailman/message/58766531/ with this
error message reported:

    Exception [0] ldap_get_attributes(): Argument #2 ($entry) must be of
    type LDAP\ResultEntry, false given
    At line 718 of /usr/share/davical-master/inc/drivers_ldap.php

You need to look in 3da860e5d5e732c2dedb62a73c76608a2b7098a4 for that line
number as I've just made some improvements to the code the last few commits.
2024-05-01 22:32:33 +12:00
Andrew Ruthven
c273b38234 Test adding non-existant LDAP user to a group
This is to tickle my suspicion of the bug as reported by Thorsten Marquardt
in https://sourceforge.net/p/davical/mailman/message/58766531/ with this
error message reported:

Exception [0] ldap_get_attributes(): Argument #2 ($entry) must be of
type LDAP\ResultEntry, false given
At line 718 of /usr/share/davical-master/inc/drivers_ldap.php

You need to look in 3da860e5d5e732c2dedb62a73c76608a2b7098a4 for that line
number as I've just made some improvements to the code.

I have also improved the SQL to check if the users have been added, and
discovered that the result file *did not* have them. This test was failing
due to the test config file looking for memberUid, not member. Also, fix
that.
2024-05-01 22:32:33 +12:00
Andrew Ruthven
629789612e Prevent using undefined or non-existant variables 2024-05-01 22:32:33 +12:00
Andrew Ruthven
a50e3eae90 Be a bit more verbose in the logging 2024-05-01 22:32:33 +12:00
Andrew Ruthven
d2a93643bc Don't be afraid of whitespace 2024-05-01 22:32:33 +12:00
Andrew Ruthven
569b20d92f Allow tests to provide configuration over rides
Written to provide scope for Apache2 config overrides as well (I
think I'll need these to add Kerberos testing...)
2024-05-01 22:32:33 +12:00
Andrew Ruthven
3da860e5d5 ../awl isn't present in CI build, drop dep
Also drop dependency on dba/davical.sql as that is no longer checked
for the DB version.
2024-04-30 22:47:39 +12:00
Andrew Ruthven
24f6c8be18 Actually require AWL v0.65 2024-04-30 20:53:30 +12:00
Andrew Ruthven
e919bce20e Update so that git checkouts will work 2024-04-30 20:50:33 +12:00
Andrew Ruthven
4a64af43f8 Stop picking the DB version from dba/davical.sql as now we just use the patches 2024-04-30 20:50:16 +12:00
Andrew Ruthven
aa35bc6e6d Require the latest DB version 2024-04-30 20:39:14 +12:00
Andrew Ruthven
0c2bb61891 Add missing ChangeLog and CREDITS entries 2024-04-14 23:48:16 +12:00
Andrew Ruthven
2ce32a3ac7 Add info on how to use i_use_mode_kerberos 2024-04-14 23:12:40 +12:00
Andrew Ruthven
781ecff224 Update for stonewall's contribution 2024-04-14 22:42:18 +12:00
Stonewall Jackson
d3a0c89eca Retain original i_use_mode_kerberos behavior, add fallback option
Add a new value for i_use_mode_kerberos: "allow_fallback_ldap_auth",
which will fallback to username/password authentication when the
REMOTE_USER value is unset.
2024-04-10 14:25:23 -04:00
Stonewall Jackson
0ba94e91de Support fallback to LDAP password with i_use_mode_kerberos
Currently, when `i_use_mode_kerberos` is enabled in the LDAP driver,
Davical checks the `REMOTE_USER` server variable, followed by the
`REDIRECT_REMOTE_USER` variable, for a matching username. If a matching
username is not found, authentication fails immediately.

This commit modifies the LDAP driver to fallback to standard LDAP
password authentication when `i_use_mode_kerberos` is enabled and
neither of these server variables are set. This allows
non-kerberos-enabled clients to authenticate as well.

Fixes #323
2024-04-10 14:25:23 -04:00
Andrew Ruthven
786a9f5591 Remove the IMAP auth drivers
The PHP imap module is being retired. Closes #324.
2024-04-02 21:41:26 +13:00
Andrew Ruthven
e900dff28e If a URL test fails, display the Apache Request ID to aid debugging
This helps with #311.
2024-04-02 00:11:30 +13:00
Andrew Ruthven
7c47658bee Make the curl and SQL requests when we see them
This allows us to have more complex test files where an action is taken, then
we test something, then another action is taken, etc.

Changes to test files are required so that URL is defined after all the
required settings are set.

Changes to the result files are either whitespace changes due to above logic
changes, or printing out a SQL Result header before each result. I figured it
was useful.
2024-04-01 22:57:10 +13:00
Andrew Ruthven
7f2cccb94a Use isset when checking that the key exists
To resolve errors like this:

Warning:  Undefined array key "example.net" in /usr/share/davical/inc/iSchedule.php on line 207
2024-04-01 20:46:15 +13:00
Andrew Ruthven
901d82a293 Fix creation of dynamic properties
Add some properties to classes to fix errors like:

Creation of dynamic property iSchedule::$body_cannon is deprecated in /usr/share/davical/inc/iSchedule.php on line 533
Creation of dynamic property FakeSession::$user_active is deprecated in /usr/share/davical/inc/iSchedule-POST.php on line 23
2024-04-01 20:43:45 +13:00
Andrew Ruthven
452b9fa2ef regression-suite/2701-generate-date-tests.pl needs Perl modules
f
2024-04-01 20:29:20 +13:00
Andrew Ruthven
bdc65cc777 iSchedule tests now work, test in CI 2024-04-01 18:58:33 +13:00
Andrew Ruthven
d67c43790a Fix Free/Busy tests for iSchedule
We need to have some events in the time period being checked.

Note in the tests what they're trying to check.
2024-04-01 18:53:12 +13:00
Andrew Ruthven
c97a0719ff Slight wrapping change to lines in a test result, and now have ^M returned 2024-04-01 18:34:33 +13:00
Andrew Ruthven
7459a68b76 We need the sample data for tests for the test files to run 2024-04-01 18:34:33 +13:00
Andrew Ruthven
d2d36399d3 Create the Timezone if we need to
Detected now due to a change from a few years ago to use a clean database
for each set of tests.
2024-04-01 18:34:33 +13:00
Andrew Ruthven
ec9159fd69 Fix some warnings about using undefined keys, simplify dns strings
Fixes:
- PHP Warning:  Trying to access array offset on value of type null in inc/iSchedule.php on line 83
- PHP Warning:  Undefined array key "t" in inc/iSchedule.php on line 165
- PHP Warning:  Undefined array key "t" in inc/iSchedule.php on line 167
- PHP Warning:  Undefined array key "p" in inc/iSchedule.php on line 184

Concatenate the DNS entry we're going to look up once rather than everytime
we need it.
2024-04-01 18:34:33 +13:00
Andrew Ruthven
aaf89bed66 Trust the DKIM key used for ischedule tests 2024-03-30 20:10:41 +13:00
Andrew Ruthven
ba4c1eb989 Skip the "text/calendar" record, so we don't run code that expects "="
Prevents this warning:
  PHP Warning:  Undefined array key 1 in inc/iSchedule-POST.php on line 96
2024-03-30 20:08:14 +13:00
Andrew Ruthven
b26d48fced Put a trailing newline on error messages 2024-03-30 19:03:39 +13:00
Andrew Ruthven
0fc1abd976 Drop datetime check as minimum PHP version is 5.4 2024-03-11 00:41:39 +13:00
Andrew Ruthven
ee16fbf6af Update the translation PO files. 2024-03-11 00:41:39 +13:00
Andrew Ruthven
4e03cb1343 Include the request ID used in logging in the Fatal Error message. 2024-03-11 00:41:37 +13:00