DragonByte Tech
Well-known member
The
This is problematic because of things like automatically updating IP block lists, where even if the Cron job is executed by an user, that user should not be recorded as the banner of the IP address.
Therefore I suggest removing the
Use case: Our Security addon has an option to block TOR Exit Nodes, and a cron job that periodically updates the list of exit nodes for the server IP in question. While it's technically possible to insert records into the
---------------
EDIT: This is no longer needed thanks to the instructions from Mike
The
The Banning repository is already dynamic enough that addons wishing to add their own types of bans can do so without any further coding changes.
Use case: Our Security addon has an option to block TOR Exit Nodes, and a cron job that periodically updates the list of exit nodes for the server IP in question. While it's technically possible to insert these IPs as ban entries, the problem is that toggling that setting via the AdminCP would necessitate pruning those IPs (approx. 850 entries) and re-adding them whenever the setting is toggled.
If I had the ability to add a new match type, I could add the "dbtech_security_tornode" match type and only rebuild that cache whenever the IP list is updated, and the setting I mentioned above would only toggle whether this ban was in effect.
Fillip
IpMatch
system has the potential to be used by 3rd party add-ons to automatically ban IP addresses for various infractions, but currently using the XF:Banning :: banIp
method requires that a valid user record is either passed as an argument, or exists in \XF::visitor()
.This is problematic because of things like automatically updating IP block lists, where even if the Cron job is executed by an user, that user should not be recorded as the banner of the IP address.
Therefore I suggest removing the
'required' => true
part of the IpMatch entity, and either change the existing banIp method to allow for passing "no user, and don't default to visitor", or creating a new method like banIpAutomatic
which doesn't take a user argument. Use case: Our Security addon has an option to block TOR Exit Nodes, and a cron job that periodically updates the list of exit nodes for the server IP in question. While it's technically possible to insert records into the
xf_ip_match
table manually and rebuild the banned IPs cache manually, for compatibility with other 3rd party mods I would prefer if I was able to use the repository method for banning IP addresses.---------------
EDIT: This is no longer needed thanks to the instructions from Mike
The
IpMatch
system has the potential to be used by 3rd party add-ons to create their own filtering lists separate from Discouraged and Banned, but unfortunately the match_type
column in the xf_ip_match
table is an ENUM with fixed value options, rather than a VARCHAR.The Banning repository is already dynamic enough that addons wishing to add their own types of bans can do so without any further coding changes.
Use case: Our Security addon has an option to block TOR Exit Nodes, and a cron job that periodically updates the list of exit nodes for the server IP in question. While it's technically possible to insert these IPs as ban entries, the problem is that toggling that setting via the AdminCP would necessitate pruning those IPs (approx. 850 entries) and re-adding them whenever the setting is toggled.
If I had the ability to add a new match type, I could add the "dbtech_security_tornode" match type and only rebuild that cache whenever the IP list is updated, and the setting I mentioned above would only toggle whether this ban was in effect.
Fillip
Last edited:
Upvote
1