OpenWrt Forum Archive

Topic: Prosody, server for Jabber/XMPP

The content of this topic has been archived between 30 Mar 2018 and 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I barely RTFM, shaw the video and would like to test it, so I did:

# cat /proc/version
Linux version 2.6.30.5 (buildbot@localhost.localdomain) (gcc version 4.1.2) #5 Fri Aug 28 11:26:22 CDT 2009
# opkg install prosody
...
# prosodyctl start
-ash: prosodyctl: not found
# /etc/init.d/prosody start
-ash: /etc/init.d/prosody: not found
# find / -name prosody*
/etc/prosody
/etc/prosody/prosody.cfg.lua
/usr/bin/prosody
/usr/lib/opkg/info/prosody.list
/usr/lib/opkg/info/prosody.conffiles
/usr/lib/opkg/info/prosody.control
/usr/lib/prosody
/jffs/etc/prosody
/jffs/etc/prosody/prosody.cfg.lua
/jffs/usr/bin/prosody
/jffs/usr/lib/opkg/info/prosody.list
/jffs/usr/lib/opkg/info/prosody.conffiles
/jffs/usr/lib/opkg/info/prosody.control
/jffs/usr/lib/prosody
/tmp/lib/prosody
# /usr/bin/prosody
datamanager         info        Setting data path to: /var/lib/prosody
hostmanager         info        Activated host: conference.example.com
hostmanager         info        Activated host: localhost
datamanager         debug       Failed to load room_list storage ('cannot open /var/lib/prosody/conference%2eexample%2ecom/room_list.dat: No such file or directory') for user: nil@conference.example.com
modulemanager       warn        dialback is already loaded for conference.example.com, so not loading again
componentmanager    debug       component added: conference.example.com
componentmanager    info        Activated muc component: conference.example.com
connlisteners       info        Registered connection listener xmppclient
socket              debug       server.lua: new server listener on '*:5222'
connlisteners       info        Registered connection listener xmppserver
socket              debug       server.lua: ssl not enabled on 5269
socket              debug       server.lua: new server listener on '*:5269'

Is this any good?
Something is missing?

Well, that is, but can't add users with the demo config and without prosodyctl.
Adding dummy@example.com
Jabber clients say: bad host
Adding dummy@localhost
-Jabber clients say: unauthorized
-Server spit: no such file of directory

touch /var/lib/prosody/localhost/accounts/dummy.dat

-Jabber clients still say: unauthorized
So lets edit'em:
Webif (sorry): http://192.168.1.1/cgi-bin/webif/system … dy.cfg.lua

-                --"register"; -- Allow users to register on this server using a client
+                "register"; -- Allow users to register on this server using a client
...
-- This allows clients to connect to localhost. No harm in it.
Host "localhost"
+    allow_registration = true
-- Section for example.com

Adding dummy@localhost
-Pidgin 2.6.1 for Window$: GPF
-Pidgin 2.5.5 Ubuntu: conflict
Delete dummy.dat
-Pidgin 2.5.5 Ubuntu: Success creating account and connecting
-Pidgin 2.6.1 for Window$: Success connecting
Surprise, dummy.dat contains:

return {
    ["password"] = "plainText",
}

Now you know how to uncomplicate add a user without GPF or default editing...
In a brief:

touch /var/lib/prosody/localhost/accounts/dummy.dat
echo return { >>dummy.dat
echo     ["password"] = "dummy",>>dummy.dat
echo }>>dummy.dat

Password can be changed later by the client.

Happy ending: I have a working XMPP Server on my Netgear WNR854T (OpenWRT enabled router) big_smile

(Last edited by Nilfred on 4 Sep 2009, 03:58)

Can you create a tuto for install and program prosody on OpenWrt ?

Thanks in advance,

Neustradamus

I still don't figure it out.

On last restart (Uptime: 9 days, 18:40) I lost all users and they users subscriptions.
Then backup regularly contents of \tmp\lib\prosody
WinSCP will do backup well, I use openssh-sftp-server and TotalCmd instead.

Even lost XMPP server, so first I did, was add to /etc/init.d/custom-user-startup

lua /usr/bin/prosody &

Make required directories:

mkdir /var/lib/prosody
mkdir /var/lib/prosody/localhost
mkdir /var/lib/prosody/localhost/offline
mkdir /var/lib/prosody/localhost/accounts

Manually made required accounts don't work:

echo return { > /var/lib/prosody/localhost/accounts/dummy.dat
echo     ["password"] = "dummy",>> /var/lib/prosody/localhost/accounts/dummy.dat
echo }>> /var/lib/prosody/localhost/accounts/dummy.dat

Second echo don't spit the spaces and lua seems pity about spaces, even try one-liner and lua don't like it. I know nothing about lua...
Uploaded files from backup goes well so far.

I still feel It can't be so hard, even vnstat download automagically a backup from a remote server.
I'm missing something here, will wait for somebody enlighten...

I just saw that prosody is available in the kamikaze repository....  nice work smile
Is it possible to add verse sometime in the near future too ?

verse is a Jabber/XMPP library for Lua from Matthew Wild, the guy who develops prosody...

for documentation look here:
verse documentation
Verse project page

i want to write a small jabber bot, using verse, which provides me with the current status of my openwrt system...
based on the concept of  this nice tool by 'ahzf'

XMPPLogger

(Last edited by resus on 23 Oct 2009, 23:32)

Hey, I'm Matthew Wild. I'm working on a new version of Verse which is based on much of Prosody's code. It should have the same dependencies as Prosody, and be pretty easy to get going on OpenWRT (it will have the same dependencies). I'll poke the relevant people into producing a package when it is released smile

On the note of system monitoring, it is quite simple to make Prosody plugins to run directly inside Prosody (no need for a client/bot). I have been thinking about setting up a monitoring system using Prosody for a while. Perhaps if you want to discuss developing it then catch me in the Prosody chatroom (see http://prosody.im/discuss ) (when I'm there I'm there as MattJ).

New version 0.5.2 in trunk
Now includes prosodyctl
Now default in prosody.cfg.lua: "register"; -- Allow users to register on this server using a client
But still have to add under Host: allow_registration = true
Could this be done via uci?

Pidgin 2.6.3 does not hang on creating account without "Resource". That is, your XMPP account should be you@yourServer/yourPlace where yourPlace could be Home, Work, Empty, etc. Is advisable to use a Resource when creating account thought Pidgin.

vnstat does not try to download anything from my HTTP server but that is only an offtopic mention I have to do for completeness.

Nilfred wrote:

New version 0.5.2 in trunk
Now includes prosodyctl
Now default in prosody.cfg.lua: "register"; -- Allow users to register on this server using a client
But still have to add under Host: allow_registration = true
Could this be done via uci?

I'm not that familiar with uci, where does it store info? Since Prosody's config file is a Lua script you could put any kind of code there to fetch the config from wherever it is stored.

Pidgin 2.6.3 does not hang on creating account without "Resource". That is, your XMPP account should be you@yourServer/yourPlace where yourPlace could be Home, Work, Empty, etc. Is advisable to use a Resource when creating account thought Pidgin.

I am not familiar with any bug regarding this. You shouldn't be required to enter a resource (if you don't, the server will generate one for you). If you do specify one, that should work too.

touch /etc/config/prosody
uci add prosody host
uci set prosody.@host[-1].name=localhost
uci set prosody.@host[-1].allow_registration=true
uci set prosody.@host[-1].enabled=true
uci commit prosody

Will generate a file with contains:

config 'host'
    option 'name' 'localhost'
    option 'allow_registration' 'true'
    option 'enabled' 'true'

# uci show prosody

prosody.@host[0]=host
prosody.@host[0].name=localhost
prosody.@host[0].allow_registration=true
prosody.@host[0].enabled=true

These should merge to the default config file.
User then only need a backup of /etc/config/ to save router customizations.
Not sure if clear enough, I'm not a uci expert.

resus wrote:

I just saw that prosody is available in the kamikaze repository....  nice work smile

Hmm... maybe I'm wrong but I think this package is useless in the moment, because neither lua-luasec which is optional nor  lua-expat which is mandatory are available for kamikaze, or am i wrong ?

It would be nice if someone could give me a hint, where i can get luasec and lua-expat...

The Prosody version in OpenWrt's repository isn't UCI aware yet. There even does not exist any init script...

Nilfred wrote:
touch /etc/config/prosody
uci add prosody host
uci set prosody.@host[-1].name=localhost
uci set prosody.@host[-1].allow_registration=true
uci set prosody.@host[-1].enabled=true
uci commit prosody

Will generate a file with contains:

These should merge to the default config file.
User then only need a backup of /etc/config/ to save router customizations.
Not sure if clear enough, I'm not a uci expert.

Very nice, thanks. Definitely easy to integrate with.

For now personally I'm held up a bit because Prosody currently depends on OpenSSL, which is a large dependency that doesn't want to fit on my router. I need to set up some external storage at some point and try again...

Dogge wrote:

The Prosody version in OpenWrt's repository isn't UCI aware yet. There even does not exist any init script...

Both should be easy to fix.

ArthurF wrote:

Hmm... maybe I'm wrong but I think this package is useless in the moment, because neither lua-luasec which is optional nor  lua-expat which is mandatory are available for kamikaze, or am i wrong ?

I'm sure they're around, I'm not sure where though right now - if you don't find them I'll have a look later when I'm back home.

MattJ wrote:

I'm sure they're around, I'm not sure where though right now - if you don't find them I'll have a look later when I'm back home.

Well, I couldn't find them.

http://downloads.openwrt.org/kamikaze/8 … /packages/

openwrt only provides a pretty old prosody version and luasocket
lua-expat and luasec are not present.

I also found this site where OrazioPirataDelloSpazio provides some binaries
http://test.ninux.org/~orazio/bin/packages/mipsel/

but he only offers an updated prosody version...
the binaries of luasec and lua-expat are not available.

however some makefiles are available here...
https://dev.openwrt.org/browser/packages/lang

but lazy as i am,  i still would prefer some packages ;P

AthurF wrote:

It would be nice if someone could give me a hint, where i can get luasec and lua-expat...

I simply do "opkg install prosody" as stated on first post with xwrt orion repository on a Netgear WNR854T (500MHz 8MB 32MB)

MattJ wrote:

For now personally I'm held up a bit because Prosody currently depends on OpenSSL, which is a large dependency that doesn't want to fit on my router. I need to set up some external storage at some point and try again...

Crypto is optional or should be AFAIK for XMPP.
This is the footprint:

PS wrote:

PID      USER      VSZ      STAT      COMMAND
2350      root      5732      S      lua /usr/bin/prosody

Legend:
Memory sizes are in kB units.
Stat shortcuts meaning: A=Active, I=Idle (waiting for startup), O=Nonexistent, R=Running, S=Sleeping, T=Stopped, W=Swapped, Z=Canceled.
Commands enclosed in "[...]" are kernel threads.

Dogge wrote:

There even does not exist any init script...

kamikaze init scripts (how to)

Example certificate expired today.

Nombre común: Example certificate
Huella (SHA1): a6:48:9b:61:71:ca:dd:77:d2:54:43:47:02:7c:0f:6a:14:a6:b1:89
Fecha de activación: Sat Nov 29 14:14:24 2008
Fecha de expiración: Sun Nov 29 14:14:24 2009

I should have another one. Right?
Edit:
Well, I RTFM so end with this:

opkg update
opkg install openssl-util
cd /tmp
openssl req -new -x509 -days 365 -nodes -out "localhost.cert" -keyout "localhost.key"
mv localhost.cert /etc/prosody/certs
mv localhost.key /etc/prosody/certs
opkg remove openssl-util

Caveats:

  • opkg will ask for overwrite /etc/ssl/openssl.cnf, I reply "Y" guessing

  • When openssl asks for the “Common Name (eg, YOUR name)” you must enter 192.168.1.1 or whatever fancy-name has the router in host file. Previously was “Example certificate”

  • prosody must be restarted for changes to take effect

(Last edited by Nilfred on 4 Dec 2009, 16:12)

Dogge wrote:

There even does not exist any init script...

Is there another way to daemonize prosody?
What about restart? To reload certificates for example, test with SIGHUP also stops.

/etc/init.d/prosody wrote:

#!/bin/sh /etc/rc.common
# Copyright (C) 2009 OpenWrt.org

START=80
STOP=20

start() {
    lua /usr/bin/prosody &
}

stop() {
    kill  `ps x |awk '/prosody/ {print $1}'`
}

BTW 0.6.1 is out, I still have 0.5.2

http://openwrt.pastebin.ca/1723837 is an update to 0.6.1 along with some debian/openwrt config changes and an init script that works in limited testing.

Hi, Prosody users....

Matthew Wild, one of the authors of Prosody, is working on an updated OpenWRT package with some more sensible defaults for the OpenWRT trunk. He should be done shortly. When he is, I'll update the forum.

marc.

I'll watch this thread too. smile

MattJ wrote:

For now personally I'm held up a bit because Prosody currently depends on OpenSSL, which is a large dependency that doesn't want to fit on my router. I need to set up some external storage at some point and try again...

I now have another router with only 4 MiB Flash and see that libopenssl simply doesn't fit.
What about PolarSSL?
What about MatrixSSL?
I don't need SSL in the way I use it. Can be run without SSL? So coming in different flavors:
prosody-openssl
prosody-matrixssl
prosody-polarssl
prosody-nossl
Who should upgrade current 0.6.2 to 0.7.0 in OpenWrt?

(Last edited by Nilfred on 14 Nov 2010, 08:58)

Nilfred wrote:
MattJ wrote:

For now personally I'm held up a bit because Prosody currently depends on OpenSSL, which is a large dependency that doesn't want to fit on my router. I need to set up some external storage at some point and try again...

I now have another router with only 4 MiB Flash and see that libopenssl simply doesn't fit.
What about PolarSSL?
What about MatrixSSL?

Both should be fine if someone is willing to write the code to make them work smile See LuaSec: http://www.inf.puc-rio.br/~brunoos/luasec/

I don't need SSL in the way I use it. Can be run without SSL? So coming in different flavors:
prosody-openssl
prosody-matrixssl
prosody-polarssl
prosody-nossl

Prosody doesn't directly depend on OpenSSL, I don't see a need for different prosody packages. Prosody can optionally use LuaSec when installed, and it is LuaSec that depends on OpenSSL. Prosody can run fine without it, you'll just get a warning that encrypted connections are not supported.

Who should upgrade current 0.6.2 to 0.7.0 in OpenWrt?

I kind of missed 0.7.0 due to a few issues. We're working on a 0.8.0 release in the coming weeks, and I plan to produce a working OpenWRT package at the same time.

Prosody can optionally use LuaPolarSSL when installed, instead of LuaSec. I can't find a ready made Lua interface for MatrixSSL.
So prosody package shouldn't depend on LuaSec as is now:

root@OpenWrt:/# sed -ie 's!http://.*$!http://192.168.1.132/openwrt/ar71xx/r23513/packages!' /etc/opkg.conf
root@OpenWrt:/# opkg update
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/Packages.gz.
Inflating http://192.168.1.132/openwrt/ar71xx/r23513/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/snapshots.
root@OpenWrt:/# opkg install prosody
Installing prosody (0.6.2-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/prosody_0.6.2-1_ar71xx.ipk.
Installing luafilesystem (1.5.0-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/luafilesystem_1.5.0-1_ar71xx.ipk.
Installing liblua (5.1.4-7) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/liblua_5.1.4-7_ar71xx.ipk.
Installing libidn (1.18-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/libidn_1.18-1_ar71xx.ipk.
Installing luaexpat (1.1-2) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/luaexpat_1.1-2_ar71xx.ipk.
Installing lua (5.1.4-7) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/lua_5.1.4-7_ar71xx.ipk.
Installing libexpat (2.0.1-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/libexpat_2.0.1-1_ar71xx.ipk.
Installing luasec (0.4-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/luasec_0.4-1_ar71xx.ipk.
Installing libopenssl (0.9.8o-1) to root...
Configuring liblua.
Configuring lua.
Configuring luafilesystem.
Configuring libidn.
Configuring luasec.
Configuring libexpat.
Configuring luaexpat.
Collected errors:
 * verify_pkg_installable: Only have 640kb available on filesystem /overlay, pkg libopenssl needs 1301
 * opkg_install_cmd: Cannot install package prosody.
root@OpenWrt:/# opkg remove luafilesystem libidn luasec luaexpat libexpat lua liblua libopenssl prosody
Removing package luafilesystem from root...
Removing package libidn from root...
Removing package luasec from root...
Removing package luaexpat from root...
Removing package libexpat from root...
Removing package lua from root...
Removing package liblua from root...
root@OpenWrt:/# opkg --nodeps install luafilesystem libidn luaexpat libexpat lua liblua prosody
Installing luafilesystem (1.5.0-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/luafilesystem_1.5.0-1_ar71xx.ipk.
Installing libidn (1.18-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/libidn_1.18-1_ar71xx.ipk.
Installing luaexpat (1.1-2) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/luaexpat_1.1-2_ar71xx.ipk.
Installing libexpat (2.0.1-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/libexpat_2.0.1-1_ar71xx.ipk.
Installing lua (5.1.4-7) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/lua_5.1.4-7_ar71xx.ipk.
Installing liblua (5.1.4-7) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/liblua_5.1.4-7_ar71xx.ipk.
Installing prosody (0.6.2-1) to root...
Downloading http://192.168.1.132/openwrt/ar71xx/r23513/packages/prosody_0.6.2-1_ar71xx.ipk.
Configuring liblua.
Configuring lua.
Configuring luafilesystem.
Configuring libidn.
Configuring libexpat.
Configuring luaexpat.
Configuring prosody.

adding group prosody to /etc/group
adding user prosody to /etc/passwd

Success! In brief:

opkg --nodeps install luafilesystem libidn luaexpat libexpat lua liblua prosody

Thanks for your input.

Found another one just under my nose:
CyaSSL and Lua interfase: luci-nixio. This one may remove other prosody dependences as well...

Hello,
are there any news about a new release of prosody packaged for openwrt?

Still running 0.6.2 with some headache (too much memory consumption when message flooded).

Well, as stated above 0.7.0 has issues also.
There is still no 0.8.0, so you can selectively overwrite *.lua installed from 0.7.0 source and cross your finger about some binaries presence... I did it to go from 0.5.2 to 0.6.1, reported no issues and shortly after 0.6.2 appears packaged. Nice!
That is the key on 0.x releases, test and report success.