Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup on ejabberd-15.10? #2

Open
eduardogoncalves opened this issue Nov 6, 2015 · 9 comments
Open

Setup on ejabberd-15.10? #2

eduardogoncalves opened this issue Nov 6, 2015 · 9 comments

Comments

@eduardogoncalves
Copy link

Hi, ejabberd-15.10 use yml format, how to you setup it?
I create the file structure under "ejabberd/.ejabberd-modules/sources/ejabberd-contrib/mod_filter" and runned "ejabberdctl module_install mod_filter" and it generates the files on "ejabberd/.ejabberd-modules/mod_filter". Then I tryed to edit ejabberd.yml and right below "access:" I added:

 mod_filter:
    allow: all
  mod_filter_presence:
    allow: all
  mod_filter_message:
    allow: all
  mod_filter_iq:
    allow: all

and in the file "ejabberd/.ejabberd-modules/mod_filter/conf/mod_filter.yml"

modules:
  mod_filter: {}

But with this, users go online but can't see each other. I think I'm having the block "mod_filter, mod_filter_presence in wrong place".

Thanks.

@karlmendes
Copy link

I think this mod dont work on new YML file config.

@damkh
Copy link

damkh commented Jul 24, 2017

Hello!
Are there plans to actualize the mod_filter to support new YML file configs?

Thanks!

@knobo
Copy link
Owner

knobo commented Jul 25, 2017

I merged @JohnBrodie's branch. Should support YML config files.

@damkh
Copy link

damkh commented Jul 25, 2017

Hi @knobo , thanks for the reply
I'm using ejabberd-17.07 on Mageia Linux 5 x86_64.

  1. I created the path /opt/ejabberd-17.07/.ejabberd-modules/sources and cloned there mod_filter:
git clone https://github.com/knobo/mod_filter.git
  1. Checked if the module was available:
./bin/ejabberdctl modules_available
mod_filter      Flexible filtering by server policy
  1. Checked if the module was ready to install and got the warning:
./bin/ejabberdctl module_check mod_filter
/opt/ejabberd-17.07/.ejabberd-modules/sources/mod_filter/src/mod_filter.erl:13: Warning: undefined callback function depends/2 (behaviour 'gen_mod')
  1. Tried to install the module and got the warning again:
./bin/ejabberdctl module_install mod_filter
/opt/ejabberd-17.07/.ejabberd-modules/sources/mod_filter/src/mod_filter.erl:13: Warning: undefined callback function depends/2 (behaviour 'gen_mod')

After installation got the directory:

tree .ejabberd-modules/mod_filter/
.ejabberd-modules/mod_filter/
|-- conf
|   `-- mod_filter.yml
|-- ebin
|   `-- mod_filter.beam
`-- mod_filter.spec

2 directories, 3 files
  1. Added the activating string in ejabberd.cfg:
modules:
...
  mod_filter: {}
  1. Restarted ejabberd service, in ejabberd.log:
gen_mod:start_module:192 loading mod_filter at example.com

But after a client connection in ejabberd.log (the connection is successfull):

2017-07-26 01:00:57.982 [error] <0.460.0>@ejabberd_hooks:safe_apply:383 Hook filter_packet crashed when running mod_filter:filter_packet/1:
** Reason = {error,function_clause,[{mod_filter,filter_packet,[{file,"/opt/ejabberd-17.07/.ejabberd-modules/sources/mod_filter/src/mod_filter.erl"},{line,31}],[{iq,<<"purple39142b9a">>,result,<<"ru">>,{jid,<<"myuser">>,<<"example.com>>,<<>>,<<"myuser">>,<<"example.com">>,<<>>},{jid,<<"myuser">>,<<"example.com">>,<<" ">>,<<"myuser">>,<<"example.com">>,<<" ">>},[],#{ip => {0,0,0,0,0,65535,24484,18326}}}]},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{ejabberd_router,do_route,[{file,"src/ejabberd_router.erl"},{line,338}],1},{ejabberd_router,route,[{file,"src/ejabberd_router.erl"},{line,87}],1},{gen_iq_handler,process_iq,[{file,"src/gen_iq_handler.erl"},{line,146}],4},{ejabberd_sm,route,[{file,"src/ejabberd_sm.erl"},{line,138}],1},{ejabberd_local,route,[{
file,"src/ejabberd_local.erl"},{line,116}],1}]}** Arguments = [{iq,<<"purple39142b9a">>,result,<<"ru">>,{jid,<<"myuser">>,<<"example.com">>,<<>>,<<"myuser">>,<<"example.com">>,<<>>},{jid,<<"myuser">>,<<"example.com">>,<<" ">>,<<"myuser">>,<<"example.com">>,<<" ">>},[],#{ip => {0,0,0,0,0,65535,24484,18326}}}]

Also could you please explain how to use mod_filter.yml, because the format used in ejabberd.cfg is slightly different. It is said in the docs that the mod_filter.yml contents should be included into ejabberd.cfg, but into which sections? There is no more "access" section in ejabberd.cfg, there is "access_rules".
I also wanted to ask you if there are any plans to update the docs for the new config format?

Here is the similar request: https://www.ejabberd.im/forum/28870/modfilter-crashes

Thanks in advance

@JohnBrodie
Copy link

@khamadiyarov The above error isn't due to config issues, it's due to changes that were made in eJabberd core. The mod_filter code will need to be updated to work with newer versions of ejabberd. The error,function_clause part of your error shows the problem - the hooks signature changed, and the current mod_filter code no longer matches.

@damkh
Copy link

damkh commented Jul 26, 2017

Hi, thanks for clarification @JohnBrodie , can I hope for a code update in the near future?

@JohnBrodie
Copy link

Possibly? @knobo are you working on this, or would you rather wait for a PR?

@knobo
Copy link
Owner

knobo commented Jul 26, 2017

I'm not working on this now. And probably not for several months.

@damkh
Copy link

damkh commented Jul 27, 2017

Hi @knobo , thanks for the comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants