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

Spam control #1123

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Spam control #1123

wants to merge 8 commits into from

Conversation

bartekgorny
Copy link
Collaborator

This PR adds a spam control feature.

There are minor changes to ejabberd_c2s, which provide a way to write and attach a custom
spam control plugin, which would process all messages and react if necessary. Includes a simple
throughput-based plugin.

@Nyco
Copy link
Contributor

Nyco commented Dec 15, 2016

s/spam/spim/ ?

@michalwski
Copy link
Contributor

s/spam/overuse/ ?
s/spam/load/ ?

@bartekgorny
Copy link
Collaborator Author

As the name of the sample module, load or overload would be fine. But names of the hooks should be more generic - you can implement any type of spam protection, content-based, blacklisting senders, whatever, or even do useful stuff not related to spam at all.

@fenek
Copy link
Member

fenek commented Dec 15, 2016

"abuse" is even more generic than "spam". :)

@bartekgorny
Copy link
Collaborator Author

On the other hand, one could use the same mechanism for rewarding users for clever things they say (if somebody invents an algorithm to tell clever things from stupid)

@@ -249,7 +250,12 @@ handle_stream_start({xmlstreamstart, _Name, Attrs}, #state{} = S0) ->
{?NS_STREAM, true} ->
change_shaper(S, jid:make(<<>>, Server, <<>>)),
Version = xml:get_attr_s(<<"version">>, Attrs),
stream_start_by_protocol_version(Version, S);
SpamCtlState = ejabberd_hooks:run_fold(spamctl_initialise,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These spamctl_* set of hooks are quite powerful. How about passing whole c2s state as an arg to the initialise hook handler so the implementation may choose what to do with it? Other solution would be passing the state to all the hooks. I can imagine that some clever logic (rewording or stopping the user) may need some of the fields which are in c2s state.

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

Successfully merging this pull request may close these issues.

4 participants