Jump to content

[Free module] Fail2Ban


Recommended Posts

This module allows you to supervision the login access to your backoffice and helps fight hack attacks of type brute-force.

 

How it works

When an employee fails to login several times in a short time (both configurable), it gets banned and can't login, even with the right password, for a certain amount of time (also configurable).

On login attemps when you're banned, you will get blank screen, regardless the password.

 

How it helps

If an hacker tries to brute-force your back-end (automatically trying several thousands of email-password pair), it will soon be banned and won't be able to determine the right password even if he founds it.

 

Contribute

You'll find the module on Github, so you're invited to contribute to improve it.

 

Install

Download from attachments and upload in the "Module" section.

Check that is transplanted into "displayBackOfficeTop" position.

module_fail2ban.zip

Edited by SimoneS93 (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites
  • 1 month later...

I tried to install this module (upload to the "Module" section) on clean Preta 1.6.1.3 installation, but when i go to modules a have this error

 

[PrestaShop] Fatal error in module file :C:\OpenServer\domains\prestaclear1613\Core\Foundation\IoC\Core_Foundation_IoC_Container.php:
Uncaught exception 'Core_Foundation_IoC_Exception' with message 'Cannot build a `module_fail2ban`.' in C:\OpenServer\domains\prestaclear1613\Core\Foundation\IoC\Core_Foundation_IoC_Container.php:114 Stack trace: #0 C:\OpenServer\domains\prestaclear1613\Core\Foundation\IoC\Core_Foundation_IoC_Container.php(157): Core_Foundation_IoC_Container->makeInstanceFromClassName('module_fail2ban', Array) #1 C:\OpenServer\domains\prestaclear1613\Core\Foundation\IoC\Core_Foundation_IoC_Container.php(170): Core_Foundation_IoC_Container->doMake('module_fail2ban', Array) #2 C:\OpenServer\domains\prestaclear1613\Adapter\Adapter_ServiceLocator.php(52): Core_Foundation_IoC_Container->make('module_fail2ban') #3 C:\OpenServer\domains\prestaclear1613\classes\module\Module.php(1370): Adapter_ServiceLocator::get('module_fail2ban') #4 C:\OpenServer\domains\prestaclear1613\controllers\admin\AdminModulesController.php(1442): ModuleCore::getModulesOnDisk(true, false, 1) #5 C:\OpenServer\domains\prestaclear1613\classes\controller\Controll

 

How can i fix this?

Dev mode is turned off.

Thank you.

Share this post


Link to post
Share on other sites

I don't have Prestashop 1.6.1 and I see a lot has changed (IoC for example). Since @bellini13 noted underscores are not common, you can try renaming all occurencies of "module_fail2ban" in "fail2ban". Occurrencies are:

 - folder's name

 - file's name

 - main class

 - "name" attribute in main class

 

Let me know if this solves, so I can update the module. 

Share this post


Link to post
Share on other sites

Thanks for reply!

 

I tried to change "module_fail2ban" to "fail2ban" everewhere, but have the same error (tried on clean Presta 1.6.1.0 and 1.6.1.3).

 

But on Presta 1.6.0.9 it installs OK even with "module_fail2ban" text.

 

eb4tZcY.png

 

 

ceUHGkg.png

 

Share this post


Link to post
Share on other sites

Starting with PS v1.6.1.0, Prestashop development team has added their new Core framework in preparation for PS v1.7, so that did not exist in PS v1.6.0.9 which is why it would work.  The error you are receiving is from this new framework.

 

try to edit the original modules __construct function, and remove the 2 parameters $name and $context

 

So instead of this...

    public function __construct($name, $context)

make it this...

    public function __construct()

 

Share this post


Link to post
Share on other sites

Thanks Bellini for your tip! Now it is installing :) .

 

I checked and transplant this module to "displayBackOfficeTop" hook manually as described.

But it doesn't work as expected  :(  So i tried to brutforce by myself (1.6.0.9 and 1.6.1.3) and the table is clear.
 
Dear SimoneS93, what version of Prestashop are you using? I think that this is very usefull module for everyone who have their own shops.

post-836203-0-48895000-1450971075_thumb.png

Share this post


Link to post
Share on other sites
  • 3 months later...
  • 4 weeks later...
  • 4 weeks later...
  • 1 year later...

Prestashop 1.6.1.12

 

Error after load module module fail2ban.zip

How fix this error ?

How to remove this error. Can I manually uninstall this module. By this error I have no access to the module manager in the backoffice.

 

[PrestaShop] Fatal error in module file :/var/www/prestashop/Core/Foundation/IoC/Core_Foundation_IoC_Container.php:
Uncaught exception 'Core_Foundation_IoC_Exception' with message 'Cannot build a `module_fail2ban`.' in /var/www/prestashop/Core/Foundation/IoC/Core_Foundation_IoC_Container.php:114 Stack trace: #0 /var/www/prestashop/Core/Foundation/IoC/Core_Foundation_IoC_Container.php(157): Core_Foundation_IoC_Container->makeInstanceFromClassName('module_fail2ban', Array) #1 /var/www/prestashop/Core/Foundation/IoC/Core_Foundation_IoC_Container.php(170): Core_Foundation_IoC_Container->doMake('module_fail2ban', Array) #2 /var/www/prestashop/Adapter/Adapter_ServiceLocator.php(52): Core_Foundation_IoC_Container->make('module_fail2ban') #3 /var/www/prestashop/classes/module/Module.php(1370): Adapter_ServiceLocator::get('module_fail2ban') #4 /var/www/prestashop/controllers/admin/AdminModulesController.php(1442): ModuleCore::getModulesOnDisk(true, true, 1) #5 /var/www/prestashop/classes/controller/Controller.php(189): AdminModulesControllerCore->initContent() #6 /var/www/prestashop/classes/Dispatcher.php(367): ControllerCore->run(

 

Please, help me

Share this post


Link to post
Share on other sites
  • 1 year later...

Thanks, Simone! I used your module for my 1.6 shop with a few fixes. Now I am on 1.7.

I did a complete refactor of the module and fixed all bugs to make it usable for 1.7+.

I made another similar FREE module here:

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More