The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download | Blog
Personal tools

Modules/filter

From Inspire IRCd (InspIRCd)

Jump to: navigation, search

Description

Allows filtering of text from private and channel messages and notices, part messages and quit messages, for abuse prevention and realtime blocking of viruses and worms.

Configuration Tags

To use this module you should add the following tag to your Configuration file:
<include file="filter.conf">

You should then create a filter.conf file, which contains filter entries. The filter.conf is a standard styled config file, containing tags formatted like the one below:

<keyword pattern="*qwerty*" reason="You qwertied!" action="gline" duration="1h6s" flags="pn">

The patterns used are standard glob patterns which match against any PRIVMSG, PART, QUIT or NOTICE command. The action variable can be one of three values:

  • kill - Disconnects the user if they match the pattern, giving the value of 'reason' as the quit reason. When the 'kill' type is matched in a QUIT message, this acts identically to 'block', as there is little point in sending a KILL for a user who is quitting anyway.
  • block - Blocks the whole line and informs all opers with +s that the line was blocked, and who sent it, along with the reason text. In the case of PART and QUIT messages, a reason matching a block is replaced with 'Reason filtered', as it is not possible to block the whole line without desynching clients.
  • none - Do nothing except log the match. This is the default if the action variable is omitted from the tag.
  • gline - Set a gline on the user's IP address, lasting for 'duration' minutes, or permenant if the duration is omitted from the tag.
  • silent - This blocks the line only, and informs the user their message was blocked, but does not notify opers.


See below for a definition of valid flags for the flags field.


NOTE: From 1.1 b5 onwards, you don't have to seperate out your filter definitions into a seperate file like this, although it keeps things tidy and is still recommended.

Additional Modes

None

Additional Commands

/FILTER <filter-definition> [<action> <flags> [<gline-duration>] :<reason>]

This command will add a filter when more than one parameter is given, using the specified filter definition, action, gline duration (when the type is 'gline') and reason. When only one parameter is provided (the filter pattern) the provided filter will be removed. Note that if you remove a configuration-defined filter, it will re-appear at next rehash unless it is also removed from the config file.

Flags

The flags field is used to indicate what the filter affects:

  • p - Block private and channel messages
  • n - Block private and channel notices
  • P - Block part messages
  • q - Block quit messages
  • o - Don't match against opers
  • * - Represents all of the above flags
  • - - Does nothing, a non-op for when you do not want to specify any flags

Listing Filters

The following command will generate a list of all filters set on the server specified(optional)

/stats s [servername]

Special Notes

Please note that while glob patterns are faster to match than regular expressions (such a those used in unrealircd, etc) a large number of them can still impede performance (e.g. a hundred or more), and the more users you have, the less patterns you will be able to have without crippling your irc server. Filtering is always done locally, so if you have over 2000 users per server, consider other alternatives where possible.

If you wish to use regular expressions instead of glob patterns, please consider using the m_filter_pcre module.

Conflicts

This module may not be used at the same time as m_filter_pcre.so.