Calendars and contacts (radicale)
Calendars and contacts on a Self Host Wizard box: the radicale piece, served at dav.<apps domain>, ldap sign-in, memory limit 77 MB.
At a glance
| Field | Value |
|---|---|
| Address | https://dav.<apps domain> |
| Sign-in | ldap: the app checks the office password against LLDAP itself |
| Memory limit | 77 MB (ram_mb: measured peak × 1.3) |
| Database | none shared: it keeps its own data in THX_DATA |
| Needs | lldap, authelia |
| Needed by | nothing |
| Containers | radicale |
Image: radicale | thx-local/radicale:3.9.2-1 (built on the box from pieces/radicale/files/image) |
| Behind sign-in | /web /web/* |
| Set-up script after start | scripts/post-up.sh, daily |
| Licence (from the README) | GPL-3.0-or-later |
| Upstream (from the README) | https://radicale.org |
Turn it on
thx enable adds radicale and everything it needs to the box's state; thx apply then installs it. Apps are applied only once site_domain is set.
sudo thx enable radicale
sudo thx apply
Engineering notes (pieces/radicale/README.md)
Served at https://dav.<apps_domain>. Phones and desktop clients (iOS/macOS
accounts, DAVx5, Thunderbird) log in with their LLDAP username and password;
Radicale checks them against LLDAP itself (auth = "ldap"), so Caddy only
proxies. The browser UI is at https://dav.<apps_domain>/web/ behind Authelia,
with no second password (see "Web UI").
- Upstream: Radicale 3.9.2, GPL-3.0-or-later. Its
Python dependencies (ldap3, vobject, …) are listed with their sha256 in
files/image/requirements.txt. - Image: built on the box from
files/image(composebuild:). See "Why a local build".
What users get
| Path | Who can | What |
|---|---|---|
/<uid>/calendar, /<uid>/contacts | that user only | created on first login (predefined_collections); they may add more |
/org-<org>/calendar, /org-<org>/contacts | members of LLDAP group org-<org> | read + write entries; cannot delete the collection |
/team-<org>-<team>/calendar, …/contacts | members of team-<org>-<team> | same |
post_up (scripts/post-up.sh → thx_sync.py) creates the shared collections
of every org-*/team-* group in LLDAP. It prints changed only when it
created something, and lists (on stderr) collections whose group is gone; it
never deletes data. Run it again after adding a group.
Access is decided by files/image/thx_rights.py, a Radicale rights plugin:
Radicale 3.9's from_file rights cannot say "members of the group named in the
path", only a fixed group list per rule, which would need a rule per group
written by thx. The plugin reads the groups Radicale's LDAP auth already
fetched (ldap_groups_attribute = memberOf). Removing a user from a team takes
effect within 60 s (cache_successful_logins_expiry).
Web UI: signed in by Authelia, no second password
[forward] paths = ["/web", "/web/*"]: Caddy runs forward_auth on those paths
only and passes Authelia's Remote-* headers. Everywhere else it strips them
and Radicale sees Basic auth as before.
files/image/thx_serve.pystarts Radicale withthx_auth.ThxApplication, which wraps Radicale's WSGI app:/web/…is the same server mounted atSCRIPT_NAME=/web.Remote-Usermust be a valid uid, or the answer is 401.- Its
Remote-Groupsgive the rights (org-*, team-*), exactly as LDAP'smemberOfwould. Authorizationand everyRemote-*header are removed before Radicale sees the request.- Outside
/webeveryRemote-*header is deleted, so they mean nothing there. /.web(Radicale's own UI path) redirects to/web/.web/.
thx_auth.Authextends Radicale's LDAP auth. A/webrequest carries a per-process random token that only the wrapper knows, and it is accepted only for the uid the wrapper set for that same request (thread-local). Any other password still goes to LDAP, so Basic for phones is unchanged.- The UI's login form is skipped: Radicale takes the external login first. The person's calendar and contacts are created on their first visit, as on their first Basic login.
Why a local build
Radicale publishes no image; tomsquest/docker-radicale lacks the ldap3
module that auth.type = ldap imports (spike A). The Dockerfile takes the
digest-pinned multi-arch python:3.13.18-alpine3.24 index and installs
hash-pinned, pure-Python (py3-none-any) wheels with --require-hashes. The
wheels are installed on the build machine's platform and copied into the
target stage, which runs nothing, so the arm64 image builds on an amd64 PC
without emulation. Proof (dev PC, amd64):
docker buildx build --platform linux/arm64 -t probe pieces/radicale/files/image # builds; image arch linux/arm64
docker export … | tar -t # site-packages + /app identical for amd64 and arm64 (2425 entries, no .so)
The image runs as uid 10082 after thx_boot.py has (as root, with only
CHOWN/DAC_OVERRIDE/SETUID/SETGID) given /data to that uid and written the
LDAP bind password from the environment to a tmpfs file
(ldap_secret_file), so it is never on disk.
Measured (dev PC, ./test.sh)
Throwaway LLDAP (acme: alice, bob in team sales, dave; globex: carol), post_up
twice (changed, then nothing), 26 CalDAV/CardDAV checks: personal calendars
private, team event seen and edited by a teammate, invisible to the rest of
the org and to the other company, shared collections not deletable, org
address book shared within the org only.
RAM: working set (anonymous + kernel + dirty pages, sampled every 0.1 s)
peaked at 57 MiB; ram_mb = mem_limit = 74 (57 × 1.3). A rerun at 74m passed, peaking at 60 MiB. memory.peak, which
also counts clean page cache, was 65 MiB; idle after the run 30 MiB.
With the web UI (mail lane, 2026-11-25), the working set peaked at 59 MiB
in two runs through post_up, test/web.py and the DAV checks. So
ram_mb = mem_limit = 77 (59 × 1.3).
test/web.py runs before the DAV checks (dave's first login is through the
web). It proves:
- 401 with no header, with Basic only, and with a malformed or unknown user.
- The UI is served. The PROPFIND it sends to
/web/gets 207. - Calendar and Contacts are created on the first visit.
- An event PUT through the browser path is visible over Basic.
- The same holds without
X-Forwarded-*. - Rights follow
Remote-Groups. - Basic is ignored on
/web, andRemote-*is ignored outside it. /.webredirects.
Mutations that make it fail (2026-11-25):
- No uid check in the wrapper: 200 without a header.
Remote-*not stripped outside/web, with auth reading the environment: a header on/was accepted.
Known gaps
- Shared calendars are not discovered automatically. Clients list
/<uid>/only; users addhttps://dav.<apps_domain>/team-<org>-<team>/calendar/by hand (or a profile does). Radicale 3.9's share-by-map feature could publish them into each home; not used yet, see the lane report. - A user whose uid starts with
org-orteam-would collide with group homes; thx_rights refuses them their own home. User creation should forbid such uids. - Team names are
team-<org>-<team>and org names may hold hyphens; collections are keyed by the full group name, so this is unambiguous here (it matters for drive and boards labels only).