Add soft firewall to manage access to site

This commit is contained in:
DariusIII
2018-08-16 10:32:16 +02:00
parent 624eef2358
commit 1b3643539f
9 changed files with 748 additions and 36 deletions
+2
View File
@@ -108,3 +108,5 @@ SMARTY_CACHE_LIFE=120
SMARTY_COMPILE_CHECK=false
SMARTY_FORCE_COMPILE=false
SMARTY_CACHE_DRIVER=file
FIREWALL_ENABLED=true
+2
View File
@@ -1,3 +1,5 @@
2018-08-16 DariusIII
* Chg: Add soft firewall to manage access to site
2018-08-15 DariusIII
* Chg: Update date handling of Games class
* Chg: Update regex for matching width/height in ReleaseExtra class
+3
View File
@@ -62,5 +62,8 @@ class Kernel extends HttpKernel
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'clearance' => \App\Http\Middleware\ClearanceMiddleware::class,
'fw-only-whitelisted' => \PragmaRX\Firewall\Middleware\FirewallWhitelist::class,
'fw-block-blacklisted' => \PragmaRX\Firewall\Middleware\FirewallBlacklist::class,
'fw-block-attacks' => \PragmaRX\Firewall\Middleware\BlockAttacks::class,
];
}
+2
View File
@@ -135,6 +135,7 @@
"foolz/sphinxql-query-builder": "^1.2",
"fxp/composer-asset-plugin": "~1.1",
"genealabs/laravel-caffeine": "^0.6.11",
"geoip2/geoip2": "^2.9",
"google/recaptcha": "~1.1",
"guzzlehttp/guzzle": "^6.3",
"imdbphp/imdbphp": "dev-master",
@@ -155,6 +156,7 @@
"php-http/guzzle6-adapter": "^1.1",
"php-http/message": "^1.6",
"php-tmdb/api": "~2.1",
"pragmarx/firewall": "^2.2",
"predis/predis": "^1.1",
"ramsey/uuid": "^3.7",
"smarty/smarty": "^3.1",
Generated
+388 -30
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "19a2dbdaf113ea9baee76f15483e9be6",
"content-hash": "a04cbc51dc5a6f2b19ac1a403107b54b",
"packages": [
{
"name": "adrenth/thetvdb2",
@@ -312,7 +312,8 @@
"Gemfile.lock",
"*.md"
]
}
},
"time": "2016-06-06T17:37:52+00:00"
},
{
"name": "bower-asset/autosize",
@@ -341,7 +342,8 @@
"form",
"textarea",
"ui"
]
],
"time": "2017-05-19T15:36:30+00:00"
},
{
"name": "bower-asset/bootstrap",
@@ -390,7 +392,8 @@
"mobile-first",
"responsive",
"web"
]
],
"time": "2016-07-25T15:51:55+00:00"
},
{
"name": "bower-asset/bootstrap-3.x",
@@ -439,7 +442,8 @@
"mobile-first",
"responsive",
"web"
]
],
"time": "2016-07-25T15:51:55+00:00"
},
{
"name": "bower-asset/bootstrap-datepicker",
@@ -468,7 +472,8 @@
},
"license": [
"Apache-2.0"
]
],
"time": "2016-08-05T09:50:13+00:00"
},
{
"name": "bower-asset/bootstrap-hover-dropdown",
@@ -498,7 +503,8 @@
"dropdowns",
"hover",
"twitter"
]
],
"time": "2015-12-01T23:35:57+00:00"
},
{
"name": "bower-asset/bootstrap-progressbar",
@@ -532,7 +538,8 @@
},
"license": [
"MIT"
]
],
"time": "2015-05-15T18:56:17+00:00"
},
{
"name": "bower-asset/bootswatch",
@@ -663,7 +670,8 @@
"modal",
"popup",
"ui"
]
],
"time": "2016-05-10T22:21:33+00:00"
},
{
"name": "bower-asset/datatables",
@@ -778,7 +786,8 @@
"tests",
"examples"
]
}
},
"time": "2015-01-26T21:19:01+00:00"
},
{
"name": "bower-asset/flexboxgrid",
@@ -814,7 +823,8 @@
"css",
"flexbox",
"grid"
]
],
"time": "2016-08-14T16:43:18+00:00"
},
{
"name": "bower-asset/font-awesome",
@@ -859,7 +869,8 @@
"src",
"build.xml"
]
}
},
"time": "2015-07-20T20:04:00+00:00"
},
{
"name": "bower-asset/icheck",
@@ -909,7 +920,8 @@
"replacement",
"skins",
"ui"
]
],
"time": "2014-03-03T17:36:28+00:00"
},
{
"name": "bower-asset/jquery",
@@ -972,7 +984,8 @@
"javascript",
"jquery",
"library"
]
],
"time": "2016-05-20T17:24:43+00:00"
},
{
"name": "bower-asset/jquery-3.2.x",
@@ -1039,7 +1052,8 @@
"scroll",
"scrolltop",
"scrolltotop"
]
],
"time": "2017-08-31T15:51:29+00:00"
},
{
"name": "bower-asset/jquery-migrate-1.4.x",
@@ -1058,7 +1072,8 @@
"type": "bower-asset-library",
"extra": {
"bower-asset-main": "jquery-migrate.js"
}
},
"time": "2016-04-15T06:38:34+00:00"
},
{
"name": "bower-asset/jquery-migrate-3.0.x",
@@ -1077,7 +1092,8 @@
"type": "bower-asset-library",
"extra": {
"bower-asset-main": "jquery-migrate.js"
}
},
"time": "2016-06-10T14:28:59+00:00"
},
{
"name": "bower-asset/jquery.nicescroll",
@@ -1107,7 +1123,8 @@
"demo",
"package.json"
]
}
},
"time": "2016-03-01T20:38:24+00:00"
},
{
"name": "bower-asset/material-design-iconic-font",
@@ -1146,7 +1163,8 @@
"font",
"icons",
"material"
]
],
"time": "2015-11-08T04:50:28+00:00"
},
{
"name": "bower-asset/materialize",
@@ -1205,7 +1223,8 @@
"responsive",
"sass",
"ux"
]
],
"time": "2017-04-15T01:39:28+00:00"
},
{
"name": "bower-asset/pace",
@@ -1251,7 +1270,8 @@
"progress",
"progress",
"spinner"
]
],
"time": "2014-11-06T16:31:34+00:00"
},
{
"name": "bower-asset/pnotify",
@@ -1303,7 +1323,8 @@
"license": [
"Apache-2.0"
],
"description": "JavaScript notification plugin."
"description": "JavaScript notification plugin.",
"time": "2017-07-31T21:50:29+00:00"
},
{
"name": "bower-asset/respond",
@@ -1327,7 +1348,8 @@
"test"
]
},
"description": "Fast and lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)"
"description": "Fast and lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)",
"time": "2013-12-19T04:44:31+00:00"
},
{
"name": "bower-asset/responsive-tables-js",
@@ -1357,7 +1379,8 @@
"jquery",
"responsive",
"table"
]
],
"time": "2015-10-08T14:18:04+00:00"
},
{
"name": "bower-asset/select2",
@@ -1425,7 +1448,8 @@
"scrolling",
"slimscroll",
"ui"
]
],
"time": "2016-06-11T09:19:14+00:00"
},
{
"name": "bower-asset/tinymce-dist",
@@ -1517,6 +1541,62 @@
],
"time": "2017-08-18T09:54:01+00:00"
},
{
"name": "composer/ca-bundle",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "46afded9720f40b9dc63542af4e3e43a1177acb0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0",
"reference": "46afded9720f40b9dc63542af4e3e43a1177acb0",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"ext-pcre": "*",
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
"psr/log": "^1.0",
"symfony/process": "^2.5 || ^3.0 || ^4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\CaBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
"keywords": [
"cabundle",
"cacert",
"certificate",
"ssl",
"tls"
],
"time": "2018-08-08T08:57:40+00:00"
},
{
"name": "dariusiii/rarinfo",
"version": "v2.6.1",
@@ -2461,6 +2541,58 @@
"description": "Keeping Your Laravel Forms Awake",
"time": "2018-08-05T18:19:41+00:00"
},
{
"name": "geoip2/geoip2",
"version": "v2.9.0",
"source": {
"type": "git",
"url": "https://github.com/maxmind/GeoIP2-php.git",
"reference": "a807fbf65212eef5d8d2db1a1b31082b53633d77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/a807fbf65212eef5d8d2db1a1b31082b53633d77",
"reference": "a807fbf65212eef5d8d2db1a1b31082b53633d77",
"shasum": ""
},
"require": {
"maxmind-db/reader": "~1.0",
"maxmind/web-service-common": "~0.5",
"php": ">=5.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.*",
"phpunit/phpunit": "4.*",
"squizlabs/php_codesniffer": "3.*"
},
"type": "library",
"autoload": {
"psr-4": {
"GeoIp2\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory J. Oschwald",
"email": "goschwald@maxmind.com",
"homepage": "http://www.maxmind.com/"
}
],
"description": "MaxMind GeoIP2 PHP API",
"homepage": "https://github.com/maxmind/GeoIP2-php",
"keywords": [
"IP",
"geoip",
"geoip2",
"geolocation",
"maxmind"
],
"time": "2018-04-10T15:32:59+00:00"
},
{
"name": "google/recaptcha",
"version": "1.2.1",
@@ -3843,6 +3975,108 @@
],
"time": "2017-06-12T11:04:56+00:00"
},
{
"name": "maxmind-db/reader",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
"reference": "e042b4f8a2dff41e19019faf16427178b07fbd58"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/e042b4f8a2dff41e19019faf16427178b07fbd58",
"reference": "e042b4f8a2dff41e19019faf16427178b07fbd58",
"shasum": ""
},
"require": {
"php": ">=5.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.*",
"phpunit/phpunit": "4.* || 5.*",
"satooshi/php-coveralls": "1.0.*",
"squizlabs/php_codesniffer": "3.*"
},
"suggest": {
"ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
"ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
"ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
},
"type": "library",
"autoload": {
"psr-4": {
"MaxMind\\Db\\": "src/MaxMind/Db"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory J. Oschwald",
"email": "goschwald@maxmind.com",
"homepage": "http://www.maxmind.com/"
}
],
"description": "MaxMind DB Reader API",
"homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
"keywords": [
"database",
"geoip",
"geoip2",
"geolocation",
"maxmind"
],
"time": "2018-02-21T21:23:33+00:00"
},
{
"name": "maxmind/web-service-common",
"version": "v0.5.0",
"source": {
"type": "git",
"url": "https://github.com/maxmind/web-service-common-php.git",
"reference": "61a9836fa3bb1743ab89752bae5005d71e78c73b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/61a9836fa3bb1743ab89752bae5005d71e78c73b",
"reference": "61a9836fa3bb1743ab89752bae5005d71e78c73b",
"shasum": ""
},
"require": {
"composer/ca-bundle": "^1.0.3",
"ext-curl": "*",
"ext-json": "*",
"php": ">=5.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.*",
"phpunit/phpunit": "4.*",
"squizlabs/php_codesniffer": "3.*"
},
"type": "library",
"autoload": {
"psr-4": {
"MaxMind\\Exception\\": "src/Exception",
"MaxMind\\WebService\\": "src/WebService"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Gregory Oschwald",
"email": "goschwald@maxmind.com"
}
],
"description": "Internal MaxMind Web Service API",
"homepage": "https://github.com/maxmind/web-service-common-php",
"time": "2018-02-12T22:31:54+00:00"
},
{
"name": "mayconbordin/l5-fixtures",
"version": "dev-master",
@@ -4591,6 +4825,130 @@
],
"time": "2018-05-03T18:05:46+00:00"
},
{
"name": "pragmarx/firewall",
"version": "v2.2.1",
"source": {
"type": "git",
"url": "https://github.com/antonioribeiro/firewall.git",
"reference": "fd840bec09ed4c3de67d5d350c3f6d5f8a8eaec4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/antonioribeiro/firewall/zipball/fd840bec09ed4c3de67d5d350c3f6d5f8a8eaec4",
"reference": "fd840bec09ed4c3de67d5d350c3f6d5f8a8eaec4",
"shasum": ""
},
"require": {
"laravel/framework": ">=5.3",
"php": ">=5.6",
"pragmarx/support": "~0.8.0"
},
"require-dev": {
"geoip2/geoip2": "~2.0",
"guzzlehttp/guzzle": "^6.2",
"orchestra/testbench": "~3.6",
"phpunit/phpunit": "~7"
},
"suggest": {
"geoip/geoip": "~1.14",
"geoip2/geoip2": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.5.x-dev"
},
"laravel": {
"providers": [
"PragmaRX\\Firewall\\Vendor\\Laravel\\ServiceProvider"
],
"aliases": {
"Firewall": "PragmaRX\\Firewall\\Vendor\\Laravel\\Facade"
}
}
},
"autoload": {
"psr-4": {
"PragmaRX\\Firewall\\": "src/",
"PragmaRX\\Firewall\\Tests\\": "tests/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Antonio Carlos Ribeiro",
"email": "acr@antoniocarlosribeiro.com",
"role": "Creator"
}
],
"description": "A Laravel IP whitelisting and blacklisting",
"keywords": [
"blacklist",
"firewall",
"laravel",
"whitelist"
],
"time": "2018-07-31T23:07:56+00:00"
},
{
"name": "pragmarx/support",
"version": "v0.8.8",
"source": {
"type": "git",
"url": "https://github.com/antonioribeiro/support.git",
"reference": "ba6e3a245f50c5a00b3ee99fae542af00585f77c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/antonioribeiro/support/zipball/ba6e3a245f50c5a00b3ee99fae542af00585f77c",
"reference": "ba6e3a245f50c5a00b3ee99fae542af00585f77c",
"shasum": ""
},
"require": {
"illuminate/filesystem": "~4.0|~5.0",
"php": ">=5.4.0",
"symfony/var-dumper": "~2.6|~3.0|~4.0"
},
"suggest": {
"laravel/framework": "Laravel framework.",
"symfony/yaml": "The Yaml class needs it"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.7.x-dev"
}
},
"autoload": {
"psr-4": {
"PragmaRX\\Support\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Antonio Carlos Ribeiro",
"email": "acr@antoniocarlosribeiro.com",
"role": "Creator"
}
],
"description": "PragmaRX components support package",
"keywords": [
"laravel",
"pragmarx"
],
"time": "2018-02-10T15:05:53+00:00"
},
{
"name": "predis/predis",
"version": "v1.1.1",
@@ -5217,16 +5575,16 @@
},
{
"name": "spatie/laravel-permission",
"version": "2.14.0",
"version": "2.15.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-permission.git",
"reference": "5a40d8ba8b7af83ff149d075351616027a0b771f"
"reference": "40cd73d227da96fa31bb4905f1f37444dee6d74a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/5a40d8ba8b7af83ff149d075351616027a0b771f",
"reference": "5a40d8ba8b7af83ff149d075351616027a0b771f",
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/40cd73d227da96fa31bb4905f1f37444dee6d74a",
"reference": "40cd73d227da96fa31bb4905f1f37444dee6d74a",
"shasum": ""
},
"require": {
@@ -5277,7 +5635,7 @@
"security",
"spatie"
],
"time": "2018-08-13T15:28:03+00:00"
"time": "2018-08-16T00:21:46+00:00"
},
{
"name": "swiftmailer/swiftmailer",
+294
View File
@@ -0,0 +1,294 @@
<?php
return [
/*
* Enable / disable firewall
*
*/
'enabled' => env('FIREWALL_ENABLED', true),
/*
* Whitelisted and blacklisted IP addresses, ranges, countries, files and/or files of files
*
* Examples of IP address, hosts, country codes and CIDRs
* '127.0.0.1',
* '192.168.17.0/24'
* '127.0.0.1/255.255.255.255'
* '10.0.0.1-10.0.0.255'
* '172.17.*.*'
* 'country:br'
* 'host:google.com',
* storage_path().DIRECTORY_SEPARATOR.'blacklisted.txt', // a file with IPs, one per line
*/
'blacklist' => [
],
'whitelist' => [
],
/*
* Response action for blocked responses
*
*/
'responses' => [
'blacklist' => [
'code' => 403, // 200 = log && notify, but keep pages rendering
'message' => null,
'view' => null,
'redirect_to' => null,
'abort' => false, // return abort() instead of Response::make() - disabled by default
],
'whitelist' => [
'code' => 403, // 200 = log && notify, but keep pages rendering
'message' => null,
'view' => null,
'redirect_to' => null,
'abort' => false, // return abort() instead of Response::make() - disabled by default
],
],
/*
* Do you wish to redirect non whitelisted accesses to an error page?
*
* You can use a route name (coming.soon) or url (/coming/soon);
*
*/
'redirect_non_whitelisted_to' => null,
/*
* How long should we keep IP addresses in cache?
*
* This is a general client IP addresses cache. When the user hits your ssytem his/her IP address
* is searched and cached for the desired time. Finding an IP address contained in a CIDR
* range (172.17.0.0/24, for instance) can be a "slow", caching it improves performance.
*
*/
'cache_expire_time' => 60, // minutes
/*
* How long should we keep lists of IP addresses in cache?
*
* This is the list cache. Database lists can take some time to load and process,
* caching it, if you are not making frequent changes to your lists, may improve firewall speed a lot.
*/
'ip_list_cache_expire_time' => 0, // minutes - disabled by default
/*
* Send suspicious events to log?
*
*/
'enable_log' => true,
/*
* Search by range allow you to store ranges of addresses in
* your black and whitelist:
*
* 192.168.17.0/24 or
* 127.0.0.1/255.255.255.255 or
* 10.0.0.1-10.0.0.255 or
* 172.17.*.*
*
* Note that range searches may be slow and waste memory, this is why
* it is disabled by default.
*
*/
'enable_range_search' => true,
/*
* Search by country range allow you to store country ids in your
* your black and whitelist:
*
* php artisan firewall:whitelist country:us
* php artisan firewall:blacklist country:cn
*
*/
'enable_country_search' => true,
/*
* Should Firewall use the database?
*/
'use_database' => true,
/*
* Models
*
* When using the "eloquent" driver, we need to know which Eloquent models
* should be used.
*
*/
'firewall_model' => 'PragmaRX\Firewall\Vendor\Laravel\Models\Firewall',
/*
* Session object binding in the IoC Container
*
* When blacklisting IPs for the current session, Firewall
* will need to instantiate the session object.
*
*/
'session_binding' => 'session',
/*
* GeoIp2 database path.
*
* To get a fresh version of this file, use the command
*
* php artisan firewall:updategeoip
*
*/
'geoip_database_path' => __DIR__.'/geoip', //storage_path('geoip'),
/*
* Block suspicious attacks
*/
'attack_blocker' => [
'enabled' => [
'ip' => true,
'country' => false,
],
'cache_key_prefix' => 'firewall-attack-blocker',
'allowed_frequency' => [
'ip' => [
'requests' => 50,
'seconds' => 1 * 60, // 1 minute
],
'country' => [
'requests' => 3000,
'seconds' => 2 * 60, // 2 minutes
],
],
'action' => [
'ip' => [
'blacklist_unknown' => true,
'blacklist_whitelisted' => false,
],
'country' => [
'blacklist_unknown' => false,
'blacklist_whitelisted' => false,
],
],
'response' => [
'code' => 403, // 200 = log && notify, but keep pages rendering
'message' => null,
'view' => null,
'redirect_to' => null,
'abort' => false, // return abort() instead of Response::make() - disabled by default
],
],
'notifications' => [
'enabled' => true,
'message' => [
'title' => 'User agent',
'message' => "A possible attack on '%s' has been detected from %s",
'request_count' => [
'title' => 'Request count',
'message' => 'Received %s requests in the last %s seconds. Timestamp of first request: %s',
],
'uri' => [
'title' => 'First URI offended',
],
'blacklisted' => [
'title' => 'Was it blacklisted?',
],
'user_agent' => [
'title' => 'User agent',
],
'geolocation' => [
'title' => 'Geolocation',
'field_latitude' => 'Latitude',
'field_longitude' => 'Longitude',
'field_country_code' => 'Country code',
'field_country_name' => 'Country name',
'field_city' => 'City',
],
],
'route' => '',
'from' => [
'name' => 'Laravel Firewall',
'address' => 'firewall@mydomain.com',
'icon_emoji' => ':fire:',
],
'users' => [
'model' => PragmaRX\Firewall\Vendor\Laravel\Models\User::class,
'emails' => [
env('ADMIN_EMAIL'),
],
],
'channels' => [
'slack' => [
'enabled' => false,
'sender' => PragmaRX\Firewall\Notifications\Channels\Slack::class,
],
'mail' => [
'enabled' => true,
'sender' => PragmaRX\Firewall\Notifications\Channels\Mail::class,
],
],
],
];
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFirewallTable extends Migration
{
/**
* Run the migration.
*
* @return void
*/
public function up()
{
Schema::create('firewall', function (Blueprint $table) {
$table->increments('id');
$table->string('ip_address', 39)->unique()->index();
$table->boolean('whitelisted')->default(false); /// default is blacklist
$table->timestamps();
});
}
/**
* Reverse the migration.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('firewall');
}
}
@@ -0,0 +1,15 @@
DROP TABLE IF EXISTS firewall;
CREATE TABLE firewall (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
ip_address VARCHAR(39) NOT NULL,
whitelisted TINYINT(1) NOT NULL DEFAULT 0,
created_at TIMESTAMP NULL DEFAULT NULL,
updated_at TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE KEY firewall_ip_address_unique (ip_address)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8
COLLATE=utf8_unicode_ci
ROW_FORMAT=DYNAMIC;
+6 -6
View File
@@ -11,19 +11,19 @@
|
*/
Route::get('/', 'ContentController@show');
Route::get('/', 'ContentController@show')->middleware('fw-block-blacklisted');
Auth::routes();
Route::get('register', 'Auth\RegisterController@showRegistrationForm');
Route::post('register', 'Auth\RegisterController@register');
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->middleware('fw-block-blacklisted');
Route::post('register', 'Auth\RegisterController@register')->middleware('fw-block-blacklisted');
Route::get('forgottenpassword', 'Auth\ForgotPasswordController@showLinkRequestForm');
Route::post('forgottenpassword', 'Auth\ForgotPasswordController@showLinkRequestForm');
Route::get('forgottenpassword', 'Auth\ForgotPasswordController@showLinkRequestForm')->middleware('fw-block-blacklisted');
Route::post('forgottenpassword', 'Auth\ForgotPasswordController@showLinkRequestForm')->middleware('fw-block-blacklisted');
Route::get('terms-and-conditions', 'TermsController@terms');
Route::group(['middleware' => ['isVerified']], function () {
Route::group(['middleware' => ['isVerified|fw-block-blacklisted']], function () {
Route::get('login', 'Auth\LoginController@showLoginForm');
Route::post('login', 'Auth\LoginController@login')->name('login');