Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Geoblock

717 sites Security covered
View on drupal.org

Geoblock allows you to restrict access based on a visitor's geographical location, using either the country the IP is registered in or where it's being used from. You can set up rules to allow or block specific countries, enforce that a visitor must be in the country their IP is registered in, and apply these restrictions to certain HTTP request methods like POST for spam prevention.

Introduction

Geoblock is a module that allows you to configure geographical access restrictions based on the geolocation results for each visitor's IP address.

An example use case that this module makes possible is to block all requests using an unsafe HTTP request method before they're processed by Drupal as a spam prevention technique.

Features

  • This module supports two dimensions of visitor geolocation consisting of a "usage country" and a "registered country." The "usage country" is the location of the IP address at the time of use, and the "registered country" is the country in which the IP address was registered.
  • This module provides two restrictions out of the box. The first restriction is a "domestic use" restriction which simply requires that the visitor's "usage country" and "registered country" are identical. The second restriction allows the site administrator to configure a list of countries which can either be exclusively allowed or blocked.
  • Restrictions can be selectively applied to a subset of HTTP requests methods (e.g., POST and PUT but not GET). By default, all unsafe HTTP request methods are selected for enforcement.
  • You can write your own data source module by implementing the GeoblockDataSourcePluginInterface and using the @GeoblockDataSource plugin annotation.
  • You can write your own restriction module by creating a service implementing the RestrictionInterface and using the geoblock_restriction service tag.

Installation

  1. Download and enable the Geoblock core module using your preferred installation method (both Composer and manual installation are supported).
  2. Find a companion data source module, then download and enable it.
  3. Consult the documentation for the data source module to determine if any additional configuration or setup is required.

Configuration

  • Configure the module's permissions by clicking "Permissions" after locating the module in Drupal's module installation interface, or by searching for the "Geoblock" section on Drupal's permissions overview page.
  • Configure the module's settings by clicking "Configure" after locating the module in Drupal's module installation interface, or by directly visiting /admin/config/geoblock.

The following settings are available for configuration:

  • Data source: The data source plugin may require further configuration; consult its documentation for further instructions. If no data source is selected, this module is effectively disabled.
  • Applicable HTTP methods: Select the HTTP request methods for which all restrictions are applied. If no methods are selected, this module is effectively disabled.
  • Enable logging: If enabled, log messages will be recorded when a restriction has been enforced.
  • Require domestic use: If enabled, any IP address being used in a different country than its registered country will be blocked.
  • Restriction type: The selected restriction type will determine how country restrictions are enforced. Available types are Do not enforce country restrictions, Allow only the selected countries, and Block the selected countries.
  • Restriction countries: Select the countries for which to apply the configured restriction type.

Activity

Total releases
1
First release
Feb 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Release date
1.1.2 Stable Feb 10, 2025