firewall rules update
This commit is contained in:
parent
07f2c6d190
commit
8179790744
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue