fedops blog

Privacy in Computing

Tue 30 August 2022

Selfhosted Calendaring

Posted by fedops in Software   

I've avoided delving into the calendaring topic for a long while. It seemed a hassle and also I wasn't sure how to best integrate work and private calendars. I don't have very many private appointments anyway, and the ones I do have should ideally also block out the respective times in my work calendar so people don't book me for a meeting when I'm at the dentist or something. So I just put my private things into the work calendar, with details obfuscated, and that worked fine.

Syncing appointments or even just accessing them via a private device wasn't acceptable but I had found Outlook - Google Calendar Sync which worked from my work laptop but only to and from a Google calendar. So when I tossed that out I was left without a working sync. With an upcoming job change and no idea what they will be doing for calendering I finally decided to set up a private solution.

Software

There are essentially 3 parts to it. First, a server side that maintains one or more calendars and serves as the "source of truth" for the contents.

Second, a way to synchronize multiple parties into and out of it, like my primary laptop, the smartphone, and eventually also the work calendar. All of these should be two-way syncs with the server holding the sum of everything.

And third, calendar applications on all devices. There are lots of choices on the phone and I didn't want to be tied into any specific one. Likewise on the desktop. So I really wanted a separate sync client and calendar frontend if possible.

Here's an overview of the concept:

overview

Server

After a bit of research and looking into Baïkal (nice UI, but requires a web server with PHP to run) and Xandikos (written in python, but requires uWSGI to run) I decided to give radicale a try1. The feature list looked very promising:

  • Shares calendars and contact lists through CalDAV, CardDAV and HTTP.
  • Supports events, todos, journal entries and business cards.
  • Works out-of-the-box, no complicated setup or configuration required.
  • Can limit access by authentication.
  • Can secure connections with TLS.
  • Works with many CalDAV and CardDAV clients.
  • Stores all data on the file system in a simple folder structure.
  • Can be extended with plugins.
  • Is GPLv3-licensed free software.

Installation was straightforward using pip3 and the "Simple 5-minute Setup" in the excellent documentation was all that was needed to get up and running. My VPS is still running CentOS 7, the systemd of which does not support Dbus access for user units, so I ended up following the systemwide setup suggestions and it works just fine. The only negative thing is individual users do not have raw file system access to their calenders without some manual fixes, but that's not a big deal.

Everything works exactly as it says on the tin. I specifically like that the calendar files can be checked into a Git repo automatically so that's the backup and version control taken care of right away. Nice!

As usual the calendar server's port is only opened on the Wireguard tunnel interface so access from non-VPN devices is impossible, as it should be.

Synchronization

Being standards-compliant there is a plethora of syncing software that can be used.

On the phone I'm using DAVx5 from F-Droid which presents the calendars to the Android system, and then every calendar app can be used as the frontend.

On the Linux desktop side vdirsyncer is a very customizable middleware which works great with radicale and will hopefully also sync with work's setup, whatever that may turn out to be. Update later this year.

Vdirsyncer stores the .ics files in a local directory structure so there are enough possibilities to make use of that in scripts without having to go through the complexities of talking to a CalDAV server.

Clients

On the phone one option is Etar but as mentioned there's another new one every month to try out. There is little risk of losing anything while "calendar-hopping" as the appointments are not stored in the app itself.

For Linux I had already found khal from pimutils a while ago which looked very nice. I like that it has a mode to display a calendar exactly like cal does, just with your appointments added in a column on the right.

More normal people would probably use Thunderbird or other GUI apps, but again - as long as it speaks CalDAV it'll probably work.

Loose Ends

One topic I haven't yet looked into is contacts handling. I understand it should be possible to use CardDAV in a similar fashion to CalDAV for calendaring, but for it to be worthwhile I need to find a way to sync with my Alpine address book also. That will probably be a bespoke script or maybe khard could be used, we'll see. I'll update this article when I get to it.


  1. not implying those two or indeed others aren't at least as good, it's just what I looked at and liked. radicale does have an extremely limited UI which I don't need but which might be considered a downside by others.