Here's how you should install jitsi-meet-tokens on debian 10

Hello,

I see many people struggling with jitsi-meet-tokens installation on debian 10 and getting many errors.
For example :

May 22 00:57:39 modulemanager	error	Error initializing module 'auth_token' on 'local-jitsi': /usr/lib/prosody/util/startup.lua:144: module 'basexx' not found:No LuaRocks module found for basexx

Here’s a quick guide how to fix this :

  1. Install basexx
    result :

    root@cdebdf77a1fc:~# luarocks install basexx
    Installing https://luarocks.org/basexx-0.4.1-1.rockspec
    basexx 0.4.1-1 is now installed in /usr/local (license: MIT)
    
  2. Install lbase64
    result :

    root@cdebdf77a1fc:~# luarocks install lbase64
    Installing https://luarocks.org/lbase64-20120807-3.src.rock
    gcc -O2 -fPIC -I/usr/include/lua5.2 -c lbase64.c -o lbase64.o
    lbase64.c:11:10: fatal error: lua.h: No such file or directory
     #include "lua.h"
              ^~~~~~~
    compilation terminated.
    
    Error: Build error: Failed compiling object lbase64.o
    

    You can solve this error by installing liblua5.2-dev

    root@cdebdf77a1fc:~# apt-get install liblua5.2-dev
    

    result :

    root@cdebdf77a1fc:~# luarocks install lbase64
    Installing https://luarocks.org/lbase64-20120807-3.src.rock
    gcc -O2 -fPIC -I/usr/include/lua5.2 -c lbase64.c -o lbase64.o
    gcc -shared -o base64.so -L/usr/local/lib lbase64.o
    lbase64 20120807-3 is now installed in /usr/local (license: Public domain)
    
  3. Install LuaCrypto

    root@cdebdf77a1fc:~# luarocks install LuaCrypto 
    
    When you try to install LuaCrypto you get many errors (click for details)
    root@cdebdf77a1fc:~# luarocks install LuaCrypto 
    Installing https://luarocks.org/luacrypto-0.3.2-2.src.rock
    gcc -O2 -fPIC -I/usr/include/lua5.2 -c src/lcrypto.c -o src/lcrypto.o -I/usr/include
    src/lcrypto.c: In function 'digest_pnew':
    src/lcrypto.c:81:61: error: invalid application of 'sizeof' to incomplete type 'EVP_MD_CTX' {aka 'struct evp_md_ctx_st'}
         EVP_MD_CTX *c = (EVP_MD_CTX *)lua_newuserdata(L, sizeof(EVP_MD_CTX));
                                                                 ^~~~~~~~~~
    src/lcrypto.c: In function 'digest_reset':
    src/lcrypto.c:120:10: warning: implicit declaration of function 'EVP_MD_CTX_cleanup'; did you mean 'EVP_MD_CTX_create'? [-Wimplicit-function-declaration]
         if (!EVP_MD_CTX_cleanup(c))
              ^~~~~~~~~~~~~~~~~~
              EVP_MD_CTX_create
    src/lcrypto.c: In function 'encrypt_pnew':
    src/lcrypto.c:331:69: error: invalid application of 'sizeof' to incomplete type 'EVP_CIPHER_CTX' {aka 'struct evp_cipher_ctx_st'}
         EVP_CIPHER_CTX *c = (EVP_CIPHER_CTX *)lua_newuserdata(L, sizeof(EVP_CIPHER_CTX));
                                                                         ^~~~~~~~~~~~~~
    src/lcrypto.c: In function 'encrypt_fencrypt':
    src/lcrypto.c:425:20: error: storage size of 'c' isn't known
         EVP_CIPHER_CTX c;
                        ^
    src/lcrypto.c: In function 'decrypt_pnew':
    src/lcrypto.c:470:69: error: invalid application of 'sizeof' to incomplete type 'EVP_CIPHER_CTX' {aka 'struct evp_cipher_ctx_st'}
         EVP_CIPHER_CTX *c = (EVP_CIPHER_CTX *)lua_newuserdata(L, sizeof(EVP_CIPHER_CTX));
                                                                         ^~~~~~~~~~~~~~
    src/lcrypto.c: In function 'decrypt_fdecrypt':
    src/lcrypto.c:561:20: error: storage size of 'c' isn't known
         EVP_CIPHER_CTX c;
                        ^
    src/lcrypto.c: In function 'hmac_pnew':
    src/lcrypto.c:604:57: error: invalid application of 'sizeof' to incomplete type 'HMAC_CTX' {aka 'struct hmac_ctx_st'}
         HMAC_CTX *c = (HMAC_CTX *)lua_newuserdata(L, sizeof(HMAC_CTX));
                                                             ^~~~~~~~
    src/lcrypto.c: In function 'hmac_fnew':
    src/lcrypto.c:621:5: warning: implicit declaration of function 'HMAC_CTX_init'; did you mean 'HMAC_CTX_new'? [-Wimplicit-function-declaration]
         HMAC_CTX_init(c);
         ^~~~~~~~~~~~~
         HMAC_CTX_new
    src/lcrypto.c: In function 'hmac_clone':
    src/lcrypto.c:631:5: error: dereferencing pointer to incomplete type 'HMAC_CTX' {aka 'struct hmac_ctx_st'}
         *d = *c;
         ^~
    src/lcrypto.c: In function 'hmac_gc':
    src/lcrypto.c:697:5: warning: implicit declaration of function 'HMAC_CTX_cleanup'; did you mean 'HMAC_CTX_get_md'? [-Wimplicit-function-declaration]
         HMAC_CTX_cleanup(c);
         ^~~~~~~~~~~~~~~~
         HMAC_CTX_get_md
    src/lcrypto.c: In function 'hmac_fdigest':
    src/lcrypto.c:711:14: error: storage size of 'c' isn't known
         HMAC_CTX c;
                  ^
    src/lcrypto.c: In function 'sign_pnew':
    src/lcrypto.c:747:61: error: invalid application of 'sizeof' to incomplete type 'EVP_MD_CTX' {aka 'struct evp_md_ctx_st'}
         EVP_MD_CTX *c = (EVP_MD_CTX *)lua_newuserdata(L, sizeof(EVP_MD_CTX));
                                                                 ^~~~~~~~~~
    src/lcrypto.c: In function 'sign_fsign':
    src/lcrypto.c:828:20: error: storage size of 'c' isn't known
             EVP_MD_CTX c;
                        ^
    src/lcrypto.c: In function 'verify_pnew':
    src/lcrypto.c:857:61: error: invalid application of 'sizeof' to incomplete type 'EVP_MD_CTX' {aka 'struct evp_md_ctx_st'}
         EVP_MD_CTX *c = (EVP_MD_CTX *)lua_newuserdata(L, sizeof(EVP_MD_CTX));
                                                                 ^~~~~~~~~~
    src/lcrypto.c: In function 'verify_fverify':
    src/lcrypto.c:940:20: error: storage size of 'c' isn't known
             EVP_MD_CTX c;
                        ^
    src/lcrypto.c: In function 'rand_pseudo_bytes':
    src/lcrypto.c:992:5: warning: 'RAND_pseudo_bytes' is deprecated [-Wdeprecated-declarations]
         return rand_do_bytes(L, RAND_pseudo_bytes);
         ^~~~~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from /usr/include/openssl/err.h:13,
                     from src/lcrypto.c:7:
    /usr/include/openssl/rand.h:44:1: note: declared here
     DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
     ^~~~~~~~~~~~~~~~~~
    src/lcrypto.c: In function 'pkey_generate':
    src/lcrypto.c:1064:9: warning: 'RSA_generate_key' is deprecated [-Wdeprecated-declarations]
             RSA *rsa = RSA_generate_key(key_len, RSA_F4, NULL, NULL);
             ^~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from /usr/include/openssl/err.h:13,
                     from src/lcrypto.c:7:
    /usr/include/openssl/rsa.h:234:1: note: declared here
     DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
     ^~~~~~~~~~~~~~~~~~
    src/lcrypto.c:1074:9: warning: 'DSA_generate_parameters' is deprecated [-Wdeprecated-declarations]
             DSA *dsa = DSA_generate_parameters(key_len, NULL, 0, NULL, NULL, NULL, NULL);
             ^~~
    In file included from /usr/include/openssl/e_os2.h:13,
                     from /usr/include/openssl/err.h:13,
                     from src/lcrypto.c:7:
    /usr/include/openssl/dsa.h:117:1: note: declared here
     DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits,
     ^~~~~~~~~~~~~~~~~~
    src/lcrypto.c: In function 'pkey_to_pem':
    src/lcrypto.c:1164:27: error: dereferencing pointer to incomplete type 'struct evp_pkey_st'
         if (private && pkey_st->type == EVP_PKEY_DSA)
                               ^~
    src/lcrypto.c: In function 'pkey_tostring':
    src/lcrypto.c:1277:60: error: dereferencing pointer to incomplete type 'EVP_PKEY' {aka 'struct evp_pkey_st'}
         sprintf(buf, "%s %s %d %p", LUACRYPTO_PKEYNAME, (*pkey)->type == EVP_PKEY_DSA ? "DSA" : "RSA", EVP_PKEY_bits(*pkey), pkey);
                                                                ^~
    src/lcrypto.c: In function 'seal_pnew':
    src/lcrypto.c:1299:46: error: invalid application of 'sizeof' to incomplete type 'EVP_CIPHER_CTX' {aka 'struct evp_cipher_ctx_st'}
         c->ctx = (EVP_CIPHER_CTX *)malloc(sizeof(EVP_CIPHER_CTX));
                                                  ^~~~~~~~~~~~~~
    In file included from src/lcrypto.c:8:
    src/lcrypto.c: In function 'seal_tostring':
    src/lcrypto.c:1320:81: error: dereferencing pointer to incomplete type 'EVP_CIPHER_CTX' {aka 'struct evp_cipher_ctx_st'}
         sprintf(s, "%s %p %s", LUACRYPTO_SEALNAME, (void *)c, EVP_CIPHER_name(c->ctx->cipher));
                                                                                     ^~
    src/lcrypto.c: In function 'seal_fseal':
    src/lcrypto.c:1400:20: error: storage size of 'ctx' isn't known
         EVP_CIPHER_CTX ctx;
                        ^~~
    src/lcrypto.c: In function 'open_pnew':
    src/lcrypto.c:1483:46: error: invalid application of 'sizeof' to incomplete type 'EVP_CIPHER_CTX' {aka 'struct evp_cipher_ctx_st'}
         c->ctx = (EVP_CIPHER_CTX *)malloc(sizeof(EVP_CIPHER_CTX));
                                                  ^~~~~~~~~~~~~~
    src/lcrypto.c: In function 'open_fopen':
    src/lcrypto.c:1602:20: error: storage size of 'ctx' isn't known
         EVP_CIPHER_CTX ctx;
                        ^~~
    
    Error: Build error: Failed compiling object src/lcrypto.o
    

    Here’s a workaround (I believe it is not the only one but it works) :

    root@cdebdf77a1fc:~# wget http://ftp.fr.debian.org/debian/pool/main/o/openssl1.0/libssl1.0-dev_1.0.2u-1~deb9u1_amd64.deb http://ftp.fr.debian.org/debian/pool/main/o/openssl1.0/libssl1.0.2_1.0.2u-1~deb9u1_amd64.deb
    root@cdebdf77a1fc:~# apt remove libssl-dev
    root@cdebdf77a1fc:~# dpkg -i libssl1.0.2_1.0.2u-1~deb9u1_amd64.deb && dpkg -i libssl1.0-dev_1.0.2u-1~deb9u1_amd64.deb 
    root@cdebdf77a1fc:~# luarocks install LuaCrypto
    
  4. Install luajwtjitsi :
    root@cdebdf77a1fc:~# luarocks install luajwtjitsi
    You’ll see this warning

    lua_cjson.c: In function 'json_append_data':
    lua_cjson.c:743:19: warning: implicit declaration of function 'lua_objlen'; did you mean 'lua_len'? [-Wimplicit-function-declaration]
                 len = lua_objlen(l, -1);
                       ^~~~~~~~~~
                       lua_len 
    

    Here’s how to solve it

  5. And finally install jitsi-meet-tokens
    root@cdebdf77a1fc:~# apt install jitsi-meet-tokens
    and follow the guide

Cheers!