nvonahsen / jitsi-token-moderation-plugin

Lua plugin for jitsi which determines whether users are moderator or not based on token contents
MIT License
166 stars 96 forks source link

module:hook("muc-room-created") not called #11

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hey,

sure this isn't an issue of this plugin, but maybe someone had similar problems / can support me with this? Just as descibed in https://github.com/jitsi/jitsi-meet/issues/7114, the plugin won't work for me because the hook is never called. Anything that could cause this issue?

bryanasdev000 commented 4 years ago

Hi @tsproesser !

So your bug is related to #8 right?

Well as soon as I get another Jitsi instance I will try to debug that.

As well as #8 I suspect a wrong configuration with the plugin or JWT authentication (or depending on your OS, even the version of Prosody can be a problem, if I remember correctly the ideal version would be Prosody 0.11.X).

FYI I am using another Jitsi instance with Debian 10 running fine with this plugin and another addition from me

NOTE: For some reason Github incorrectly linked the jitsi-meet issue, correct link is Roles in default JWT implementation #7114

ghost commented 4 years ago

Authentication works for me - JWTs are authenticated correctly but just the hook isn't called. In my case it's "muc-room-created" that is never called, so your hooks won't get registered.

bryanasdev000 commented 4 years ago

Hi @tsproesser !

Could you give me more information about your deploy?

Just to try to direct you, if the JWT is working correctly, my suspicions fall on the version of Prosody and some malfunction of the plugin and / or dependency.

I have to see, I don't remember if it was in this plugin that I had to use a fork of a lib ...

Another important question, do you have any logs you could share? Maybe enable debug and / or error logs on Prosody.

You should get some output with systemctl status prosody as well.

Thanks in advance.

ghost commented 4 years ago

Hey,

right now I'm just using the latest Docker images from DockerHub with a very close-to-default configuration. In the logs I can see that the module is loaded, there are no errors, but the hook is never called.

Thank you in advance!

bryanasdev000 commented 4 years ago

I never touched the installation of Jitsi in Docker, I will research.

nvonahsen commented 4 years ago

Hey, We've actually recent switched to the Jitsi docker setup, I believe we are using the latest jitsi docker release as of a week or two ago and it is working fine. Just to dump some ideas (warning: large stream of consciousness ahead):

  1. If you are in a 1-on-1 call, by default i believe jitsi handles various things differently and i'm never sure exactly what issues it might cause. You can disable this, from memory set p2p to false in the jitsi meet front-end config.
  2. Could dig around in the prosody code base to work out where the 'muc-room-created' hook is meant to be called and kinda follow it up till the highest level where things break, might shed some more light on exactly what is going wrong.
  3. Vaguely remember needing to install a fork of a lua library for some OS versions, something like luajwt..... although im pretty sure this was at the point of getting the standard jitsi jwt module to work which sounds like its already working for you.
  4. Vaguely remember one of prosody's encryption options causing some issues at some point could try switching c2s and s2c encryption flags in the prosody lua config files to false, again not 100% sure which file they are in but i know its one of the config files in the 'your-sub-domain' folder.
  5. Do you have any other modules installed? it feels like if jitsi and prosody are working it is unlikely that the functions that call the hooks are not being run at all as i think they correspond to some pretty important prosody features, perhaps some other module or feature is removing the hooks or preventing them being fired.
  6. Perhaps something to do with room creation? I know in my setup I have essentially random room names generated for every call i just let jitsi create the room automatically when the first user (generally the moderator) navigates to jitsi-domain/room-name. Im not sure if jitsi/prosody even makes this possible but are you maybe using some other method to generate rooms? I'm imagining maybe there is an api or they are being created from the jitsi welcome page or something?
  7. I am using the jitsi external api https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-iframe on my frontend to connect to calls, perhaps a different setup would encounter issues?
  8. Just as a sanity check, are you 100% sure you are actually connecting to the same hosted jitsi meet that you are looking at the logs for? I can just imagine this being a case of URL typo.

Sorry i couldn't be more help, most of these ideas seem pretty unlikely to be the problem tbh, if i have any other ideas I'll let you know.

bryanasdev000 commented 4 years ago

Hey, We've actually recent switched to the Jitsi docker setup, I believe we are using the latest jitsi docker release as of a week or two ago and it is working fine. Just to dump some ideas (warning: large stream of consciousness ahead):

  1. If you are in a 1-on-1 call, by default i believe jitsi handles various things differently and i'm never sure exactly what issues it might cause. You can disable this, from memory set p2p to false in the jitsi meet front-end config.
  2. Could dig around in the prosody code base to work out where the 'muc-room-created' hook is meant to be called and kinda follow it up till the highest level where things break, might shed some more light on exactly what is going wrong.
  3. Vaguely remember needing to install a fork of a lua library for some OS versions, something like luajwt..... although im pretty sure this was at the point of getting the standard jitsi jwt module to work which sounds like its already working for you.
  4. Vaguely remember one of prosody's encryption options causing some issues at some point could try switching c2s and s2c encryption flags in the prosody lua config files to false, again not 100% sure which file they are in but i know its one of the config files in the 'your-sub-domain' folder.
  5. Do you have any other modules installed? it feels like if jitsi and prosody are working it is unlikely that the functions that call the hooks are not being run at all as i think they correspond to some pretty important prosody features, perhaps some other module or feature is removing the hooks or preventing them being fired.
  6. Perhaps something to do with room creation? I know in my setup I have essentially random room names generated for every call i just let jitsi create the room automatically when the first user (generally the moderator) navigates to jitsi-domain/room-name. Im not sure if jitsi/prosody even makes this possible but are you maybe using some other method to generate rooms? I'm imagining maybe there is an api or they are being created from the jitsi welcome page or something?
  7. I am using the jitsi external api https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-iframe on my frontend to connect to calls, perhaps a different setup would encounter issues?
  8. Just as a sanity check, are you 100% sure you are actually connecting to the same hosted jitsi meet that you are looking at the logs for? I can just imagine this being a case of URL typo.

Sorry i couldn't be more help, most of these ideas seem pretty unlikely to be the problem tbh, if i have any other ideas I'll let you know.

  1. I did this with a clean installation on Debian 10, I don't remember the exact fork but it had to do with luajwt (as I remember the old one did not compile with the current version of OpenSSL).

  2. Well, I need to check, but I think that in my domain it is true.

6 and 7. Me too, and I generate based on Moodle input, and I think that doesn't affect it.

  1. I did this in my first setup: P
ghost commented 4 years ago

Hey, We've actually recent switched to the Jitsi docker setup, I believe we are using the latest jitsi docker release as of a week or two ago and it is working fine. Just to dump some ideas (warning: large stream of consciousness ahead):

  1. If you are in a 1-on-1 call, by default i believe jitsi handles various things differently and i'm never sure exactly what issues it might cause. You can disable this, from memory set p2p to false in the jitsi meet front-end config.
  2. Could dig around in the prosody code base to work out where the 'muc-room-created' hook is meant to be called and kinda follow it up till the highest level where things break, might shed some more light on exactly what is going wrong.
  3. Vaguely remember needing to install a fork of a lua library for some OS versions, something like luajwt..... although im pretty sure this was at the point of getting the standard jitsi jwt module to work which sounds like its already working for you.
  4. Vaguely remember one of prosody's encryption options causing some issues at some point could try switching c2s and s2c encryption flags in the prosody lua config files to false, again not 100% sure which file they are in but i know its one of the config files in the 'your-sub-domain' folder.
  5. Do you have any other modules installed? it feels like if jitsi and prosody are working it is unlikely that the functions that call the hooks are not being run at all as i think they correspond to some pretty important prosody features, perhaps some other module or feature is removing the hooks or preventing them being fired.
  6. Perhaps something to do with room creation? I know in my setup I have essentially random room names generated for every call i just let jitsi create the room automatically when the first user (generally the moderator) navigates to jitsi-domain/room-name. Im not sure if jitsi/prosody even makes this possible but are you maybe using some other method to generate rooms? I'm imagining maybe there is an api or they are being created from the jitsi welcome page or something?
  7. I am using the jitsi external api https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-iframe on my frontend to connect to calls, perhaps a different setup would encounter issues?
  8. Just as a sanity check, are you 100% sure you are actually connecting to the same hosted jitsi meet that you are looking at the logs for? I can just imagine this being a case of URL typo.

Sorry i couldn't be more help, most of these ideas seem pretty unlikely to be the problem tbh, if i have any other ideas I'll let you know.

Did you mean you are using this plugin with Docker and it is working for you? Are you using the "latest" version of all the containers right now? Than I really don't get why it should behave different for me. Thank you very much for your support! But it seams like all your points are ok for me. Bzw, I've disabled p2p so Jitsi uses the video bridge even in a 1-on-1 call but that did noch change this problem.

Weird thing is that the plugin definitely gets loaded but the hook is never called. I've even added this hook to check and it works:

module:add_timer(10, function()
        log('info','Test');
end);
nvonahsen commented 4 years ago

Yeah we are using it with the Docker release from https://github.com/jitsi/docker-jitsi-meet/ Looks like we last updated on 11 July, and the most recent release is 27 May so assuming you are using this too we should be on the same version.

Any chance you cloned/installed from the master branch rather than latest release build? looks like there are a few changes on master that haven't been published as a release.

ghost commented 4 years ago

jitsi/jicofo:latest (stable-4627-1) jitsi/jvb:latest (stable-4627-1) jitsi/prosody:latest (stable-4627-1) jitsi/web:latest (stable-4627-1)

These are the images we are using - almost stock configured. Added the lua-module and edited config file "/prosody/config/conf.d/jitsi-meet.cfg.lua" ("modules_enabled", "token_moderation"). And add_timer-hook of the module writes to log. Anything I could have missed?

Edit: Sorry for pushing - but no idea? I'd really love to see it up & running!

aclaghorn commented 4 years ago

This is how I fixed it. Instructions were a little unclear.

In my .env file:

# Enable authentication
ENABLE_AUTH=1

# Select authentication type: internal, jwt or ldap
AUTH_TYPE=jwt
JWT_TOKEN_AUTH_MODULE=token_verification

# Custom Prosody modules for MUC component (comma separated)
XMPP_MUC_MODULES=token_moderation
bryanasdev000 commented 4 years ago

Hi @tsproesser !

Did you have success in your try? In the mean time @stablestud added some instructions on the README.md to get up & running with docker based deploy.

ghost commented 4 years ago

Thank you very much, we managed it via @aclaghorn 's post 👍

bryanasdev000 commented 4 years ago

Cool! Then I will close this issue :D

cyril-barragan commented 8 months ago

Maybe this will save time for someone :

I couldn't get it to work until I realized there was a 3rd parameter to handle priority. I set it to random high value and I finally got the log.

module:hook("muc-room-created", function(event)
    log('info', '---- ROOM CREATED');
end, 50);