Love Locks at Pont des Arts

Dev

Access alternate certificates with acme4j

On January 11 2021, Let's Encrypt will change the default intermediate certificate from the cross-sign IdenTrust DST Root X3 certificate to their own ISRG Root X1 certificate.

The good news: The ISRG certificate is widely trusted by browsers by now, so the transition will be unnoticed by most users.

The bad news: The ISRG certificate is not included in Android devices before "Nougat" 7.1. These devices will show an error when trying to access sites that are signed with the new intermediate certificate. According to Let's Encrypt, stunning 34% of the Android devices out there shall be affected.

To mitigate the problem, Let's Encrypt provides an alternate certificate that is still cross-signed with the IdenTrust DST Root X3 certificate. If you have a web service that is accessed by a relevant number of older Android devices, you may want to use that alternate certificate. It will be available until September 29 2021. The IdenTrust DST Root X3 certificate itself will expire after that date, so this is a hard limit. Let's hope that the problem is going to be solved on Android side in time.

As acme4j fully implements the RFC 8555, it is easy to change your code so it will use the alternate certificate. Based on the acme4j example, this code block will use the first alternate certificate if present, and falls back to the main certificate if not:

Certificate certificate = order.getCertificate();
certificate = certificate.getAlternateCertificates().stream()
        .findFirst()
        .orElse(certificate);

Remember to remove the workaround after September 29 2021 January 2024, so you won't accidentally use other alternate certificates that may become available in the future.

PS: getAlternateCertificates() was added to the latest acme4j v2.11. If you have an older version, fear not: you just need to have a Login object, so you can bind the alternate certificate yourself. This is how it would look like in the example client:

Login login = session.login(acct.getLocation(), userKeyPair);

Certificate certificate = order.getCertificate();
certificate = certificate.getAlternates().stream()
        .map(login::bindCertificate)
        .findFirst()
        .orElse(certificate);

UPDATE: Let's Encrypt found a way to extend the Android compatibility until January 2024. However, this extension may only work for Android devices. To quote the article:

The new cross-sign will be somewhat novel because it extends beyond the expiration of DST Root CA X3. This solution works because Android intentionally does not enforce the expiration dates of certificates used as trust anchors.

Special: Festplatten richtig löschen

Tagebücher und private Fotos, persönliche E-Mails, Bankverbindungen und Kreditkartennummern, Passwörter… Oft sind wir uns gar nicht bewusst, was für persönliche und geheime Informationen unsere Festplatten gespeichert haben. Nehmen wir uns nur mal als Beispiel das Cookie, durch das wir uns nicht mehr im Onlineshop anzumelden brauchen, oder all die Passwörter, die der Passwort-Manager des Browsers bequemerweise für uns gespeichert hat.

So gibt es immer wieder Aufsehen erregende Berichte über Computer oder Festplatten mit höchst vertraulichem Inhalt, welche gebraucht verkauft wurden, ohne vorher ausreichend gelöscht worden zu sein. Ein anderes, etwas amüsanteres Beispiel stammt von dem Käufer eines gebrauchten Notebooks, welches sich als defekt herausstellte. Da der Verkäufer nicht bereit war, das Geld zurückzugeben, veröffentlichte der Betrogene aus Rache allerlei private und delikate Details, die er auf der Festplatte des Notebooks vorfand.

Trotzdem kann es vorkommen, dass man Festplatten in fremde Hände gibt, weil man sie verkaufen, zurückgeben oder entsorgen möchte. Wie löscht man dann alle vertraulichen Daten sicher und zuverlässig?

Ein paar wichtige Worte vorweg!

Dieser Artikel bezieht sich auf Linux-Systeme und richtet sich hauptsächlich an Privatpersonen. Nicht etwa, weil ihre Daten weniger schützenswert wären, sondern weil der Gesetzgeber bei gewerblich genutzten Festplatten mit personenbezogenen Daten eine fachgerechte und dokumentierte Löschung der Daten erwartet.

In diesem Artikel beschreibe ich außerdem, wie Daten sicher und zuverlässig gelöscht werden. Mit nur einer Fehleingabe können in Sekundenschnelle auch Daten vernichtet werden, die eigentlich nicht gelöscht werden sollten. Man sollte deshalb genau darauf achten, ob das Festplatten-Device wirklich das gewünschte ist, und sich das Kommando lieber einmal mehr anschauen, bevor man die Eingabetaste drückt. Wichtige Daten, die nicht gelöscht werden sollen, sollten stets auf einem aktuellen Backup gesichert sein.

Im folgenden Text wird die zu löschende Festplatte beispielhaft unter /dev/sdX angesprochen. Man sollte mit hdparm -I /dev/sdX vorab prüfen, ob es sich tatsächlich um das zu löschende Festplattenmodell handelt.

Continue reading...
Fedora: SSD kurz und schmerzlos

Es gibt schon viele Artikel, wie man SSD-Festplatten richtig in Linux einbindet. Aber entweder sind sie veraltet, unvollständig oder recht lange. Also, hier eine tl;dr-Fassung – SSD mit Fedora, kurz und schmerzlos.

Trimming

Wenn die SSD trimming kann (was mittlerweile bei ziemlich allen SSDs auf dem Markt der Fall ist), sollte es natürlich auch verwendet werden. Dadurch ermöglicht man wear levelling, gibt also der SSD die Möglichkeit, den Verschleiß der Speicherzellen zu verteilen.

Seit Fedora 33 ist Trimming bereits standardmäßig aktiviert. Hier braucht man sich keine weiteren Gedanken mehr zu machen.

Bei älteren Fedora-Versionen muss man den Trim-Timer einmalig manuell aktivieren:

pre. sudo systemctl enable fstrim.timer

Die Dateisysteme werden dann wöchentlich gesäubert.

Das Trimming kann mit dem Kommando fstrim auch jederzeit von Hand erfolgen:

sudo fstrim -v /
sudo fstrim -v /home

Swappiness

SSDs können beliebig oft und schnell gelesen werden, verschleißen aber bei Schreibzugriffen. Swapping auf eine SSD-Partition ist zwar möglich, aber der Lebensdauer nicht sehr zuträglich. Folgende Zeilen in der /etc/sysctl.conf reduzieren das Auslagern auf die Swap-Partition auf ein Minimum.

vm.swappiness=1
vm.vfs_cache_pressure=50

Bei den günstigen Preisen selbst für üppige RAM-Ausstattung wäre es bei Desktop-Rechnern eine Überlegung wert, ob man eine Swap-Partition überhaupt noch benötigt. Nachträglich kann sie durch Auskommentieren der entsprechenden Zeile in der /etc/fstab deaktiviert werden.

Little Java Regex Cookbook

Regular expressions, or short "regex", are a pattern of characters and metacharacters that can be used for matching strings. For example, the pattern "gr[ae]y" matches both the strings "gray" and "grey".

While regular expressions are an integral part of other popular languages, they have been introduced to the Java world rather late with the release of Java 1.4 in 2002. Perl, certainly the mother language of modern regexes, already turned 15 that year.

Regexes are sometimes hard to understand, but once you got the hang of them, they will soon become your weapon of choice when you have to deal with texts.

In this article, I focus on Java code patterns for common scenarios. If you have never heard of regular expressions before, the Wikipedia article and the Pattern JavaDoc are good starting points. The Regex Crossword site is a great place for working out your regex muscles.

Continue reading...
Enable Synology's hibernation debugger

If you own a Synology NAS, you probably know the trouble that it frequently wakes up from hibernation without any obvious reason. Synology has added a more or less undocumented debugger for that issue. If enabled, it will log the reason for waking up from its beauty sleep, so one can take measures against it.

WARNING: This article is targeted at experienced Linux users. Even if you manage to enable the debug mode, you still have to analyze the log files, find a solution to your individual problem, and assess if it is safe to apply. If you make a mistake, you can cause a lot of damage to your system and your data. Please take this advice seriously.

In any case, make sure your data is properly backed-up. Remember that a RAID is not a backup!

Also note that the debug mechanism has changed from time to time, so it may be completely different on your NAS depending on the DSM version that is used.

Continue reading...