Private chat using Prosody

There are a seemingly infinite number of chat protocols, services, and various other ways to interact with other people. Wanting to try something new and experiment a bit, I decided to deploy a Prosody server to a DigitalOcean virtual machine. This turned out to be more time consuming than I expected, despite everyone extolling how “quick, simple, and easy” it is, largely because the docs are lackluster and examples are hard to come by.

I currently use this Prosody instance to receive alerts and messages from the various things running in my lab (e.g. alerts about power outages sent using ntfy), as well as chatting with my wife. Yes, I could use WhatsApp, Telegram, Slack, IRC, Twitter, Signal, SMS, Rocket.Chat, Matrix, RCS, or about a thousand other things, but what fun would that be?

Install

I’m using the smallest DigitalOcean droplet size, which is still massively too large for the amount of resources Prosody needs. To make me feel slightly less wasteful, I’ve also added a WireGuard instance to the VM to provide me with a way to bypass the Pi-Hole filtering on my home network if needed. It’s also my backup if I am traveling and needing a way to protect my internet sessions and my home WireGuard instance isn’t working for whatever reason. I won’t go into the configuration details of WireGuard here, simply follow the existing guide.

After deploying the droplet with CentOS 7, connect using your SSH key.

Configure

  • Create the config files, /etc/prosody/prosody.cfg.lua

    While we’re here, remove the example and localhost configs:

  • Import the certificates

  • Start the server

  • Add the users:

    Don’t forget to turn on OMEMO in the client to encrypt messages between users.

Use

As was mentioned in the intro, I use ntfy to send messages from servers in the homelab. Follow the docs for how to configure with XMPP, then create scripts to send whatever messages you want. For example, I use CyberPower’s PowerPanel Personal client, pwrstatd, to detect when a power blip happens, which then sends me a message.

The contents of ntfy-pwrfail.sh and ntfy-lowbatt.sh are nearly identical, with only the message being different.

Leave a Reply