TaskWarrior on Android

TaskWarrior is my tool of choice to manage my list of next actions. I like it because the data is as open as it can be: it is stored as plain-text, there are many different tools to access it and TaskWarrior itself is open source. To access the same data on different devices, an easy solution is, to just copy the TaskWarrior database over to the other devices. Software like OwnCloud, Dropbox or Super Flexible File Synchronizer (this is not a recommendation) can help automate the process. With the configuration variable data.location one can control, which folder TaskWarrior uses to read and write the data and as long as you don't go crazy and execute TaskWarrior faster then you sync, everything works quite well (in case you end up with conflicts you could always use the merge command and hope for the best).

A very important use case, that was not easy to cover with this was my smartphone: My solution always was, to SSH to a server, where TaskWarrior is installed and use it there. But since I seem to be one of very very few people in the world, that would prefer a hardware QWERTY keyboard on their smartphone, there are no decent options, that make SSH user friendly enough to use it on a daily basis (yes, I tried stuff like this but quickly ran out of hands to handle it on the bus).

Finally, Konstantin Vorobyev took pity and wrote a TaskWarrior app for the Android Platform! He made the awesome design choice to not read and parse the database himself but package the TaskWarrior binary with his app and just build a GUI around it. So one should expect pretty similar behavior and it should have also reduced development time immensely (or in other words: freed up time for stuff, that can be of better use then reimplementing TaskWarrior in Java).

The app uses the synchronization integrated into TaskWarrior to synchronize with servers running the "Taskserver" taskd developed by the same people and described as "a lightweight, secure server providing multi-user, multi-client access to task data" on their website. I run a small virtualized home server and set up a dedicated Debian installation for Taskserver. The idea was, that all my devices (including my phone) can synchronize with this server, when I am connected to my home network. TaskWarrior can be used to synchronize with such a server with the command task sync and the Android app has a refresh button (and probably does it regularly). The most recent version of taskd as of this writing is 1.1.0 and its installation went quite smoothly (I felt adventurous and decided to go for "Option 3: Install from git"). Taskserver uses client side certificates for authentication, but if you follow the installation instructions carefully, you shouldn't need a deep understanding of PKIs and certificates. One should pay attention to the hostname CN, but I'll come back to this in a minute.

The first hurdle was my Windows system and the fact, that the installed version TaskWarrior (2.5.0) was not compiled with TLS support. Pulling the source and doing cmake, make, make didn't work because some function definition was missing from some header file. Passing -DHAVE_GET_CURRENT_DIR_NAME=0 to the cmake call did the trick (it was sheer luck, that I stumbled upon the correct line of C code and noticed the preprocessor macro). Running task diagnostic | grep tls now tells me, that I use libgnutls in version 3.3.17.

Now let's come back to the server name: The hostname of the virtual server is office. If you choose localhost as a server name (which is totally stupid and I have no idea, who might even try this *cough*), taskd doesn't bind to the correct network interface and is only reachable from the machine itself. Choosing office as the CN and in all configuration variables (note, that the values need to be exactly the same for the TaskWarrior client task and the Taskserver taskd), it binds to the address 127.0.1.1 (sic) which seems to be just another notion of localhost and still is not reachable from the network. Using office.fritz.box finally did the trick. The whole process took some time because you need the generate all keys and certificates (for both server and clients) again. Unrelated side note: you have to restart taskd after changing certificates.

The following commands are your friends while debugging:
* netstat tulpen | grep 53589
* nmap -sS -O -p53589 office
* taskd config debug.tls 3

You need 4 things to authenticate at the server:
* server certificate ca.cert.pem
* client side certificate first_last.cert.pem
* client key file first_last.key.pem
* UUID of the user

After setting the following configuration variables correctly, task sync worked for me (and is pretty fast):

taskd.certificate=/path/to/first_last.cert.pem
taskd.key=/path/to/first_last.key.pem
taskd.ca=/path/to/ca.cert.pem
taskd.server=office.fritz.box:53589
taskd.credentials=OrgName/first_last/01234567-89abc-cdef-0123-456789abcdef

TaskWarrior now also tells you, when you need to execute the sync.

The configuration page of the Android App for TaskWarrior was pretty useful. A small remark to save your time: The recommended way of placing the necessary files in the profile folder works perfectly, but you should *not* place them in the data directory underneath the profile folder but in the profile folder directly.

Good luck and @TaskWarrior: thanks for all the fish!

Leave a Reply

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