/etesync-dav

This is a CalDAV and CardDAV front-end for EteSync

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

This is a CalDAV and CardDAV front-end/proxy for EteSync.

GitHub tag PyPI Chat on freenode

This package provides a local CalDAV and CardDAV server that proxies requests to an EteSync server for use with desktop CalDAV and CardDAV clients.

If all you want is to access your data from a computer, you are probably better off using the web app.

This is essentially a compatibility layer between EteSync and DAV clients.

This depends on the radicale_storage_etesync module and the Radicale server for operation.

Note: This software is still in beta. It should work well and is used daily by many users, but there may be some rough edges.

Installation

pip install etesync-dav

The above should be either run as root, or better yet, inside a python "virtualenv".

Note: Python 3 is required.

Arch Linux

The package etesync-dav is available on AUR.

Docker

Run one time initial setup to persist the required configuration into a docker volume

docker run -it --rm -v etesync:/data etesync/etesync-dav setup

Run etesync-dav in a background docker container with configuration from previous step (this is the command you'd run every time)

docker run --name etesync-dav -d -v etesync:/data -p 37358:37358 --restart=always etesync/etesync-dav

Getting log output from container if you run into any issues

docker logs etesync-dav

Windows systems

You can either follow the Docker instructions above (get Docker here), or alternatively install Python3 for windows from here.

Python virtual environment (Linux and Mac)

Install virtual env from your package manager, for example on Arch:

pacman -S python-virtualenv

Set up the virtual env:

virtualenv venv
source venv/bin/activate
pip install etesync-dav

Run the etesync commands as explained in the "Configuration and running" section:

./venv/bin/etesync-dav-manage ...
./venv/bin/etesync-dav ...

Please note that you'll have to run source venv/bin/activate every time you'd like to run the EteSync commands.

Configuration and running

If you are self-hosting the EteSync server, you will need to set the ETESYNC_URL environment variable to the URL of your server. By default it uses the official EteSync server at https://api.etesync.com. The commands below all use this environment variable to determine which server to connect to.

You need to first add an EteSync user using etesync-dav-manage, for example:

etesync-dav-manage add me@etesync.com

On Windows systems, you may have to navigate to the location of the python script etesync-dav-manage.py (e.g. C:\Python\Python36\Scripts) and run

python etesync-dav-manage add me@etesync.com

Substitute “me@etesync.com” with the username or email you use with your EteSync account or self-hosted server.

and then run the server: etesync-dav

On Windows systems, you may have to navigate to the location of the etesync-dav.py script and run

python etesync-dav

Please note that some antivirus/internet security software may block the CalDAV/CardDAV service from running - make sure that etesync-dav is whitelisted.

After this, set up your CalDAV/CardDAV client to use the username and password you got from etesync-dav-manage, or alternatively run: etesync-dav-manage get me@etesync.com to get them again.

Depending on the client you use, the server path should either be:

  • http://localhost:37358/
  • http://localhost:37358/me@etesync.com/

On most clients this should automatically detect your collections (i.e. calendars and address books).

If your client does not automatically detect your collections, you will need to manually add them. You need to find the “collection URL” for each collection you want to add. Currently, the simplest way to do this is to log in to the web interface provided by the internal Radicale server. Just open http://localhost:37358/ in your browser (or substitute “localhost” for the hostname or IP address of the etesync-dav instance). Then you will need to log in using the username and password given by the etesync-dav-manage tool as described above (run etesync-dav-manage get me@etesync.com to get them again). The Radicale web interface shows the collections with their names and URLs. You can just copy and paste the URLs into your client. You will most likely also need to manually copy and paste the collection names as well, and select a color manually.

Alternative ways to get collection URLs include programmatically using the pyetesync module (see example.py for example usage), or copy it from the debug page in the EteSync Android app. When using example.py, the EteSync server address that should be used is https://api.etesync.com when interacting with the production server.

Config files

etesync-dav stores data in the directory specified by the CONFIG_DIR environment variable. This includes a database, credentials, and Radicale configuration file. This directory is not relocatable, so if you change CONFIG_DIR you will need to regenerate these files (which means reconfiguring clients). It may be possible to manually edit these files to the new path. Note that the database will just mirror the content of your main EteSync database so in most cases you should not lose anything if you delete it.

CONFIG_DIR defaults to a subdirectory of the appropriate config directory for your platform (~/.config/etesync-dav on Unix/Linux, see appdirs module docs for where it will be on other platforms).

Client support

The following clients have been tested:

  • Thunderbird
    • CardDAV: Works.
      • Notes: requires the CardBook add-on, path should include the username as above, and vCard version should be set to v4.0 when prompted
    • CalDAV: Only works when providing full collection path.
  • OSX
    • CalDAV: Works. Setup instructions:
      • Internet Accounts->Add Other Account->CalDAV account
      • Account Type: Advanced
      • Username: me@etesync.com
      • Password: generated etesync-dav password
      • Server Address: localhost
      • Server Path: /
      • Port: 37358
      • Uncheck Use SSL (does nothing under macOS Mojave, SSL is always enabled)
    • CardDAV: Works. Setup instructions:
      • Internet Accounts->Add Other Account->CardDAV account
      • Account Type: Manual
      • Username: me@etesync.com
      • Password: generated etesync-dav password
      • Server Address: http://localhost:37358/ (under macOS Mojave: https://localhost:37358/)

macOS Mojave

macOS Mojave enforces the use of SSL, regardless of whether you enable the checkbox for SSL or not. So to use EteSync, you have to enable SSL. You can do so by following these steps:

Go to the configuration directory of EteSync DAV:

cd ~/Library/Application\ Support/etesync-dav

Create a self-signed SSL certificate:

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 1825 -nodes -subj '/CN=localhost'

(This creates a certificate that expires in 5 years.)

Tell macOS to trust this certificate for SSL connections:

    security import cert.pem    
    security add-trusted-cert -p ssl cert.pem     

If this fails, open the Keychain application and import the certificate there. Remember to also trust it for SSL connections.

Edit radicale.conf (in the same directory) and add the following lines in the [server] section:

    ssl = yes
    certificate = <your home directory>/Library/Application Support/etesync-dav/cert.pem
    key = <your home directory>/Library/Application Support/etesync-dav/key.pem

Restart etesync-dav

Configure CardDAV and CalDAV as described above.

Known issues

  • This package is missing startups script for automatic execution on startup.