mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 18:49:21 -07:00
Firewall with Fail2ban support
This commit is contained in:
parent
f6926670fe
commit
357eb42647
27 changed files with 936 additions and 50 deletions
36
web/bulk/firewall/banlist/index.php
Normal file
36
web/bulk/firewall/banlist/index.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
// Main include
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Check user
|
||||
if ($_SESSION['user'] != 'admin') {
|
||||
header("Location: /list/user");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!empty($_POST['ipchain'])) {
|
||||
$ipchain = $_POST['ipchain'];
|
||||
list($ip,$chain) = split(":",$ipchain);
|
||||
$v_ip = escapeshellarg($ip);
|
||||
$v_chain = escapeshellarg($chain);
|
||||
|
||||
}
|
||||
|
||||
$action = $_POST['action'];
|
||||
|
||||
switch ($action) {
|
||||
case 'delete': $cmd='v-delete-firewall-ban';
|
||||
break;
|
||||
default: header("Location: /list/firewall/banlist/"); exit;
|
||||
}
|
||||
|
||||
foreach ($ipchain as $value) {
|
||||
exec (VESTA_CMD.$cmd." ".$v_ip." ".$v_chain, $output, $return_var);
|
||||
}
|
||||
|
||||
header("Location: /list/firewall/banlist");
|
|
@ -18,11 +18,11 @@ $rule = $_POST['rule'];
|
|||
$action = $_POST['action'];
|
||||
|
||||
switch ($action) {
|
||||
case 'delete': $cmd='v-delete-sys-firewall-rule';
|
||||
case 'delete': $cmd='v-delete-firewall-rule';
|
||||
break;
|
||||
case 'suspend': $cmd='v-suspend-sys-firewall-rule';
|
||||
case 'suspend': $cmd='v-suspend-firewall-rule';
|
||||
break;
|
||||
case 'unsuspend': $cmd='v-unsuspend-sys-firewall-rule';
|
||||
case 'unsuspend': $cmd='v-unsuspend-firewall-rule';
|
||||
break;
|
||||
default: header("Location: /list/firewall/"); exit;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue