firewall rules update

This commit is contained in:
devdatt 2025-12-27 15:58:31 +05:30
parent 07f2c6d190
commit 8179790744
1 changed files with 6 additions and 4 deletions

View File

@ -42,12 +42,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
foreach ($data as $port => $value) {
$tmp = explode(",", trim($value));
if (count($tmp) > 0)
foreach ($tmp as $ip)
exec("sudo ufw allow in on " . $port . " from " . $ip);
else
if (count($tmp) > 0) {
foreach ($tmp as $ip) {
exec("sudo ufw allow from " . $ip . "to any port " . $port . " proto tcp");
}
} else {
exec("sudo ufw allow " . $port);
}
}
exec("sudo ufw --force enable");
}