Install
Works with Drupal: ^11.3 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
First beta of the 9.x branch, a major refresh of the module for Drupal ^11.3 and 12.
Warning!
If your site is behind a reverse proxy, CDN or other middleware which adds to the X_FORWARDED_FOR header or others like it, you must configure your reverse proxy settings in settings.php or the 9.x version of this module will block all traffic instead .
Highlights since 8.x-4.0-beta4:
- Denied logins now fail on the login form itself with a configurable message, instead of signing the user in and straight back out. Users signed out mid-session by an IP change get a message and land on a configurable page, which is now validated so it can't point off-site or at a broken path.
- Per-user allowed ranges live on the user account instead of configuration and are edited on the user form.
- Ranges are entered one per line instead of separated by semicolons.
- Role restrictions can either remove the role for the request or end the session, and users are told when it happens.
- New drush commands for locked-out administrators:
restrict_by_ip:statusreports what is configured and whether an IP may log in, andrestrict_by_ip:allowadds an allowed range from the shell. - Other modules can alter the allowed ranges before they apply, for example to pull them from settings.php or an external service; see
restrict_by_ip.api.php. - The client IP is resolved through Drupal core's request handling and honors the
reverse_proxysettings, and a new help topic covers configuration, proxies, and lockout recovery.
Upgrading from 8.x-4.x: run database updates; semicolon-separated ranges and existing per-user restrictions are migrated automatically. If the site sits behind a reverse proxy or CDN, check the IP detection page afterwards to confirm the right client address is seen.
Under the hood the codebase is fully typed and analyzed at phpstan level 6, and the test suite runs in half the time. Please put the beta through its paces and report anything odd in the issue queue; a stable 9.0.0 will follow once it has had some real-world use.
Contributors (24)
darvanen, DrupalBDGirl, alex.bukach, amairesse, anybody, bartclarkson, bburg, eanushan, haza, kleinmp, kristen pol, loopduplicate, mcdruid, mfb, nikolay shapovalov, nubeli, relaxy, rex.barkdoll, rocketeerbkw, rviner, sheise, stijnstroobants, wrd
Changelog
Issues: 17 issues resolved.
Changes since 8.x-4.0-beta4 (compare):
Bug
- #2935827: Don't run the login-denied log message through t()
- fix: #3274832 User role is not selected on the edit page after restrcting roles by IP
- Automated Project Update Bot fixes from run 12-864040.
- fix: #3394774 Circular reference detected for service "restrict_by_ip.current_user"
Feature
- feat: #2315009 Use textareas and allow "one IP per line"
- feat: #2825927 Restrict Role by IP - Deny Access
- #3582618: Display messages when IP restriction removes roles or denies login
- feat: #3283846 Store per user IP range in database instead of config
- feat: #3419590 Option for including a IP Database
- feat: #415908 Include error message in form_set_error instead
- feat: #2092153 Drush integration
- feat: #3082413 Improve in-page help/docs
Misc
- Automated Project Update Bot fixes from run 12-884047.