JWT token installation -- NEED HELP!

Dear Jitsi Community, @damencho, @sapkra, @Pawel_Domas, @jespino, @Aaron_K_van_Meerten

PLEASE HELP !!!

Following the official jitsi-meet-tokens installation guide results in luacrypto errors

I would like to know if there is a better step-by-step process to perform the installation.

My server config

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Release:	20.04
Codename:	focal

In addition I was also looking at these notes

BUT the process always fails on luarocks install luacrypto

=====

I understand there are a bunch of outdated threads on how to resolve it but none work any longer. There is also a notion that luacrypto is a very old repo that is not being maintained and we should really use luaossl instead.

I really need someone to point me to a step-by-step guide on how to install the jitsi-meet-tokens successfully WITHOUT wasting weeks of my time. I cannot believe that it should be THIS DIFFICULT!!!

@damencho, @sapkra, @Pawel_Domas, @jespino, @Aaron_K_van_Meerten
or ANYBODY … PLEASE HELP!!!

Updated tutorial here https://github.com/mjtiempo/Docs/blob/master/Jitsi%20Meet%20Installation.md
Video https://youtu.be/9IWWlrBqDj8

1 Like

This line throws an error for me.

luarocks install luacrypto2 &&

root@brian:~# luarocks install luacrypto2
Installing https://luarocks.org/luacrypto2-0.3.2-1.src.rock
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/lcrypto.c -o src/lcrypto.o -I/usr/include
src/lcrypto.c:45:10: fatal error: lua.h: No such file or directory
#include “lua.h”
^~~~~~~
compilation terminated.

Error: Build error: Failed compiling object src/lcrypto.o

find / -name lua.h

root@brian:~# find / -name lua.h
/usr/include/lua5.2/lua.h

Looks like I have Lua5.2 installed, but the compiler is looking for 5.1

prosodyctl about

root@brian:~# prosodyctl about
Prosody 0.10.0

Prosody directories

Data directory: /var/lib/prosody
Config directory: /etc/prosody
Source directory: /usr/lib/prosody
Plugin directories:
/usr/share/jitsi-meet/prosody-plugins/
/usr/lib/prosody/modules/

Lua environment

Lua version: Lua 5.1

Lua module search paths:
/usr/lib/prosody/?.lua
/usr/local/share/lua/5.1/?.lua
/usr/local/share/lua/5.1/?/init.lua
/usr/local/lib/lua/5.1/?.lua
/usr/local/lib/lua/5.1/?/init.lua
/usr/share/lua/5.1/?.lua
/usr/share/lua/5.1/?/init.lua
/home/ubuntu/.luarocks/share/lua/5.1/?.lua
/home/ubuntu/.luarocks/share/lua/5.1/?/init.lua

Lua C module search paths:
/usr/lib/prosody/?.so
/usr/local/lib/lua/5.1/?.so
/usr/lib/x86_64-linux-gnu/lua/5.1/?.so
/usr/lib/lua/5.1/?.so
/usr/local/lib/lua/5.1/loadall.so
/home/ubuntu/.luarocks/lib/lua/5.1/?.so

LuaRocks: Installed (2.4.2)

Lua module versions

lfs: LuaFileSystem 1.6.3
libevent: 2.1.8-stable
luaevent: 0.4.4
lxp: LuaExpat 1.3.0
socket: LuaSocket 3.0-rc1
ssl: 0.6

Lua version should be 5.1 ?

sudo apt-get -y purge lua5.2
cd ~/; wget https://www.lua.org/ftp/lua-5.1.3.tar.gz
tar -zxvf lua-5.1.3.tar.gz
sudo mkdir /usr/include/lua5.1
sudo cp ~/lua-5.1.3/src/* /usr/include/lua5.1
Lua install gudie: https://www.tecmint.com/install-lua-in-centos-ubuntu-linux/

Now run I can run

luarocks install luacrypto2

Prosody version 10.0 should be 11.5

apt-get purge prosody
wget https://prosody.im/files/prosody-debian-packages.key -O- | sudo apt-key add - &&
echo deb http://packages.prosody.im/debian $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install prosody

Prosody is good, but now Lua is back to 5.2

prosodyctl about

Prosody 0.11.5

Prosody directories

Data directory: /var/lib/prosody
Config directory: /etc/prosody
Source directory: /usr/lib/prosody
Plugin directories:
/usr/lib/prosody/modules/

Lua environment

Lua version: Lua 5.2

Lua module search paths:
/usr/lib/prosody/?.lua
/usr/local/share/lua/5.2/?.lua
/usr/local/share/lua/5.2/?/init.lua
/usr/local/lib/lua/5.2/?.lua
/usr/local/lib/lua/5.2/?/init.lua
/usr/share/lua/5.2/?.lua
/usr/share/lua/5.2/?/init.lua
/home/ubuntu/.luarocks/share/lua/5.2/?.lua
/home/ubuntu/.luarocks/share/lua/5.2/?/init.lua

Lua C module search paths:
/usr/lib/prosody/?.so
/usr/local/lib/lua/5.2/?.so
/usr/lib/x86_64-linux-gnu/lua/5.2/?.so
/usr/lib/lua/5.2/?.so
/usr/local/lib/lua/5.2/loadall.so
/home/ubuntu/.luarocks/lib/lua/5.2/?.so

LuaRocks: Installed (2.4.2)

Network

Backend: select

Lua module versions

lfs: LuaFileSystem 1.6.3
libevent: 2.1.8-stable
luaevent: 0.4.6
lxp: LuaExpat 1.3.0
socket: LuaSocket 3.0-rc1
ssl: 0.6

Install Prosody 747 from trunk

sudo apt-get -y purge prosody
wget https://packages.prosody.im/debian/pool/main/p/prosody-trunk/prosody-trunk_1nightly747-1~xenial_amd64.deb
dpkg -i prosody-trunk_1nightly747-1~xenial_amd64.deb

Prosody 747 installed & Lua5.1

root@brian:~# prosodyctl about
Prosody trunk nightly build 747 (2017-02-19, 428d4abee723)

Prosody directories

Data directory: /var/lib/prosody
Config directory: /etc/prosody
Source directory: /usr/lib/prosody
Plugin directories:
/usr/lib/prosody/modules/

Lua environment

Lua version: Lua 5.1

Lua module search paths:
/usr/lib/prosody/?.lua
/usr/local/share/lua/5.1/?.lua
/usr/local/share/lua/5.1/?/init.lua
/usr/local/lib/lua/5.1/?.lua
/usr/local/lib/lua/5.1/?/init.lua
/usr/share/lua/5.1/?.lua
/usr/share/lua/5.1/?/init.lua
/home/ubuntu/.luarocks/share/lua/5.1/?.lua
/home/ubuntu/.luarocks/share/lua/5.1/?/init.lua

Lua C module search paths:
/usr/lib/prosody/?.so
/usr/local/lib/lua/5.1/?.so
/usr/lib/x86_64-linux-gnu/lua/5.1/?.so
/usr/lib/lua/5.1/?.so
/usr/local/lib/lua/5.1/loadall.so
/home/ubuntu/.luarocks/lib/lua/5.1/?.so

LuaRocks: Installed (2.4.2)

Lua module versions

lfs: LuaFileSystem 1.6.3
libevent: 2.1.8-stable
luaevent: 0.4.6
lxp: LuaExpat 1.3.0
socket: LuaSocket 3.0-rc1
ssl: 0.6

I noticed the jitsi plugin directory is missing in the Prosody directories

But lets not deviate too much from the script.

Back to the install

root@brian:~# Copy/Paste

luarocks install luacrypto2 &&
mkdir src &&
cd src &&
luarocks download lua-cjson &&
luarocks unpack lua-cjson-2.1.0.6-1.src.rock &&
cd lua-cjson-2.1.0.6-1/lua-cjson &&
sed -i ‘s/lua_objlen/lua_rawlen/g’ lua_cjson.c &&
sed -i 's|(PREFIX)/include|/usr/include/lua5.2|g' Makefile && luarocks make && cd && apt install git cmake liblua5.1-0-dev -y && git clone https://github.com/evanlabs/luacrypto && cd luacrypto && luarocks make && cd && luarocks install luajwtjitsi && cd && wget https://prosody.im/files/prosody-debian-packages.key -O- | sudo apt-key add - && echo deb http://packages.prosody.im/debian (lsb_release -sc) main | sudo tee -a /etc/apt/sources.list &&
apt-get update -y &&
apt-get upgrade -y

Great everything built for me

Skipping prosody install,
as we did it above with the trunk version, apt-get install prosody looked to install a newer version of Lua.

chown root:prosody /etc/prosody/certs/localhost.key &&
chmod 644 /etc/prosody/certs/localhost.key &&

Skipping Reboot.
I’m not clear on the purpose of this. Is this to update the path ?
source ~./bashrc

cp /etc/prosody/certs/localhost.key /etc/ssl &&
apt-get install nginx -y &&
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add - &&
echo ‘deb https://download.jitsi.org stable/’ > /etc/apt/sources.list.d/jitsi-stable.list
apt-get -y update &&
apt-get install jitsi-meet -y &&
apt-get install jitsi-meet-tokens -y

Followed the rest of the guide, updated the config files and restarted services

Error

systemctl restart nginx prosody jicofo jitsi-videobridge2
tail -f -n 350 /var/log/prosody/prosody.log | grep error

Aug 25 00:24:53 modulemanager error Error initializing module ‘auth_token’ on ‘brian.brian.net’: /usr/share/lua/5.1/luarocks/loader.lua:147: error loading module ‘cjson’ from file ‘/usr/local/lib/lua/5.1/cjson.so’:
Aug 25 00:24:53 portmanager error Error binding encrypted port for https: No key present in SSL/TLS configuration for https port 5281
Aug 25 00:24:53 portmanager error Error binding encrypted port for https: No key present in SSL/TLS configuration for https port 5281
Aug 25 00:24:53 modulemanager error Error initializing module ‘auth_token’ on ‘guest.brian.brian.net’: /usr/bin/prosody:185: loop or previous error loading module ‘luajwtjitsi’
Aug 25 00:24:53 modulemanager error Error initializing module ‘token_verification’ on ‘conference.brian.brian.net’: /usr/bin/prosody:185: loop or previous error loading module ‘luajwtjitsi’
Aug 25 00:24:57 c2s561026514590 error Traceback[c2s]: /usr/lib/prosody/modules/mod_posix.lua:123: bad argument #3 to ‘format’ (string expected, got nil)
Aug 25 00:24:57 c2s56102639f320 error Traceback[c2s]: /usr/lib/prosody/modules/mod_posix.lua:123: bad argument #3 to ‘format’ (string expected, got nil)
il)

Next moving to another install method

Purge/Fresh install jitsi-meet

apt-get purge jigasi jitsi-meet jitsi-meet-web-config jitsi-meet-prosody jitsi-meet-turnserver jitsi-meet-web jicofo jitsi-videobridge2 prosody

luarocks remove --force basexx
luarocks remove --force lbase64
luarocks remove --force luacrypto
luarocks remove --force lua-cjson
luarocks remove --force luajwtjitsi
wget https://packages.prosody.im/debian/pool/main/p/prosody-trunk/prosody-trunk_1nightly1253-1~buster_amd64.deb
sudo apt install lua5.1
sudo dpkg -i prosody-trunk_1nightly1253-1~buster_amd64.deb

sudo apt install git cmake luarocks libssl-dev
git clone https://github.com/evanlabs/luacrypto
cd luacrypto
sudo luarocks make
cd …
sudo rm -rf luacrypto/

sudo apt install liblua5.2
sudo luarocks install lua-cjson
sudo luarocks install lbase64
sudo luarocks install basexx
sudo luarocks install luajwtjitsi

sudo ln -s /usr/local/lib/lua/crypto.so /usr/local/lib/lua/5.1/crypto.so

sudo apt install jitsi-meet-tokens

In my ubuntu 20.04 it’s working fine, Please visit GitHub issue and check my comment there username: bhar4t