Home
Title: Set up your own CalDAV and CardDAV servers on OpenBSD Author: Solène Date: 23 April 2023 Tags: caldav carddav openbsd selfhosting Description: In this tutorial, you will learn how to install radicale on OpenBSD to self host your own calendar and contacts server # 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. HTML 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. # 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: ```shell # 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: ```ini [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: ```shell # 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 ``` # 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. # 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. # 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.