--mod_shit--Drop messages based on "from" or "to" headers

hi

i would like to control delivery or not of messages based on the from or to attribute of the message.
i'm trying to modify mod_shit cuz it reads from the xml sent and checks what's in the body of the message.

what i would like to do is to alter mod_shit so it checks the to or from attrib of the xml, comparing it with "BadUsers", instead of checking the body of the message.

Can any friendly soul help me on this?

thanks in advance..

Try mod_filter

You can try mod_filter. Maybe you get what you want just setting some ACL and ACCESS.

hi again well, i tried with

hi again

well, i tried with mod_filter, but i want, among other things, to allow just some msn users to comunicate with the users of my server, and i can't define acl's for external users...

Oh, you can. Try something

Oh, you can. Try something like:

{acl, good_msn_users, {user, "romeo%hotmail.com", "msn.example.com"}}.
{acl, good_msn_users, {user, "juliet%hotmail.com", "msn.example.com"}}.
{acl, msn_users, {server_glob, "msn*"}}.

{access, mod_filter,
%% filter incoming messages; allow only good messages
 [{allow, good_msn_users},
  {deny, msn_users},
%% filter the rest, including outgoing messages
  {filter_msn, all}]}.

{access, filter_msn,
%% Users can send messages to good MSN users
 [{allow, good_msn_users},
%% but not to other MSN users
  {deny, msn_users},
%% All non-MSN traffic is allowed
  {allow, all}]}.

can't login to msn anymore

well, i put that piece of configuration, but it just doesnt let any user use the MSN transport to login on MSN

i think i did nothing wrong but....here goes the code:

% Default Debian ejabberd.cfg

override_acls.
override_global.
override_local.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% ucf section

%% Admin user
{acl, admin, {user, "administrator", "nonj.domain.com"}}.

%% Hostname
{hosts, ["nonj.domain.com", "domain.com"]}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Users that have admin access. Add line like one of the following after you
% will be successfully registered on server to get admin access:
%{acl, admin, {user, "aleksey"}}.

% Blocked users:
%{acl, blocked, {user, "test"}}.

% Local users:
{acl, local, {user_regexp, ""}}.

% Another examples of ACLs:
%{acl, jabberorg, {server, "jabber.org"}}.
%{acl, aleksey, {user, "aleksey", "jabber.ru"}}.
%{acl, test, {user_regexp, "^test"}}.
%{acl, test, {user_glob, "test*"}}.

% Everybody can create pubsub nodes
{access, pubsub_createnode, [{allow, all}]}.

% Only admins can use configuration interface:
{access, configure, [{allow, admin}]}.

% Every username can be registered via in-band registration:
%{access, register, [{allow, all}]}.

% None username can be registered via in-band registration:
{access, register, [{deny, all}]}.

% After successful registration user will get message with following subject
% and body:
{welcome_message,
{"Welcome!",
"Welcome to Debian Jabber Service. "
"For information about Jabber visit http://jabber.org"}}.
% Replace them with 'none' if you don't want to send such message:
%{welcome_message, none}.

% List of people who will get notifications about registered users
%{registration_watchers, ["admin1@localhost",
% "admin2@localhost"]}.
% Only admins can send announcement messages:
{access, announce, [{allow, admin}]}.

% Only non-blocked users can use c2s connections:
{access, c2s, [{deny, blocked},
{allow, all}]}.

{acl, good_msn_users, {user, "nonj%yahoo.com", "msn.domain.com"}}.
{acl, good_msn_users, {user, "juliet%hotmail.com", "msn.domain.com"}}.
{acl, msn_users, {server_glob, "msn.domain.com"}}.

{access, mod_filter,
%% filter incoming messages; allow only good messages
[{allow, good_msn_users},
{deny, msn_users},
%% filter the rest, including outgoing messages
{filter_msn, all}]}.

{access, filter_msn,
%% Users can send messages to good MSN users
[{allow, good_msn_users},
%% but not to other MSN users
{deny, msn_users},
%% All non-MSN traffic is allowed
{allow, all}]}.

% Set shaper with name "normal" to limit traffic speed to 1000B/s
{shaper, normal, {maxrate, 1000}}.

% Set shaper with name "fast" to limit traffic speed to 50000B/s
{shaper, fast, {maxrate, 50000}}.

% For all users except admins used "normal" shaper
{access, c2s_shaper, [{none, admin},
{normal, all}]}.

% For all S2S connections used "fast" shaper
{access, s2s_shaper, [{fast, all}]}.
Admins of this server are also admins of MUC service:
{access, muc_admin, [{allow, admin}]}.

% All users are allowed to use MUC service:
{access, muc, [{allow, all}]}.

% This rule allows access only for local users:
{access, local, [{allow, local}]}.

% Authentication method. If you want to use internal user base, then use
% this line:
{auth_method, internal}.

% For LDAP authentication use these lines instead of above one:
{auth_method, ldap}.
{ldap_servers, ["localhost"]}. % List of LDAP servers
{ldap_uidattr, "uid"}. % LDAP attribute that holds user ID
{ldap_base, "dc=domain,dc=com"}. % Search base of LDAP directory

% For authentication via external script use the following:
%{auth_method, external}.
%{extauth_program, "/path/to/authentication/script"}.

% For authentication via ODBC use the following:
%{auth_method, odbc}.
%{odbc_server, "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"}.

%% Anonymous login support:
%% auth_method: anonymous
%% anonymous_protocol: sasl_anon|login_anon|both
%% allow_multiple_connections: true|false
%%{host_config, "public.example.org", [{auth_method, anonymous},
%% {allow_multiple_connections, false},
%% {anonymous_protocol, sasl_anon}]}.
%% To use both anonymous and internal authentication:
%%{host_config, "public.example.org", [{auth_method, [anonymous, internal]}]}.

% Host(s) name: (replace for your hostname(s))
% Old {host, "localhost"}. option is equivalent to {hosts, ["localhost"]}.
%{hosts, ["localhost"]}.

%% Define the maximum number of time a single user is allowed to connect:
{max_user_sessions, 10}.

% Default language for server messages
{language, "en"}.
% Listened ports:
{listen,
% Ordinary client-2-server service
[{5222, ejabberd_c2s, [{access, c2s},
{max_stanza_size, 65536},
starttls, {certfile, "/etc/ejabberd/ejabberd.pem"},
{shaper, c2s_shaper}]},

% SSL-enabled client-2-server service
{5223, ejabberd_c2s, [{access, c2s},
{max_stanza_size, 65536},
tls, {certfile, "/etc/ejabberd/ejabberd.pem"},
{shaper, c2s_shaper}]},

% Server-2-server service
{5269, ejabberd_s2s_in, [{shaper, s2s_shaper},
{max_stanza_size, 131072}]},

% External MUC jabber-muc (but internal mod_muc is better :))
% {5554, ejabberd_service, [{ip, {127, 0, 0, 1}},
% {access, all},
% {host, "muc.localhost", [{password, "secret"}]}]},

% Jabber ICQ Transport
% {5555, ejabberd_service, [{ip, {127, 0, 0, 1}},
% {access, all},
% {hosts, ["icq.localhost", "sms.localhost"], [{password, "secret"}]}]},

% AIM Transport
% {5556, ejabberd_service, [{ip, {127, 0, 0, 1}},
% {access, all},
% {host, "aim.localhost", [{password, "secret"}]}]},

% MSN Transport
{5347, ejabberd_service, [{access, all},
{host, "msn.domain.com", [{password, "secret"}]}]},

% Yahoo! Transport
% {5558, ejabberd_service, [{ip, {127, 0, 0, 1}},
% {access, all},
% {host, "yahoo.localhost", [{password, "secret"}]}]},

% External JUD (internal is more powerful,
% but doesn't allow to register users from other servers)
% {5559, ejabberd_service, [{ip, {127, 0, 0, 1}},
% {access, all},
% {host, "jud.localhost", [{password, "secret"}]}]},

% HTTP service (You may choose options HTTP-polling and Web-administering)
% When commenting out, be careful with commas
{5280, ejabberd_http, [http_poll, web_admin]}
]}.

% Use STARTTLS+Dialback for S2S connections
{s2s_use_starttls, true}.
{s2s_certfile, "/etc/ejabberd/ejabberd.pem"}.
%{domain_certfile, "example.org", "/etc/ejabberd/example_org.pem"}.
%{domain_certfile, "example.com", "/etc/ejabberd/example_com.pem"}.

% If SRV lookup fails, then port 5269 is used to communicate with remote server
{outgoing_s2s_port, 5269}.

% Used modules:
{modules,
[
{mod_adhoc, []},
{mod_announce, [{access, announce}]}, % Depends on mod_adhoc
{mod_register, [{access, register}]},
{mod_roster, []},
{mod_privacy, []},
{mod_configure, []}, % Depends on mod_adhoc
{mod_configure2, []},
{mod_disco, [{extra_domains, ["msn.domain.com"]}]},
{mod_stats, []},
{mod_vcard, []},
{mod_offline, []},
{mod_echo, []},
{mod_private, []},
{mod_irc, []},
{mod_filter, []},
% Default options for mod_muc:
% host: "conference." ++ ?MYNAME
% access: all
% access_create: all
% access_admin: none (only room creator has owner privileges)
{mod_muc, [{access, muc},
{access_create, muc},
{access_admin, muc_admin}]},
% {mod_muc_log, []},
% {mod_shared_roster, []},
{mod_pubsub, [{access_createnode, pubsub_createnode}]},
{mod_time, []},
{mod_last, []},
{mod_version, []}
]}.

Once again, thank u in advance.

Oh, I forgot… you need to

Oh, I forgot… you need to have the MSN transport itself among the good MSN users:

{acl, good_msn_users, {user, "", "msn.example.com"}}.

:D

Thankx a lot ppl!

It's working :D

if i was christian would say god bless u all!! :)

How i can run mod_filter with

How i can run mod_filter with ejabberd-2.1.13 to drop bad words

How i can run mod_filter with

How i can run mod_filter with ejabberd-2.1.13 to drop bad words

Hi.. i use ejabberd 2.1.13 i

Hi..
i use ejabberd 2.1.13
i was try mod_shit to filter bad msg but not work!
i want config ejabberd with mod_filter to work with isida bot and filter conferences...
"filter messages from unaffliated users through Jabber ID"
like jabber.ru
what should I do?

Thank you.

Syndicate content