Baikal – own calendar with ToDo list (CalDav) and address book (CardDav)

Using own CalDav and CardDav server can help you with creating private platform to synchronize event and contacts between multiply devices and other services like webmails.

First let us download latest baikal version from http://baikal-server.com/  to /var/www/dav.example.com

wget http://baikal-server.com/get/baikal-regular-0.2.7.tgz

Next extract it

tar zxvf baikal-regular-0.2.7.tgz

Move files to destination ex. /var/www/dav.example.com

mv baikal-regular /var/www/dav.example.com

Create vhost config file for Apache

# vim /etc/apache2/sites-available/dav.example.com.conf 
<VirtualHost *:80>
    DocumentRoot /var/www/dav.example.com/html
    ServerName dav.example.com

    RewriteEngine On
    RewriteRule /.well-known/carddav /card.php [R,L]
    RewriteRule /.well-known/caldav /cal.php [R,L]

    <Directory "/var/www/dav.example.com/html">
        Options None
        Options +FollowSymlinks
        AllowOverride All
    </Directory>
</VirtualHost>

or you could use more advance config file that use SSL (razem z Let’sEncrypt) + php5_fastcgi :

# php5_fastcgi + ssl baikal config file
<Directory /var/www/dav.example.com>
        AllowOverride None
        Require all denied
</Directory>

<VirtualHost *:80>
        ServerName dav.example.com
        Redirect permanent / https://dav.example.com/
</VirtualHost>

<IfModule mod_ssl.c>
        <VirtualHost ip_address:443>
                ServerAdmin webmaster@example.com
                ServerName dav.example.com:443
                DocumentRoot /var/www/dav.example.com/html/
                ErrorLog /var/www/dav.example.com/logs/error.log
                CustomLog /var/www/dav.example.com/logs/access.log combined

                RewriteEngine On
                RewriteRule /.well-known/carddav /dav.php [R,L]
                RewriteRule /.well-known/caldav /dav.php [R,L]

                SSLEngine on
                SSLCertificateFile      /etc/letsencrypt/live/dav.example.com/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/dav.example.com/privkey.pem

                <Directory "/var/www/dav.example.com/html">
                        Options None
                        Options +FollowSymlinks
                        AllowOverride All
                </Directory>

                <FilesMatch ".(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

                BrowserMatch "MSIE [2-6]" 
                                nokeepalive ssl-unclean-shutdown 
                                downgrade-1.0 force-response-1.0
                # MSIE 7 and newer should be able to use keepalive
                BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

                <IfModule mod_fastcgi.c>
                        AddType application/x-httpd-fastphp5 .php
                        Action application/x-httpd-fastphp5 /php5-fcgi
                        Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi_dav.example.com
                        FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi_dav.example.com -socket /var/run/php5-fpm_dav.example.com.sock -pass-header Authorization
                 </IfModule>
        </VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Now we enable required apache modules and restart it:

a2enmod rewrite
a2ensite dav.example.com
service apache2 restart

Let us change files ownership (depending on what user runs Apache default would be ex. www-data):

chown www-data:www-data -R /var/www/dav.example.com

Create file so baikal will enable installation panel:

touch /var/www/dav.example.com/Specific/ENABLE_INSTALL

Depending which vhost file we use we enter baikal via web browser

http://dav.example.com
#or
https://dav.example.com

On first page setup everything the way you like, and on the next one you will be able to configure database backend, so you can pick sqlite or mysql/mariadb.

 

So now we go up and running dav platform for you private data.

 

Updating:

Even if you use latest version from page, I would suggest update it to newest one from git page

For example currently the newest on git is 0.4.2 baikal version.

It is recommended to make backup of your database if you started already to use baikal.

Download newest baikal to same directory where you install the 0.2.7 version:

wget https://github.com/fruux/Baikal/releases/download/0.4.2/baikal-0.4.2.zip

Extract it

unzip baikal-0.4.2.zip

Change ownership for extracted baikal and move every file outside excluding  ‘Specific‘ folder.

Enter administration panel ex. dav.example.com and you will see warning like this:

Upgrading Baïkal from version 0.2.7 to version 0.4.2

After login in baikal will update the database and you will be ready to use it once again.

 

Difference between 0.2.x and 0.4.x is in URL we tend to use card.php and cal.php are now  dav.php, and both still works but are deprecated so eventually they will stop working. I recommended to use dav.php.

Good practice would also be adding DNS record:

_caldavs._tcp.example.com. IN SRV 0 5 443 dav.example.com.
_carddavs._tcp.example.com. IN SRV 0 5 443 dav.example.com.

This way autodiscover function when setting up account on your device will find your proper configuration faster.

 

Example use:

Thunderbird:

#CalDav
https://dav.example.com/dav.php/calendars/__user__/default

 

Thunderbird + Cardbook

Add address book > Remote

Type: CardDav 
URL: https://dav.example.com/dav.php/addressbooks/__user__/default/

Username: user
Password: password

Validate > Next

 

Android + DavDroid:

Pre-emptive authentication: Off

 

Leave a Reply

Your email address will not be published.

*