Skip to content

This package provides a whitelist and blacklist feature to restrict access to your Laravel application and Filament admin panel. For additional functionality, please refer to the Laravel Firewall package.

License

Notifications You must be signed in to change notification settings

solutionforest/filament-firewall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important

Please note that we will only be updating to version 2.x, excluding any bug fixes.

Filament Firewall

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a whitelist and blacklist feature to restrict access to your Laravel application and Filament admin panel. For additional functionality, please refer to the Laravel Firewall package.

filament-firewall-package-1 filament-firewall-package-2

Getting Started

  1. Install the package using the composer require command:

    composer require solution-forest/filament-firewall
  2. To publish the configuration files and migrations files for this plugin, as well as automatically run migration, enter the following command:

    php artisan filament-firewall:install
  3. This package comes with WhitelistRangeMiddleware. You need to register it in $middleware in the app\Http\Kernel.php file:

    protected $middleware = [
        ...
        \SolutionForest\FilamentFirewall\Middleware\WhitelistRangeMiddleware::class,
    ];
  4. You can change the setting in the config/filament-firewall.php file to skip the middleware WhitelistRangeMiddleware check.

  5. Register the plugin in your Panel provider:

    Important: Register the plugin in your Panel provider after version 2.x

     use SolutionForest\FilamentFirewall\FilamentFirewallPanel;
    
     public function panel(Panel $panel): Panel
     {
         return $panel
             ->plugin(FilamentFirewallPanel::make());
     }

Usage

  • On the IP Firewall page, you have the ability to add IPs to either a whitelist or a blocklist. The WhitelistRangeMiddleware middleware will automatically handle whitelist IP access. If you need to block a range of IPs while allowing a specific IP, such as blocking 172.19.0.0/24 except for 172.19.0.1, you'll need to create a new Deny access record and specify the IP and prefix as '172.19.0.0' and '24'. Additionally, you'll need to add an Allow access record for the specific IP '172.19.0.1'.

filament-firewall-package-2

  • Get whitelist / blacklist records

    // whitelist
    \SolutionForest\FilamentFirewall\Facade\FilamentFirewall::getWhiteList();
    
    // blacklist
    \SolutionForest\FilamentFirewall\Facade\FilamentFirewall::getBlackList();
  • Determine whether an IP address is included in a whitelist or blacklist

    // whitelist
    \SolutionForest\FilamentFirewall\Facade\FilamentFirewall::withinWhiteList($ip);
    
    // blacklist
    \SolutionForest\FilamentFirewall\Facade\FilamentFirewall::withinBlackList($ip);

Publishing translations

php artisan vendor:publish --tag=filament-firewall-translations

Security Vulnerabilities

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

Please see License File for more information.

Credits

About

This package provides a whitelist and blacklist feature to restrict access to your Laravel application and Filament admin panel. For additional functionality, please refer to the Laravel Firewall package.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages