Since some tutorials are meh or (even worse) slop, here's a little guide throught my own circustances on how to setup a Prosody XMPP server with Caddy dealing with the certs
Done on Debian, though you can probably do all of this on any other distro
DNS setup
Before even thinking about instaling Prosody, you should get all of the DNS stuff done first.
- Create a A record pointing your chosen subdomain to the IPV4 address of where you are going to host the server
- Same thing with a AAAA record, but point to the IPV6 address of said server
- And since you probably want the federation stuff working, you gotta make 2 SRV records, one for clients, one for servers.
_xmpp-client._tcp.(your domain here)with the response being something like:0 5222 (your main chat domain)_xmpp-server._tcp.(your domain here)with the sorta similar response being:0 5269 (your main chat domain)
- And also make sure to open those ports (5222/5269/5000 (this one is for file transfers to work) all of them on TCP)
Server setup
Ok, now you can download the server and all that good stuff.
I cant really go through every little configuration option, the documentation already does a pretty good job at that, but i will share my (barely changed) config file so you can have an example and enjoy the great default paragraphs of comments included.
Do make note of this list in particular, if you are using a subdomain and you want filesharing to work, you gotta do this.
Certs setup
And now the fun part, open up your Caddyfile and do the jiggy.
As you might know, after you reload Caddy, it will do all that certificate generation stuff for you.
The problem is: where do you find the certificates and how do you point them at Prosody?
First you gotta find the cert: sudo find /var/lib/caddy -type d -name "chat.yourdomain.moe", and then you point it at the server: sudo prosodyctl --root cert import chat.yourdomain.moe (cert filepath) (you gotta do this for all the domains you need btw)
Final steps
Now you just create your admin user: sudo prosodyctl adduser admin@chat.yourdomain.moe and
restart your server (since you changed the config a bunch in the meanwhile): sudo systemctl restart prosody
But you do not want to do that whole rigamarole every week, right?
Just put a script like this on your cronjobs and you are all set.
If you want to send me a DM: tossa (at symbol) chat.bossatossa.moe 🙂