Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

country_block

5 sites No security coverage
View on drupal.org

This module allows site administrators to block access to their Drupal site based on the user's country of origin. It uses the Smart IP module to determine the user's location from their IP address. If a user is visiting from a country on the blocklist, they will be denied access and shown a configurable message.

Features

This module provides a simple yet effective way to control access to your site based on geography.

  • Block by Country: Easily block entire countries using a simple list of country codes.
  • Configurable Blocklist: An administrator can add or remove countries from the blocklist through a user-friendly interface.
  • Customizable Message: Set a custom message that will be displayed to users who are denied access.
  • Permission-based Access: Configuration is protected by a dedicated permission, ensuring only authorized users can change the settings.

This module is ideal for sites that need to restrict content based on regional licensing, comply with legal requirements, or reduce malicious traffic from specific parts of the world.

Post-Installation

Once installed, follow these steps to configure the module:

  1. Set Permissions: Navigate to the permissions page
    (/admin/people/permissions) and grant the "Administer Country Block" permission to the appropriate user roles (e.g., Administrator).
  2. Configure Settings: Go to the module's configuration page at /admin/config/system/country-block.
  3. Add Blocked Countries: In the "Blocked Countries" text area, enter the two-letter country codes (ISO 3166-1 alpha-2) for the countries you wish to block. Each code should be on a new line. For your convenience, the form includes a link to a list of country codes.
  4. Customize the Message: In the "Blocked Message" field, you can edit the default message that will be shown to users from a blocked country.
  5. Save: Click "Save configuration". The country block is now active.

Additional Requirements

This module requires the following:

  • Smart IP (smart_ip) module: This module is essential for identifying the user's country based on their IP address. The Smart IP module itself requires a configured data source (e.g., a GeoIP database) to function correctly. Please follow the installation and configuration instructions for the Smart IP module.

There are no other recommended modules for this project. However, it is highly recommended to keep the GeoIP database used by the Smart IP module up-to-date to ensure accurate country detection.

Similar projects

While other modules may provide geographic tools, Country Block is focused on simplicity and ease of use for one specific task: blocking countries. Modules like IP-based Determination of Country, City, and Language offer broader location data but do not provide a direct blocking mechanism. Country Block is a lightweight solution for those who need a simple "on/off" switch for country access.

πŸ‡ΊπŸ‡¦

This module is maintained by Ukrainian developers.

Please consider supporting Ukraine in the fight for their freedom and the safety of Europe.

Activity

Total releases
6
First release
Feb 2026
Latest release
2 months ago
Release cadence
0 days
Stability
83% stable

Release Timeline

Releases

Version Type Release date
1.0.4 Stable Feb 8, 2026
1.0.x-dev Dev Feb 8, 2026
1.0.3 Stable Feb 8, 2026
1.0.2 Stable Feb 7, 2026
1.0.1 Stable Feb 7, 2026
1.0.0 Stable Feb 7, 2026