This commit is contained in:
Alexey Berezhok
2024-03-19 22:05:27 +03:00
commit 346a50856b
1572 changed files with 182163 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
ob_start();
// Main include
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
// Check token
verify_csrf($_POST);
// Check user
if ($_SESSION["userContext"] != "admin") {
header("Location: /list/user");
exit();
}
if (empty($_POST["ipchain"])) {
header("Location: /list/firewall/banlist/");
exit();
}
if (empty($_POST["action"])) {
header("Location: /list/firewall/banlist/");
exit();
}
$ipchain = $_POST["ipchain"];
$action = $_POST["action"];
switch ($action) {
case "delete":
$cmd = "v-delete-firewall-ban";
break;
default:
header("Location: /list/firewall/banlist/");
exit();
}
foreach ($ipchain as $value) {
[$ip, $chain] = explode(":", $value);
$v_ip = quoteshellarg($ip);
$v_chain = quoteshellarg($chain);
exec(HESTIA_CMD . $cmd . " " . $v_ip . " " . $v_chain, $output, $return_var);
}
header("Location: /list/firewall/banlist");

View File

@@ -0,0 +1,51 @@
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
ob_start();
// Main include
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
// Check token
verify_csrf($_POST);
// Check user
if ($_SESSION["userContext"] != "admin") {
header("Location: /list/user");
exit();
}
if (empty($_POST["rule"])) {
header("Location: /list/firewall/");
exit();
}
if (empty($_POST["action"])) {
header("Location: /list/firewall/");
exit();
}
$rule = $_POST["rule"];
$action = $_POST["action"];
switch ($action) {
case "delete":
$cmd = "v-delete-firewall-rule";
break;
case "suspend":
$cmd = "v-suspend-firewall-rule";
break;
case "unsuspend":
$cmd = "v-unsuspend-firewall-rule";
break;
default:
header("Location: /list/firewall/");
exit();
}
foreach ($rule as $value) {
$value = quoteshellarg($value);
exec(HESTIA_CMD . $cmd . " " . $value, $output, $return_var);
$restart = "yes";
}
header("Location: /list/firewall/");

View File

@@ -0,0 +1,43 @@
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
ob_start();
// Main include
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
// Check token
verify_csrf($_POST);
// Check user
if ($_SESSION["userContext"] != "admin") {
header("Location: /list/user");
exit();
}
if (empty($_POST["setname"])) {
header("Location: /list/firewall/ipset/");
exit();
}
if (empty($_POST["action"])) {
header("Location: /list/firewall/ipset/");
exit();
}
$setname = $_POST["setname"];
$action = $_POST["action"];
switch ($action) {
case "delete":
$cmd = "v-delete-firewall-ipset";
break;
default:
header("Location: /list/firewall/ipset/");
exit();
}
foreach ($setname as $value) {
$v_name = quoteshellarg($value);
exec(HESTIA_CMD . $cmd . " " . $v_name, $output, $return_var);
}
header("Location: /list/firewall/ipset/");