aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/snort/snort_blocked.php8
-rwxr-xr-xconfig/snort/snort_download_updates.php12
-rwxr-xr-xconfig/snort/snort_interfaces.php4
3 files changed, 10 insertions, 14 deletions
diff --git a/config/snort/snort_blocked.php b/config/snort/snort_blocked.php
index 0f95f8ce..2d0af2c3 100644
--- a/config/snort/snort_blocked.php
+++ b/config/snort/snort_blocked.php
@@ -89,9 +89,9 @@ if ($_POST['download'])
exec('/sbin/pfctl -t snort2c -T show', $blocked_ips_array_save);
/* build the list */
if (is_array($blocked_ips_array_save) && count($blocked_ips_array_save) > 0) {
- $save_date = exec('/bin/date "+%Y-%m-%d-%H-%M-%S"');
+ $save_date = date("Y-m-d-H-i-s");
$file_name = "snort_blocked_{$save_date}.tar.gz";
- exec('/bin/mkdir -p /tmp/snort_blocked');
+ safe_mkdir("/tmp/snort_blocked");
file_put_contents("/tmp/snort_blocked/snort_block.pf", "");
foreach($blocked_ips_array_save as $counter => $fileline) {
if (empty($fileline))
@@ -120,8 +120,8 @@ if ($_POST['download'])
readfile("/tmp/{$file_name}");
// Clean up the temp files and directory
- @unlink("/tmp/{$file_name}");
- exec("/bin/rm -fr /tmp/snort_blocked");
+ unlink_if_exists("/tmp/{$file_name}");
+ rmdir_recursive("/tmp/snort_blocked");
} else
$savemsg = gettext("An error occurred while creating archive");
} else
diff --git a/config/snort/snort_download_updates.php b/config/snort/snort_download_updates.php
index c95f8440..9d677619 100755
--- a/config/snort/snort_download_updates.php
+++ b/config/snort/snort_download_updates.php
@@ -119,8 +119,7 @@ if (file_exists("{$snortdir}/{$snort_community_rules_filename}.md5") && $snortco
/* Check for postback to see if we should clear the update log file. */
if (isset($_POST['clear'])) {
- if (file_exists("{$snort_rules_upd_log}"))
- mwexec("/bin/rm -f {$snort_rules_upd_log}");
+ unlink_if_exists($snort_rules_upd_log);
}
if (isset($_POST['check'])) {
@@ -133,12 +132,9 @@ if ($_POST['force']) {
conf_mount_rw();
// Remove the existing MD5 signature files to force a download
- if (file_exists("{$snortdir}/{$emergingthreats_filename}.md5"))
- @unlink("{$snortdir}/{$emergingthreats_filename}.md5");
- if (file_exists("{$snortdir}/{$snort_community_rules_filename}.md5"))
- @unlink("{$snortdir}/{$snort_community_rules_filename}.md5");
- if (file_exists("{$snortdir}/{$snort_rules_file}.md5"))
- @unlink("{$snortdir}/{$snort_rules_file}.md5");
+ unlink_if_exists("{$snortdir}/{$emergingthreats_filename}.md5");
+ unlink_if_exists("{$snortdir}/{$snort_community_rules_filename}.md5");
+ unlink_if_exists("{$snortdir}/{$snort_rules_file}.md5");
// Revert file system to R/O.
conf_mount_ro();
diff --git a/config/snort/snort_interfaces.php b/config/snort/snort_interfaces.php
index 7903eba7..5e0830c3 100755
--- a/config/snort/snort_interfaces.php
+++ b/config/snort/snort_interfaces.php
@@ -68,8 +68,8 @@ if (isset($_POST['del_x'])) {
}
}
snort_stop($a_nat[$rulei], $if_real);
- exec("/bin/rm -r {$snortlogdir}/snort_{$if_real}{$snort_uuid}");
- exec("/bin/rm -r {$snortdir}/snort_{$snort_uuid}_{$if_real}");
+ rmdir_recursive("{$snortlogdir}/snort_{$if_real}{$snort_uuid}");
+ rmdir_recursive("{$snortdir}/snort_{$snort_uuid}_{$if_real}");
// Finally delete the interface's config entry entirely
unset($a_nat[$rulei]);