About me: My name is Solène Rapenne, pronouns she/her. I like learning and sharing knowledge. Hobbies: '(BSD OpenBSD Qubes OS Lisp cmdline gaming security QubesOS internet-stuff). I love percent and lambda characters. OpenBSD developer solene@. No AI is involved in this blog.

Contact me: solene at dataswamp dot org or @solene@bsd.network (mastodon).

I'm a freelance OpenBSD, FreeBSD, Linux and Qubes OS consultant, this includes DevOps, DevSecOps, technical writing or documentation work. If you enjoy this blog, you can sponsor my open source work financially so I can write this blog and contribute to Free Software as my daily job.

Set up your own CalDAV and CardDAV servers on OpenBSD

Written by Solène, on 23 April 2023.
Tags: #caldav #carddav #openbsd #selfhosting

Comments on Fediverse/Mastodon

1. Introduction §

Calendar and contacts syncing, it's something I pushed away for too long, but when I've lost data on my phone and my contacts with it, setting up a local CalDAV/CardDAV server is the first thing I did.

Today, I'll like to show you how to set up the server radicale to have your own server.

Radicale official project page

Basically, CalDAV (for calendars and to-do lists) and CardDAV (for contacts) are exchange protocols to sync contacs and calendars between devices.

2. Setup §

On OpenBSD 7.3, the latest version of radicale is radicale 2, available as a package with all the service files required for a quick and efficient setup.

You can install radicale with the following command:

# pkg_add radicale

After installation, you will have to edit the file /etc/radicale/config in order to make a few changes. The syntax looks like INI files with sections between brakets and then key/values on separate lines.

For my setup, I made my radicale server to listen on the IP 10.42.42.42 and port 5232, and I chose to use htpasswd files encrypted in bcrypt to manage users. This was accomplished with the following piece of configuration:

[server]
hosts = 10.42.42.42:5232

[auth] 
type = htpasswd 
htpasswd_filename = /etc/radicale/users
htpasswd_encryption = bcrypt

After saving the changes, you need to generate the file /etc/radicale/users to add credentials and password in it, this is done using the command htpasswd.

In order to add the user solene to the file, use the following command:

# cd /etc/radicale
# htpaswd users solene
# chown _radicale /etc/radicale/users

Now everything is ready, you can enable radicale to run at boot, and start it now, using rcctl to manage the service like in:

# rcctl enable radicale
# rcctl start radicale

3. Managing calendars and contacts §

Now you should be able to reach radicale on the address it's listening, in my example it's http://10.42.42.42:5232/ and use your credentials to log in.

Then, just click on the link "Create new addressbook or calendar", and complete the form.

Back on the index, you will see each item managed by radicale and the URL to access it. When you will configure your devices to use CalDAV and CardDAV, you will need the crendentials and the URL.

4. Conclusion §

Radicale is very lightweight and super easy to configure, and I finally have a proper calendar synchronization on my computers and smartphone, which turned to be very practical.

5. Going further §

If you want to setup HTTPS for radicale, you can either use a certificate file and configure radicale to use it, or use a reverse http proxy such as nginx and handle the certificate there.