xmpp-server
Latest: v0.1.1
Fixes from the skill scan: the agent's password is passed on standard input instead of the command line; the certificate script requires an empty directory and no longer touches a serial file there; commands run one at a time.
XMPP server (private chat for OpenClaw)
Sets up a chat server the user owns, in three parts:
- Prosody, a small XMPP server, with group chat rooms and file upload.
- An account for the agent and one for each person.
- The
@rickysinghmba/openclaw-xmppplugin, which connects OpenClaw to the agent's account.
Afterwards the user chats with the agent from an XMPP app such as Conversations (Android), Monal (iOS, macOS), Gajim or Dino (desktop). Messages stay on their server.
Tested: the install and setup steps below run on Ubuntu in this project's CI, followed by the plugin's tests against the server they produce (messages, rooms, file upload). Not tested: other Linux distributions, the macOS and Let's Encrypt notes, and phone apps. Say so if the user is on one of those paths.
Rules for this skill
- Ask before you change anything. Installing packages, writing server config, creating accounts, installing a certificate, restarting the server and editing OpenClaw config each need the user's yes. Say what the step does first.
- Check first. Run the check script before proposing a step, and skip what is already done.
- Never handle a person's password. People create their own account password by running the command themselves. Do not ask for it, generate it, or read it.
- The agent's password stays in a file. Generate it straight into a file only the user can read. Never print it, and never put it in a message or in OpenClaw config.
- Open nothing to the internet. Do not change a firewall, a router, or DNS. If the user wants the server reachable from outside their network, explain what that involves and let them do it.
- Keep open registration off. Accounts are created one by one.
- One command at a time. Run each command below on its own and look at its result before the next. Do not join them into longer command lines.
Why some steps need sudo
Prosody is a system service. Installing its package, placing files under /etc/prosody,
restarting it and creating accounts in its database are the only steps that use sudo, and each
is listed below with what it does. Nothing else in this skill runs as root: the three scripts
never call sudo, and two of them only print or read.
1. Check what is already there
bash {baseDir}/scripts/check.sh DOMAIN HOST
DOMAIN is the chat domain (default localhost) and HOST is where the server listens (default
127.0.0.1). The script only reads. It reports whether Prosody is installed, whether the chat
port (5222) and the file upload port (5281) answer, and whether the certificate names the domain,
is trusted, is about to expire, and is usable by Apple devices. For a private certificate
authority, pass its file: XMPP_CA_FILE=/path/to/ca.crt bash {baseDir}/scripts/check.sh ....
2. Choose a domain
Ask where the server will be used. The domain is the part after @ in every address.
| Situation | Domain | Certificate |
|---|---|---|
| Only this machine, to try it out | localhost | private CA (step 4) |
| Devices on the home or office network | a name those devices can resolve, e.g. chat.home.lan | private CA (step 4) |
| Reachable from the internet | a public domain the user owns | Let's Encrypt (step 4) |
For a home-network name, every device has to resolve it to the server's address. That is set in the router's DNS or each device's hosts file; this skill does not change either. If the user cannot do that, say so before going on: phone apps will not connect without it.
3. Install Prosody and write its config
Debian and Ubuntu:
sudo apt-get update
sudo apt-get install -y prosody
Prosody 0.12 or later is needed for file upload. Other systems: follow
https://prosody.im/download. The paths below are the Debian and Ubuntu ones; on another system
find the config directory with prosodyctl about.
Write the config for the chosen domain to a file in the user's home directory first. The script only prints; it changes nothing on the system:
bash {baseDir}/scripts/render-config.sh DOMAIN > ~/openclaw.cfg.lua
The file adds the chat host, a room service at conference.DOMAIN, and file upload at
https://DOMAIN:5281/ with a 20 MB limit per file. Show it to the user. After their yes, install
it:
sudo install -m 644 ~/openclaw.cfg.lua /etc/prosody/conf.d/openclaw.cfg.lua
Everything else stays as the system's Prosody package set it, including required encryption.
4. Install a certificate
Chat apps refuse a server without a valid certificate, and so does OpenClaw.
Private CA (for localhost or a home-network name):
bash {baseDir}/scripts/make-private-ca.sh DOMAIN ~/xmpp-ca
sudo install -m 644 ~/xmpp-ca/DOMAIN.crt /etc/prosody/certs/DOMAIN.crt
sudo install -m 640 -g prosody ~/xmpp-ca/DOMAIN.key /etc/prosody/certs/DOMAIN.key
The script creates a certificate authority and a server certificate valid for 397 days, with the
properties Apple devices require. ~/xmpp-ca must be a new or empty directory: the script stops
otherwise, so it never changes or removes an existing file.
Tell the user:
~/xmpp-ca/ca.crthas to be installed as a trusted certificate on each phone or computer that will connect. Until then the chat app shows a certificate warning.~/xmpp-ca/ca.keycan issue certificates their devices will trust. It must stay private.- The server certificate has to be renewed in about a year. Put a reminder somewhere they will see.
Public domain: get a certificate with the user's usual ACME client, then run
sudo prosodyctl --root cert import /etc/letsencrypt/live. See
https://prosody.im/doc/letsencrypt. No extra trust setup is needed on devices.
Then restart and check:
sudo systemctl restart prosody
sudo prosodyctl check config
bash {baseDir}/scripts/check.sh DOMAIN HOST
5. Create the accounts
The agent's account. First generate its password straight into a file only the user can read.
This file is what the plugin's passwordFile setting points at; it is the only thing this skill
leaves behind outside Prosody's own directories:
bash {baseDir}/scripts/new-password-file.sh ~/.openclaw/secrets/xmpp-password
Then create the account. The password is read from the file through standard input, so it never
appears on a command line, in the process list, or in sudo's log:
cat ~/.openclaw/secrets/xmpp-password ~/.openclaw/secrets/xmpp-password | sudo prosodyctl adduser openclaw@DOMAIN
prosodyctl adduser asks for the password twice, which is why the file is sent twice. If it says
it cannot connect to the server, this Prosody version creates accounts through its admin shell:
tell the user and let them create the account themselves with the password from the file.
Each person creates their own, typing a password only they know. Give them this command to run themselves; do not run it for them:
sudo prosodyctl adduser NAME@DOMAIN
6. Connect OpenClaw
openclaw plugins install clawhub:@rickysinghmba/openclaw-xmpp
Then set channels.xmpp in OpenClaw's config. Replace the capitalised parts:
{
channels: {
xmpp: {
jid: "openclaw@DOMAIN",
passwordFile: "~/.openclaw/secrets/xmpp-password",
// Only if DOMAIN does not resolve from the OpenClaw machine:
service: "xmpp://SERVER-ADDRESS:5222",
dmPolicy: "allowlist",
allowFrom: ["NAME@DOMAIN"],
// Needed when the server is on a private network or this machine:
media: { privateHosts: ["DOMAIN"] },
},
},
}
With a private CA, OpenClaw also has to trust it: the gateway must start with the environment
variable NODE_EXTRA_CA_CERTS set to the path of ca.crt. Then restart the gateway.
7. Try it
- In the chat app, sign in as
NAME@DOMAIN. - Add
openclaw@DOMAINas a contact and send "hello". The agent should answer. - Send a voice message. With speech-to-text set up in OpenClaw (for example the
whisper-serverskill), the agent answers what was said.
Troubleshooting
- The app cannot find the server. The device does not resolve
DOMAIN. Check from that device, not from the server. - Certificate warning in the app. The device does not trust the private CA yet, or the
certificate does not name
DOMAIN. Run the check script withXMPP_CA_FILEset. - OpenClaw logs a certificate error.
NODE_EXTRA_CA_CERTSis not set for the gateway, or points at the server certificate instead ofca.crt. - Messages work but files do not. Port 5281 is not reachable, or the host is not listed in
channels.xmpp.media.privateHosts. The check script shows whether the port answers. prosodyctl check configreports a problem. Show the user the message. Do not edit the system's main config file to silence it without their yes.- The agent does not answer. The sender's address is not in
allowFrom. Addresses are matched in lower case and without anything after a/.
