Mildly Useful

Nextcloud Munin Plugin

Nextcloud Munin Plugin

Nextcloud Munin Plugin

basic idea

For a longer period of time I was looking for a Munin plugin to monitor the activity, especially the user activity on my cloud instance. There are some plugins out there, but most of them depend on externally querying the database.
With the External API and the server info dashboard Nextcloud itself presents an endpoint to gather data from. This way the database action is handled by the cloud and I can just grab the data from the endpoint.

Let's Encrypt Prosody Cert Hook

Let's Encrypt Prosody Cert Hook

Let's Encrypt Prosody Cert Hook

Prosody + Let’s Encrypt certificates

As of right now Prosody is not able to update a live certificate while running. For the complete update it is necessary to restart Prosody, which is inconvenient.
With the telnet console however, it is possible to reload the config such that a changed certificate is updated correctly. The biggest problem lies in reloading all possible locations the “old” certificate is still active in. I use the Prosody Telnet console to invoke a reload, due to the fact that prosodyctl reload is not actually reloading the modules just the config.
For this matter I hacked together a little bash script, which together with the Let’sEncrypt’s certbot and the default letsencrypt cli is used to import and update the Prosody certificate without a need to restart the instance.

Prosody Datenbank Indizes

Prosody Datenbank Indizes

Prosody Database Indizes

Prosody bietet die Möglichkeit persistente Userdaten bzw. seit 0.10 auch MAM Archive in einer MySQL Datenbank zu sichern. Prosody erstellt beim ersten Laden des Moduls alle relevanten Datenbanken sowie Indizes. Allerdings werden Indizes, die nachträglich, z.B. in aktuelleren Patches , hinzugefügt werden, nur in Datenbanken eingetragen, die neu erstellt werden. Damit fehlen in den allermeisten älteren Datenbanken die aktuellen Indizes.

Notwendigkeit von Indizes

Indizes können Datenbankabfragen enorm beschleunigen, da sie es bei einer Abfrage ermöglichen eine deutlich kleinere Anzahl an Zeilen zu vergleichen. Dadurch wird ein schnelleres, effizienteres und vor allem performanteres Ergebnis erzielt. Die MySQL Dokumentation beschreibt es wie folgt:

Prosody Housekeeping

Prosody Housekeeping

Prosody Housekeeping Skript

Grundidee

Ich habe mich in den letzten paar Tagen damit beschäftigt Dinge rund um den Prosody Server zu automatisieren. Daher möchte ich hier einfach mal meine Lösung einiger kleiner Probleme vorstellen.

Problem

Das grundsätzliche Problem, welches so ziemlich alle Server mit offener Registrierung teilen, sind Zombie Accounts. Sprich Accounts die erstellt wurden, allerdings nie verwendet werden. Oder Accounts die erstellt wurden und irgendwann von ihrem Nutzer/in nicht mehr verwendet werden. Solche Accounts verursachen eine vermeidbare Last für das System.
Die zweite größere Quelle liegt in einem Problem Prosodys Dateien oder Datenbank Einträge korrekt bzw. überhaupt zu löschen. Namentlich sind hier mod_http_upload und mod_mam zu nennen. Vor allem bei dem Modul mam bestehen Probleme, da die Einträge eines jeden Users einzeln bearbeitet werden. Daher steigt die Bearbeitungszeit bei größeren Nutzerzahlen enorm an.

XMPP over TLS Tutorial

XMPP over TLS Tutorial

How to setup XEP-0368

Was ist XEP-0368

Bei XEP-0368 handelt es sich um ein Verfahren welches XMPP-Clients ermöglicht über SRV Einträge im DNS, alternative Verbindungsmöglichkeiten zu entdecken. Dies ist äußerst nützlich, falls die regulären Verbindungswege blockiert sind zb. durch Firewalls.

XMPP Core specifies the use of xmpp-client/xmpp-server SRV records as the method of discovering how to connect to an XMPP server. This XEP extends that to include new xmpps-client/xmpps-server SRV records pointing to direct TLS ports and combine priorities and weights as if they were a single SRV record similar to RFC 6186. It also provides an easy way for clients to bypass restrictive firewalls that only allow HTTPS, for servers to host multiple protocols/services on a single port, and for servers and clients to take advantage of less round trips and existing direct TLS loadbalancers.

— XEP-0368 Definition

TeamSpeak XMPP Push

small TeamSpeak XMPP push script

Idee

Die Idee hinter diesem Skript ist, dass ein Admin/ Moderatoren nicht dauerhaft mit einem Server verbunden sein kann, um nach dem Rechten zu sehen.
Dieses Problem versuche ich hiermit anzugehen. Dafür durchsucht dieses nach verschiedenen Regeln die Logfiles, gefundene Zeilen werden anschließend an definierte Kontakte per XMPP sendet.

Nutzen

IMHO gibt es genügend Beispiele, in denen eine schnellstmögliche Benachrichtigung sehr praktisch ist. Viele Server unterstützen eine Reihe von “Automatischen Moderationen”, dennoch finden User immer Möglichkeiten diese zu behindern oder sogar zu umgehen.
Durch eine kurze Benachrichtigung ist es dem Admin/ Moderator möglich zu überblicken, was betroffen ist und ob sofortiges handeln notwendig ist. Je nach Häufigkeit der Ausführung können die Benachrichtigung innerhalb von Sekunden gepushed werden.