Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Role Theme Switcher Module role_theme_switcher crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

This module restricts access to the user login page, and optionally other user-related pages like registration and password reset, to a pre-defined list of IP addresses. It can also be configured to hide restricted pages by returning a 404 error instead of a 403 forbidden error.

This project lets you restrict access to /user/login page by user IP address.

Features

When allowed IP addresses are set, the /user/login page (including the REST login at /user/login?_format=json) will be accessible only for those addresses and return 403 response for all not-white-listed IP addresses.

In 1.1.x the protection was extended:

  • You can optionally restrict other login-related pages too: user registration, password reset, one-time login links, the login status endpoint and the /user page.
  • You can choose to return a 404 "Not Found" response instead of 403, so the restricted pages appear not to exist at all.

Post-Installation

Visit /admin/config/people/restrict_login_ip to set the list of allowed IP addresses or ranges (in CIDR format) separated by semicolon.

Alternatively, you can set those as $config['restrict_login_ip.settings']['ip_ranges'] in settings.php.

When the variable is empty, the login page is accessible to all IP addresses.

In 1.1.x the same settings page also lets you choose which additional pages to protect and whether to return 404 instead of 403. The module also shows a warning on the status report if another authentication method (such as basic auth) is enabled, since those can bypass the IP check.

Similar projects

This module was created as a replacement for the Restrict Login or Role Access by IP Address module. The differences is that this module:

  1. Checks access to the login page instead of checking it after a user submitted the login form.
  2. Does not log out a user if they changed IP address after login.
  3. Does not block other login methods (like SSO).

Activity

Tracked releases
4
Tracked since
May 2026
Latest release
2 months ago
Releases (12 mo)
4 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.0.0 Stable May 24, 2026
1.1.0-alpha1 Pre-release May 24, 2026
1.1.x-dev Dev May 24, 2026
1.0.0-alpha3 Pre-release May 24, 2026