Geuni/ April 28, 2020/ Englisch/ 0 comments

In the article “Store your data at home, e.g. on a NAS!” I explained how to, among other things. Now you can bring your contacts and calendar from the cloud to your own living room.

1) What is our goal?

I want to store my contacts and calendars at my home. From there I also synchronize them to all my devices.

2) What are our requirements?

We want to:

  • store contacts and calendars locally and centrally,
  • automatically synchronize these contacts and calendars on our smartphones,
  • automatically synchronize the contacts and calendars in our email clients,
  • transfer the data securely over the Internet (we will not do that in this article! Have at look at the articles about ReversProxy).

3) What do we need to save contacts and calendars?

Technically, contacts or Address books stored in the so-called *.vcf form, calendar in the *.ics form (among others). Both formats are from the so-called “Internal Engineering Task Force (IETF)” and have been discussed as “Request for Comment (RFC)” and defined as standard (RFC vCard, RFC ICS) . This data is transmitted by means of the HTTP protocol. It can be secured by TLS in transport (who now does not know what HTTP and TLS is. Just look in the last article, there it will be explained again). The server that performs these functions is called the CardDav/CalDav Server. CardDav is for contacts, CalDav for calendar.

With this information we can now google what is possible in our example with a Qnap NAS.

4) CardDav (contacts) and/or CalDav (calendar) for Qnap?

After a little research, I found that Qnap has its own app called QContactz. I tried it and found that this is a solution of its own. It does not manage to integrate on my smartphone with the usual address books. So the solution for me had died directly.

All further searches in the Qnap app store were in vain. I haven’t found anything that provides me with a CalDav or CardDav server. So I had to find another solution.

When I googled, I came across an alternative app store for Qnap, the Qnap Club Store.

5) Qnap Club offers Radicale for contacts and calendars

First, we install the Qnap Club Store on our NAS. It’s quite simple. In the Qnap app store in the upper right corner of the gear icon, then click on the gear icon in the “App Archive” tab to enter a new “Archive” “Add” the following URL:

Qnap App Center with app archive how to add another app store
Qnap App Center with app archive how to add another app store

If you’ve done that, it should look like the picture. We close this dialog and see on the left in the navigation of the store another icon. It has the name we have given to the Qnap Club Store. After we can browse the Qnap-Club Store, let’s look for the app “Radicale”. This is a small open source CalDav/CardDav server which we call the so-called QPackage.

Qnap Club Radicale App
Qnap Club Radicale App

Once the installation of Radicale is complete. We can go into the configuration of Radicale in the app store by clicking on “Open”.

6) Configure Radicals via the UI on the LAN

When Radicale is installed, we open it and land on a separate page that should look like this. Now comes something that’s weird.
No matter which name you enter, with or without a password, you always get into the next window with “Next”.

Radicale Login Dialog
Radicale Login Dialog
Radicale Admin UI In the context of a user
Radicale Admin UI In the context of a user

So you actually create an account with typing and clicking on “Next”. Unless it already exists, then you end up in the account. Unfortunately, this is the default configuration for the Radicale QPKG in the Qnap Club. This can be changed in radicale-config. It is located under “/share/CACHEDEV1_DATA/.qpkg/Radicale/config” (I’m not going to go into it here, because we’ll build a reverse proxy later and then work with the Auth-type “HTTP_X_Remote_User”).

Small recommendation: If you want to use Radicale in this way, you should at least set the Auth-Type in the Config to “Authenticated”. Then the username and password should be required to go into an account! The next dialog, when you have created something, usually looks like this:

I have Radicale in use and secured it differently and we come to this in another post (keyword: ReverseProxy). We could deal with Radicale now, it also allows a configuration that behaves differently. So the software is not bad, but we will only change the Auth type later and do everything further via a ReverseProxy. This has, among other things, to do something that we will build up a few more services later on and therefore centralized management of some aspects is easier to view via a ReverseProxy.

7) DavDroid for Android for Syncronizing – installation

Now let’s start using our set-up Cal/Card-Dav server. Android is very simple. Download the DavDroid app.

Davx5 im Google Play Store
Davx5 im Google Play Store

In the Play Store, the app costs €3.99, and in the alternative F-Droid Store, DavDroiod is free. How to install the F-Droid Store (from the Play Store), I don’t explain here, just that it’s an alternative app store that focuses on open source applications.

DAVx5 (ehm. Davdroid) in the alternative Android App Store F-Droid
DAVx5 (ehm. Davdroid) in the alternative Android App Store F-Droid

Once you have the app, you can start setting it up.

7) DavDroid for Android for Syncronizing – configuration

Just start the app, then you should see a blank image and at the bottom right a large “+” icon. Then click on it and select the option “Sign in with URL and user name”:

Davx5 Einrichtungsdialog
Davx5 Einrichtungsdialog
Davx5 setting during setup whether contact groups are displayed as maps
Davx5 setting during setup whether contact groups are displayed as maps

Now we have to get on with it bit by bit. Important for this, distinction, LAN and WAN. Above I have a screenshot of Radicale, where I went to the NAS via internal IP and then started via the admin UI Radicale.

According to this, the blackened at the top of the picture is an internal IP. If our smartphone is now in the home Wi-Fi, then we will take the LAN for a test. Therefore, you enter in the field “Base URL” (above in the picture), exactly what is as a link in the image above radicale, e.g. “http://IP/name/”. So we leave an ID e.g. from calendar, because Radicale, automatically recognizes all created calendars or address books behind the user. If you have entered everything correctly, the next dialog will be followed, where you will choose whether groups are vCards or categories of contacts. I am in the longer weaning second option.

Press “Create Account”, the account should be created and you can now choose whether this is the synchronization of contacts or calendars or both.

Click on the sync icon at the top right of the image, it should go through properly and no error message should appear as a notification. If it really worked, you can now see that you start the Contacts app, go to the Contact Manager on the top right of the three points and then check under “Account Contacts” if an address book of Davx5 appears similar to the picture below.

Davx5 account is created and we see the selection
Davx5 account is created and we see the selection

In my example, the screenshots on my OnePlus 5T were taken in OxygenOS. If you have another Android smartphone, don’t be surprised if the pictures are yours. slightly different or the navigation descriptions are not 100% applicable to you, this may vary.

Select Android default address book in the settings
Select Android default address book in the settings

Now we can create a new contact and select that it should be created in the new Davx5 address book. If necessary. If you are now looking for the default selection on your smartphone when you create a new contact, then all new contacts will always be stored directly in the correct address book.

Keep in mind that there is no active push for updates. For example, if you Calendar or contacts shared with other people, DavDroid would update the change on your device only after a defined period of time. Providers such as Google offer a little more comfort here and can “push” directly at changes so that all devices are always up-to-date! The feature can be self-made, e.g. with Z-Push, but I haven’t finished that myself yet!

Since no one now has any desire to transfer all his contacts on the smartphone by hand to another address book, one has to solve this a little differently in the end, I still describe the example of G-Mail.

8) Card/CalDav Synchronizer for Outlook – installation

I take Outlook as a desktop example because I use Outlook at work and also at home. Unfortunately, Outlook does not provide an interface for Card/CalDav. This may be because Outlook is primarily designed as a client for Exchange, but that’s just a guess.

I had searched and found a few tools, but unfortunately many add-ons for Outlook are either no longer in development or are only available for older versions. The addon “Caldavsynchroniser” is the only thing I have found that is currently being further developed and working, so I took it first.

So download the addon, install it and it pops up directly in the ribbons of Outlook.

8) Card/CalDav Synchronizer for Outlook – configuration

Now we start the “Synchronization Profiles” via the ribbon “CalDav Synchronizer” and then select “Generic CalDav/CardDav” and then get to the overview of how to configure the profile.

Display of the Outlook ribbons as configured by the CalDav Synchronizer add-on.
Display of the Outlook ribbons as configured by the CalDav Synchronizer add-on.

Now we can define a name. Then we select an Outlook folder that is freely selectable, as you like it best. Then dav URL simply comes in the URL already described above and used on Android, as well as username and password (which is still pointless). Here you should make sure that a calendar from Radicale is synchronized into a calendar folder of Outlook and the same with contacts, because Outlook differentiates the type of folders and how to handle them.

CalDavSynchronizer Add-On in Outlook when setting up a profile to synchronize data
CalDavSynchronizer Add-On in Outlook when setting up a profile to synchronize data

When this is done, you should be able to synchronize your calendars and/or contacts accordingly. Two profiles must be created here, one for calendars and one for contacts. A simple cross-test would now create a contact in Outlook and then view it on your smartphone.

If you’re trying to implement this in Outlook, don’t despair, because it’s a bit of fumbling until you’ve really got everything so that it’s acceptable and easy to use in Outlook.

9) CardDav and CalDav on iPhones

My wife has an iPhone and because we have a shared calendar, I’ve seen how to set it up on iOS. Well, quite simple. Go to the settings under “Mail, Contacts, Calendar” -> “Add Account” -> “Other” -> Select “CardDav” or “CalDav” and specify the data from just done. It was really quicker and better than expected. I even save myself any picture.

10) Migration of contacts to the local address book

Basically, this is quite simple, if we already have the above setup completely through, because we only have to export the contacts and calendars from GMail and e.g. via Outlook to the correct folder that is being synchronized, insert again (this can be done by drag-and-drop) and all data has already been migrated. I hope that this little description is enough.

11) Edit contacts in WebUi when you’re on the go and don’t fancy your smart phone? Bad luck?

Unfortunately, I haven’t found a client that is web-based to edit contacts or calendars online in the browser. There are always these functions as Suit, e.g. in a mail client such as Roundcube. I always thought I’d have this use case, but I have to honestly say that the frequency where I work in large numbers of contacts is rare and can then wait. I don’t have to do this on my phone and I haven’t been involved with it any more.

12) Disadvantages of the solution?

The solution described above has some weaknesses. Obviously, we are currently using HTTP without TLS as a transmission type, which is not good, because in theory everyone could read it along. Furthermore, the solution is not really portable in my opinion. I.e. I can’t just take my application and put it where else and run, I think it’s better with a Docker solution, but we’ll be pretty late. Furthermore, we don’t have a backup at the moment!

We can easily fix the security issues with a ReverseProxy. We can simply include an SSL certificate there, so we have at least a certain security (this can also be done in Radicale, i have to be fair!).

13) Conclusion

In summary, we have now suspended a CalDav/CardDav server, connected several clients to the server and migrated our old contacts to the new system. Unfortunately, we have found that the solution is not really safe and that we therefore still need to work on it.

14) Outlook

We build a ReverseProxy! In my case, using Apache and as a Docker. To do this, we take a look at how this works with Let’s Encrypt and how we combine all of this, as well as connect our existing services directly and consume them uniformly safely on the Internet!

Share this Post

Leave a Comment

Your email address will not be published. Required fields are marked *