← Blog

Setting Up a Chat Server

In the wake of the highly publicized changes to WhatsApp's policies, and the increasing censorship on the mainstream social platforms, I saw a flood of my contacts migrating to Signal and Telegram. People who I didn't expect to be paying attention enough to be using something like Signal all of the sudden had accounts. I guess Elon Musk really does have that kind of gravitas that he can sway millennial men otherwise unaffected by "privacy concerns" to an alternative platform with the few keystrokes of a tweet.

I deleted my own WhatsApp account. It was less scary than I thought - most of my people found me on Signal or Telegram or iMessage. While I have resolved to just keeping half a dozen chat apps installed for conveniences sake for everyone else in my networks, it felt oddly satisfying to join in with the crowd and dig the knife into WhatsApp a little further. Besides, I absolutely hate the name.

While the quantity of chat apps is not off-putting, there are other issues and tradeoffs to consider that prevents any one of them from being "THE ONE."

iMessage - Highly reliable, feature stifled, and restricted to those with Apple gear.

Signal - A non-profit, funded by various sources including USGOV, Brian Acton (the guy who sold-out WhatsApp to Facebook), "internal turmoil" about censorship initiatives (or the lack thereof, rather), and oh yeah, admittedly understandable scaling issues that cropped up after Elon Musk's endorsement.

Telegram - A free service. Very well featured, including a weird mashup of a kind of open chat room/feed concept. But who knows where the content is actually being stored or how it's being handled. Though I use it, I do worry that the content people are sending through it is not nearly as private or secure as we might be assuming. Years in the future, I'm envisioning some kind of a bad leak of the media/attachments going public.

Matrix, formerly Riot - Decentralized chat server, which is great. From what I have read, it can be resource intensive because it's copying "entire chat rooms" as a synchronization solution.

With all of this swirling in my mind, I decided to take a more classical approach and install my own XMPP Server.

XMPP is a chat protocol similar to email protocols, like IMAP and SMTP. It used to be more widespread in the early 2000’s, but started to fade when the tech giants started making closed messengers like BBM, WhatsApp and iMessage. Google used to host probably one of the largest XMPP servers, but they killed it off a few years back, in similar vein to what they did to their mainstream RSS reader application.

The beautiful thing about XMPP is that it is designed to be fully decentralized. You can host it yourself on your own server, and like email, you can host other users on your server, or easily pass messages to users on other servers.

Despite its languished state, the chat clients and server software all still exists today, plus it’s all free to use. It's also much lighter in terms of server requirements than Matrix, which is perfect because I'm going to install it alongside the other services running on my VPS.

I was able to get ejabberd installed and live for my own domain on my own VPS in the matter of maybe an hour or so, the first time through. It's actually pretty easy as long as you have some kind of Linux CLI experience.

I used the following excellent guide to help give me an idea of what I needed to do:

https://computingforgeeks.com/install-ejabberd-xmpp-server-on-ubuntu/

The trickiest part was integrating with LetsEncrypt for the TLS certificates to encrypt the chat traffic. I decided to fetch a wildcard TLS cert from LetsEncrypt, which was a little off the beaten path but will ultimately help cover any other subdomains I need to encrypt. This post helped.

https://www.process-one.net/blog/how-to-move-the-office-to-real-time-im-on-ejabberd/

In particular:

However, if you happen to install ejabberd real time IM server on a VPS that already hosts a website with your domain, and you already use Let’s Encrypt SSL certificates, simply copy the fullchain.pem and privkey.pem to /opt/ejabberd/conf. Give ejabberd IM server file permissions by running chown ejabberd:ejabberd *.pem while in /opt/ejabberd/conf directory. Then update ejabberd.yml [and restart the service].

So, now I have my very own XMPP server installed and live, and yet another chat app to keep up with. I'm using Adium on the Mac and Monal on iOS. Adium is great and full-featured, and even though development has stalled, it seems to still work just fine on macOS Big Sur. Monal is the best XMPP client app I have found on iOS. Props to the guy developing it!

It's my opinion that we should all be having XMPP servers, or at least access to an account on one.

You can get in touch with me via XMPP by sending a message to ben -at- chat.bszyman.com.