Packet filters are configurable, that is a list of packet filters can be provided in the Tigase server configuration for each component separately and for each traffic direction. This gives you a great flexibility and control over the data flow inside the Tigase server.
You can, for example load specific packet filters to all connections managers to block specific traffic or specific packet source from sending messages to users on your server. You could also reduce the server overall load by removing certain payload from all packets. Possibilities are endless.
The default configuration is generated in such a way that each components loads a single packet filter - PacketCounter for each traffic direction:
message-router/incoming-filters=tigase.server.filters.PacketCounter message-router/outgoing-filters=tigase.server.filters.PacketCounter sess-man/incoming-filters=tigase.server.filters.PacketCounter sess-man/outgoing-filters=tigase.server.filters.PacketCounter c2s/incoming-filters=tigase.server.filters.PacketCounter c2s/outgoing-filters=tigase.server.filters.PacketCounter s2s/incoming-filters=tigase.server.filters.PacketCounter s2s/outgoing-filters=tigase.server.filters.PacketCounter bosh/incoming-filters=tigase.server.filters.PacketCounter bosh/outgoing-filters=tigase.server.filters.PacketCounter muc/incoming-filters=tigase.server.filters.PacketCounter muc/outgoing-filters=tigase.server.filters.PacketCounter
Now, let’s say you have a packet filter implemented in class: com.company.SpamBlocker. You want to disable PacketCounter on most of the components leaving it only in the message router component and you want to install SpamBlocker in all connection managers.
Please note, in case of the connection managers incoming and outgoing traffic is probably somehow opposite from what you would normally expect.
- 'incoming' is a traffic which is submitted to a component by message router and has to be further processed. For connection managers this further processing means sending it out to the network.
- 'outgoing' is a traffic which is generated by the component and goes out of the component. Such a packet is submitted to message router which then decides where to send it for further processing. For connection managers 'outgoing' traffic is all the packets just received from the network.
According to above explanation we have to apply the SpamBlocker filter to all outgoing traffic in all connection managers. At the second thought you may also decide that it might be actually useful to compare traffic shape between Bosh connections and standard XMPP c2s connections. So let’s leave packet counters for this components too.
Here is our new configuration applying SpamBlocker to connection managers and PacketCounter to a few other components:
message-router/incoming-filters=tigase.server.filters.PacketCounter message-router/outgoing-filters=tigase.server.filters.PacketCounter sess-man/incoming-filters= sess-man/outgoing-filters= c2s/incoming-filters=tigase.server.filters.PacketCounter c2s/outgoing-filters=tigase.server.filters.PacketCounter,com.company.SpamBlocker s2s/incoming-filters= s2s/outgoing-filters=com.company.SpamBlocker bosh/incoming-filters=tigase.server.filters.PacketCounter bosh/outgoing-filters=tigase.server.filters.PacketCounter,com.company.SpamBlocker muc/incoming-filters= muc/outgoing-filters=
The simplest way, right now to apply the new configuration is via init.properties file which is in details described in the Admin Guide.