ban
393 sites
Security covered
Ban allows administrators to ban visitors or requests to their site from individual IP addresses.
Ban was a core module from Drupal 8 to 11 and has moved to contrib for Drupal 12.
#1570102: [Policy] Deprecate Ban module
Post-Installation
To ban an IP address
- Navigate to /admin/config/people/ban.
- Enter an IP address (for example, 10.0.0.1).
- Click Add.
Note Drupal will prevent you from banning your own IP address.
To remove the ban from an IP address
- Navigate to the ban page (see above).
- Beside an IP address, click Delete.
Remove a ban with Drush
These commands show all entries, removes the ban on a specific IP, and removes all bans using Drush.
drush sql:query "SELECT * from ban_ip;"
drush sql:query "DELETE FROM ban_ip WHERE ip='119.80.1.6';"
drush sql:query "TRUNCATE ban_ip;"
Recommended modules/libraries
For more advanced features and sophisticated levels of IP based protection, it is also worth considering system installed alternatives such as fail2ban.