package caldav

  1. Overview
  2. Docs
A CalDAV server


Dune Dependency






A CalDAV server (RFC 4791). Supports everything from the robur-coop/icalendar library. Also includes a partial WebDAV implementation.


org:mirage org:robur

Published: 03 Nov 2021


Live test server

A test caldav server is setup at, which is a unikernel pushing to our calendar git repository. Please try using "mirage" as user and password either on our test server which serves as well a CalDavZAP user interface or configure our test server in your calendar client ( You can choose any not-yet-used username and password, an account will be created by caldav (using the "trust on first use" argument described below).

Compilation of CalDAV server unikernel

To begin the installation, you need to ssh into your server. Then, you need to install opam via your package manager (e.g. apt install opam). Make sure you have OCaml version >=4.10.0, and opam version >=2.0.0 and mirage version >=3.7.1 installed via your package manager. You can use ocaml --version, opam --version, and mirage --version to find out.

In addition, you currently need our opam repository overlay because we need some libraries that are not yet released for git-via-ssh. It is recommended to use a custom opam switch:

opam switch create caldav 4.11.1
eval `opam env`
opam install lwt mirage

Now we're ready to compile the CalDAV server. Let's get the code:

git clone
cd caldav/mirage
mirage configure // -t xen / -t hvt works as well
make depend

The make command creates a caldav executable in caldav/mirage. This is the unikernel. If you compiled for unix (the default unless you specify -t xen/hvt/.., this is an executable you can run directly: We can see all its options:

./caldav --help

For other targets you have to create a virtual machine, e.g. solo5-hvt:

sudo solo5-hvt --net:service=tap100 -- caldav.hvt

CalDavZAP integration

CalDavZap is an externally developed web-UI for caldav servers. Embedding into this unikernel provides the web interface at

A minified and configured version can be obtained from here, which is based on the zip file and patch below.

Download (3936373 bytes, SHA256 1fb67a4f85c699bfd73f282407d60852f6649a34a923770ae2a378b4f2794dde) and unpack into mirage/caldavzap directory.

Edit mirage/caldavzap/config.js

diff -ur caldavzap/config.js mirage/caldavzap/config.js
--- a/config.js 2015-09-22 15:29:59.000000000 +0200
+++ b/config.js  2019-11-10 00:46:12.653501000 +0100
@@ -335,12 +335,11 @@
        href: location.protocol+'//'+location.hostname+
                (location.port ? ':'+location.port: '')+
-                location.pathname.replace(RegExp('/+[^/]+/*(index\.html)?$'),'')+
-               '/caldav.php/',
+               '/principals/',
        timeOut: 90000,
        lockTimeOut: 10000,
        checkContentType: true,
        settingsAccount: true,
-       delegation: true,
+       delegation: false,
        additionalResources: [],
        hrefLabel: null,
        forceReadOnly: null,

Running the unikernel

The following steps vary based on your desired server features.

HTTPS preparations

If you're planning to use https you need to create a certificate:

opam install certify
certify selfsign -c server.pem -k server.key ""
mv server.pem server.key caldav/mirage/tls/
cd caldav/mirage ; make

You can also copy an existing certificate and private key to that location.

First start

To start the server, we need a git remote (possibly with credentials) and an admin password, which will be used for the user root that always exists. The password needs to be set on first run only. It will then be hashed, salted and stored in the git repository. The git repository persists on disk when the unikernel is not running. It's the part with your precious user data that you might want to back up.

You have to set up a git repository and provide access to that, either using git_daemon and --enable=receive-pack (then everybody can push :/), or via https, or ssh with an RSA key. You can run awa_gen_key to get a seed (to be passed to the unikernel) and a public key (which you need to enable access to the git repository).

The arguments for the command line vary depending on the setup:

With HTTP server and git via TCP

--admin-password="somecoolpassword" --host="" --http=80 --remote=git://

With HTTPS server and git via https

--admin-password="somecoolpassword" --host="" --http=80 --https=443 --remote=

With HTTPS + trust on first use (tofu) and git via ssh:

--admin-password="somecoolpassword" --host="" --http=80 --https=443 --tofu --remote=ssh:// --seed=abcdef --authenticator=SHA256:b64-encoded-hash-of-server-key

Server administration

Create user

If you don't use trust on first use, you might want to create a new user:

curl -v -u root:somecoolpassword -X PUT ""

Update password

If someone forgot their password, root can set a new one:

curl -v -u root:somecoolpassword -X PUT ""

Delete user

If someone wants to leave, root can delete their account:

curl -v -u root:somecoolpassword -X DELETE ""

Create group

You might want to create a new group. Members is an optional query parameter.

curl -v -u root:somecoolpassword -X PUT ",viktor,carsten,else"

Update group members

You might want to update the members of a group. The members parameter will overwrite the existing group members. Be careful not to lose your groups.

curl -v -u root:somecoolpassword -X PUT ",viktor,carsten,else"

You might want to add a member to a group.

curl -v -u root:somecoolpassword -X PUT ""

You might want to remove a member from a group.

curl -v -u root:somecoolpassword -X DELETE ""

Delete group

You might want to delete a group. Root can do this.

curl -v -u root:somecoolpassword -X DELETE ""

Make calendar public

Make the private calendar TESTCALENDAR publicly readable for everybody, while keeping all privileges for the OWNER.

curl -v -u root:somecoolpassword -X PROPPATCH -d '<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:">
</D:propertyupdate>' ""

Make calendar private

Make the calendar TESTCALENDAR private, only accessible for the OWNER.

curl -v -u root:somecoolpassword -X PROPPATCH -d '<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:">
</D:propertyupdate>' ""

Vendored ocaml-webmachine

This project contains a vendored ocaml-webmachine (developed by Spiros Eliopoulos), using the webdav branch of in the ocaml-webmachine subdirectory (at commit fecaf3dfb9ce10821e86ca07e8bfe09afb1f73d0). The reason is because this version of webmachine has support for PROPFIND, PROPPATCH, REPORT HTTP verbs, as required by wedav. This is installed as caldav.webmachine sublibrary.

Dependencies (25)

  1. uri >= "4.0.0"
  2. dispatch >= "0.5.0"
  3. re >= "1.7.2"
  4. metrics
  5. hex >= "1.4.0"
  6. logs >= "0.6.3"
  7. ppx_sexp_conv >= "v0.12.0"
  8. sexplib >= "v0.12.0"
  9. icalendar >= "0.1.2"
  10. tyxml >= "4.3.0"
  11. xmlm >= "1.3.0"
  12. base64 >= "3.0.0"
  13. mirage-crypto-rng < "1.0.0"
  14. mirage-crypto < "1.0.0"
  15. cohttp-lwt >= "2.0.0"
  16. cohttp >= "2.0.0"
  17. ptime >= "0.8.5"
  18. lwt >= "4.0"
  19. ppx_deriving >= "4.3"
  20. mirage-random >= "2.0.0" & < "4.0.0"
  21. mirage-clock >= "2.0.0"
  22. mirage-kv >= "3.0.0" & < "6.0.0"
  23. fmt >= "0.8.7"
  24. dune >= "1.3"
  25. ocaml >= "4.08.0"

Dev Dependencies (7)

  1. cohttp-lwt-unix with-test & >= "2.0.0" & < "6.0.0~"
  2. mirage-kv-mem with-test & >= "2.0.0"
  3. mirage-clock-unix with-test & >= "2.0.0"
  4. tcpip with-test & >= "3.7.0"
  5. mirage-random-test with-test
  6. ounit with-test & >= "2.0.0"
  7. alcotest with-test & >= "0.8.5"

Used by


Conflicts (1)

  1. result < "1.5"

Innovation. Community. Security.