karolkrupa / fail2ban-bundle
Fail2BanBundle like fail2ban from linux
Installs: 42
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.1.3
- doctrine/doctrine-bundle: 2.*
- symfony/framework-bundle: 4.4.*
- symfony/orm-pack: ^1.0
- symfony/security-bundle: 4.4.*
This package is auto-updated.
Last update: 2025-09-16 04:19:27 UTC
README
Symfony Fail2banBundle like linux fail2ban
Instalation
$ composer require karolkrupa/fail2ban-bundle
Configuration
# config/packages/fail2ban.yaml fail2ban: enabled: false block_for: '30 seconds' allowed_attempts_count: 2 #config_provider: App\Service\Fail2BanConfigProvider
Configuration provider
The configuration provider is a class that can provide package configuration variables. Thanks to it you can easily store your configuration in the database.
Configuration provider implementation
To create a configuration provider, you need to create your own service that implements
the ConfigProvider interface and assign it to the config_provider
package configuration key.
Sample implementation
<?php namespace App\Service; use KarolKrupa\Fail2banBundle\ConfigProvider; class Fail2BanConfigProvider implements ConfigProvider { private $systemSettings; public function __construct(SystemSettings $systemSettings) { $this->systemSettings = $systemSettings; } public function get($name) { if($name == 'enabled') { return boolval($this->systemSettings->get('fail2ban.enabled', false)); } if($name == 'block_for') { return $this->systemSettings->get('fail2ban.block_for', null); } if($name == 'allowed_attempts_count') { return intval($this->systemSettings->get('fail2ban.attempts_count', 3)); } return false; } }