Skip to content
Web Application Firewall (WAF) package for Laravel
PHP
Branch: master
Clone or download
Latest commit cdd4eae Aug 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src added notification config per middleware Aug 23, 2019
tests refactored middleware Jul 22, 2019
.gitattributes first commit Jul 16, 2019
.gitignore fixed tests Jul 20, 2019
.scrutinizer.yml first commit Jul 16, 2019
.styleci.yml first commit Jul 16, 2019
.travis.yml tests Jul 18, 2019
LICENSE.md first commit Jul 16, 2019
README.md readme Aug 23, 2019
composer.json added user agent middleware Jul 20, 2019
phpunit.xml fixed tests Jul 20, 2019

README.md

Web Application Firewall (WAF) package for Laravel

Version Downloads Build Status StyleCI Quality License

This package intends to protect your Laravel app from different type of attacks such as XSS, SQLi, RFI, LFI, User Agent, and a lot more. It will also block repeated attacks and send notification via email and/or slack when attack is detected. Furthermore, it will log failed logins and block the IP after a number of attempts.

Note: Some middleware classes (i.e. Xss) are empty as the Middleware abstract class that they extend does all of the job, dynamically. In short, they all works ;)

Getting Started

1. Install

Run the following command:

composer require akaunting/firewall

2. Register (for Laravel < 5.5)

Register the service provider in config/app.php

Akaunting\Firewall\Provider::class,

3. Publish

Publish configuration, language, and migrations

php artisan vendor:publish --tag=firewall

4. Database

Create db tables

php artisan migrate

5. Configure

You can change the firewall settings of your app from config/firewall.php file

Usage

Middlewares are already defined so should just add them to routes. The firewall.all middleware applies all the middlewares available in the all_middleware array of config file.

Route::group(['middleware' => 'firewall.all'], function () {
    Route::get('/', 'HomeController@index');
});

You can apply each middleware per route. For example, you can allow only whitelisted IPs to access admin:

Route::group(['middleware' => 'firewall.whitelist'], function () {
    Route::get('/admin', 'AdminController@index');
});

Or you can get notified when anyone NOT in whitelist access admin, by adding it to the inspections config:

Route::group(['middleware' => 'firewall.url'], function () {
    Route::get('/admin', 'AdminController@index');
});

Available middlewares applicable to routes:

firewall.all

firewall.agent
firewall.geo
firewall.ip
firewall.lfi
firewall.php
firewall.referrer
firewall.rfi
firewall.session
firewall.sqli
firewall.swear
firewall.url
firewall.whitelist
firewall.xss

You may also define routes for each middleware in config/firewall.php and apply that middleware or firewall.all at the top of all routes.

Notifications

Firewall will send a notification as soon as an attack has been detected. Emails entered in notifications.email.to config must be valid Laravel users in order to send notifications. Check out the Notifications documentation of Laravel for further information.

Changelog

Please see Releases for more information what has changed recently.

Contributing

Pull requests are more than welcome.

Security

If you discover any security related issues, please email security@akaunting.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see LICENSE for more information.

You can’t perform that action at this time.