Restrict SilverStripe controllers to specific IP address
This module allows SilverStripe developers to restrict access to arbitrary-defined controllers, according to a User's IP address. Requests to specific Controllers will be denied if a user's IP does not match the provided list of allowed IP addresses.
Allowed IP addresses can be set via an environment variable or via the SiteConfig.
Common use cases of the module includes:
composer require internetrix/silverstripe-controller-ip-restriction
In the following example, we are restricting access to the CMS admin as well as the
Internetrix\CMSAdminIPRestriction\AllowedIPMiddleware: enabled: true restricted_controllers: - SilverStripe\Admin\AdminRootController - SilverStripe\Dev\DevelopmentAdmin
.envfile, using a
SS_ADMIN_ALLOWED_IPSvariable. For multiple IP addresses, use a comma-limited list.
Allowed IPstab. Simply create a new record with an exact IP address and label it with the corresponding physical location (used for audit purposes)
CanBypassIPRestrictiondatabase field is set to true. This can be set when editing the member in the CMS and is only applied if the User remains a CMS Administrator.
CanBypassIPRestrictionvalue for the user can be checked. If the CMS admin or another Controller is restricted, a user must first log-in to SilverStripe via a non-restricted page (i.e A Only Logged-in Users Can View Page) before the IP Bypass will be applied.
.envor via the
SiteConfig, the restricted controllers will be inaccessible.
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem