Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

Concept

This module allows administrators to restrict access to the site to an administrator defined set of IP addresses. Anyone trying to access the site from an IP address not in the list of allowed IP addresses will be redirected to an access denied page with the message "Your address is not in the list of allowed IP addresses". No blocks will be rendered, and no JavaScript will be added to the page. This will happen for any and all pages these users try to access. The module also has various configuration options to whitelist or blacklist pages, bypass IP checking by role, and alter the output when the user is blocked.

Features

  • IP check can be bypassed by role. Roles are selected on the site permissions page, after enabling this feature on the module settings page
  • When roles are allowed to be bypassed, users can either be redirected to the login page, or be shown a link to the login page on the access denied page
  • IP checking can be set for the entire site (check IP addresses on any and all paths), selected paths can be blacklisted (check IP addresses only on those paths), or selected paths can be whitelisted (check IP addresses on all paths other than those paths)
  • Countries can be whitelisted (only users from those countries will be allowed access) or blacklisted (users from those countries will not be allowed access). Note that this functionality requires the following modules:
  • Regions on the page can be whitelisted by implementing hook_restrict_ip_whitelisted_regions() (see restricted_ip.api.php)
  • JavaScript files can be whitelisted by implementing hook_restrict_ip_whitelisted_js_keys() (see restricted_ip.api.php)
  • The output on the access denied page can be changed/added to/removed by implementing hook_restrict_ip_access_denied_page_alter() (see restricted_ip.api.php)
  • Comments can be added to the configuration page, allowing users to leave notes on which IP address (or range) is for what. Comments of the following formats are allowed:
    • //comments
    • #comment
    • /*
      comments
      */
  • The README.txt contains recipes on how to perform various actions, and customize the output when a user is restricted by IP address
  • Denied access attempts can be logged to to the Drupal log. This requires the Database logging (dblog aka watchdog) module to be enabled, and the box to be checked on the settings page.
  • Whitelisted URLs can be added to the settings.php file, by creating the following array (see Configuration override system for details)
    • D8: $config['ip_whitelist']. Example:

      $config['ip_whitelist'] = ['127.0.0.1'];

    • D7: $conf['restrict_ip_whitelist']. Example:

      $conf['restrict_ip_whitelist'] = array('127.0.0.1');

Installation

  1. Install the module as you would any other module
  2. Navigate to Admin -> Configuration -> People -> IP Address Whitelist
  3. Enter enter allowed IP addresses. You can enter either a single address in IPv4 or IPv6 format, or a range of addresses in the form of AAA.BBB.CCC.XXX - AAA.BBB.CCC.YYY. Each address or range of addresses should go on a separate line.
  4. Ensure the 'Enable module' checkbox is checked
  5. Submit the form to enable the module

Warning

If you enable IP restriction and do not enter your own IP address, you will be locked out of the site immediately upon save. Your own IP address is given on the settings page so that you can enter it into the list. If you do accidentally lock yourself out of your site, see the README.txt file for instructions on how to get back access to the site.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 3
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
5.0.1 Stable Jan 14, 2025
5.0.0 Stable Dec 24, 2024
5.0.x-dev Dev Dec 24, 2024