Monday, July 22, 2024

Defining a user for Sabre Dav (calendar)

Sabre is an open-source calendar server. It is well written and moderately powerful, being used by Nextcloud open-source groupware. However, setting up a Sabre calendar server is not that easy. As the documentation says, there is no web interface for creating users. Instead, it advises that you create them directly in the database. According to the instructions you need to:

  1. Add an entry to the users table, specifying the user name and the digest of the password (it is pretty unclear what to do for this)
  2. Add a corresponding entry to the principals table -- but no details are given

Looking at the two tables in question, users has three columns: id, username and digesta1. The first is the primary key and doesn't need to be set. The second and third columns are varbinary. that is, you specify them as hexidecimal strings preceded by '0x' and they will be defined and displayed in that form.

The principals table has id, uri, email and displayname columns. displayname is text, uri and email are varbinary. It is pretty simple if you know SQL to add entries to the princpals table. I'll concentrate on the format of the digesta1. According to the php source code it is an md5 hash of a string of the format:

username:realm:password

There is one user already defined: admin user. It is unclear what the realm is set to. Stepping through the debugger I discovered that it is set by default to SabreDAV. I tried creating the hash using md5sum on the commandline, but this didn't give the correct answer. You need to create it using the php function md5. Once I generated it that way, and plugged in the value to the digesta1 column of the users table I could login using my own password.

Stick a file with this content on your web-server and it will print out the digesta1 field value for the user username with password foobar:

<?php
echo('hash='.md5('username:SabreDAV:foobar'));
?>

Tuesday, February 20, 2024

Upgrading Ubuntu 22.04 to 24.04

The latest version of Ubuntu Noble Numbat is coming, and many will be tempted to upgrade as advised on the ask-ubuntu site. I would warn anyone trying to do this to hold off for now. Although Noble Numbat itself is getting there, only a fresh install of 24.04 works for now. Currently on 21 February 2024 using sudo do-release-upgrade -d will likely brick your machine. I've tried the upgrade on several different models (all Lenovo) with fresh installs of Ubuntu 22.04 upgraded to the latest versions of everything and the do-release-upgrade -d crashes either at tracker-extract or, if you manage to disable it, at networkd-dispatcher. The machine freezes during the upgrade and can't be reused after that. I had to copy all my files off onto an external drive and reinstall everything. The strange thing is they had the same problem with 20.04->22.04, but somehow they fixed it. I wait for the corresponding update for 22.04->24.04.

Update 4 April 2024: Now sudo do-release-upgrade -d does nothing. It says "There is no development version of an LTS available". So it looks like they are preventing people from running the upgrade while it is known to be broken, but haven't fixed it yet.

Update 17 April 2024: sudo do-release-upgrade -d is back! I tried this on a clean install of 22.04, fully upgraded, rebooted, and ran the do-release-upgrade -d. It welcomes you to Ubuntu 24.04, but still fails. The laptop is still bricked and is unusable after that. The crash file in /var/crash says it was in netplan.script. So I guess this is still a library incompatibility between 22.04 and 24.04, related to networking.

Update 30 April 2024: Upgrading in two steps, from 22.04 to 23.10 using sudo do-release upgrade then once that upgrade is complete, you can upgrade to 24.04 using sudo do-release-upgrade -d. Even though the process got stuck a couple of times on one model of laptop, after retsrting it was possible to pick up where the installer had left off and so the laptop was not ruined. In the other cases, the dual upgrade went smoothly, but took about an hour overall.

Thursday, February 15, 2024

Replace Firefox snap with non-snap version in Ubuntu

One of the problems with the snap package of Firefox is that it can't communicate with programs outside of its snap such as Keepassxc. Also if you don't like the idea of using the self-contained enviroments that snaps implement, and would prefer your applications to live together inside a single OS with its installed libraries rather than duplicating them inside each snap, then replacing the default Firefox snap in Ubuntu may appeal. I'm appending a script I wrote for Ubuntu 22.04, which also works for Ubuntu 24.04. It achives a few things:

  1. Deletes Firefox snap
  2. Installs Mozilla's latest Firefox binary
  3. Sets up apt so that it prefers Mozilla Firefox over snap Firefox when updating packages
  4. Adjusts apparmor to allow external programs like Keepassxc to communicate with Firefox