aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort/snort_alerts.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-07-13 05:10:12 +0000
committerErmal <eri@pfsense.org>2012-07-13 05:10:12 +0000
commit119732ffe8f773538adc2fd5db74a004a4afe3f2 (patch)
tree10646062077c97c7cfea62173978e188170d0eed /config/snort/snort_alerts.php
parent80167e60d36acd613a083bbea6e2fbfd5f180f89 (diff)
downloadpfsense-packages-119732ffe8f773538adc2fd5db74a004a4afe3f2.tar.gz
pfsense-packages-119732ffe8f773538adc2fd5db74a004a4afe3f2.tar.bz2
pfsense-packages-119732ffe8f773538adc2fd5db74a004a4afe3f2.zip
Rather than unlinking/writing to a file opened by snort. Truncate it.
Diffstat (limited to 'config/snort/snort_alerts.php')
-rw-r--r--config/snort/snort_alerts.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/config/snort/snort_alerts.php b/config/snort/snort_alerts.php
index ffda0342..0c6334d9 100644
--- a/config/snort/snort_alerts.php
+++ b/config/snort/snort_alerts.php
@@ -83,12 +83,17 @@ if ($_GET['action'] == "clear" || $_POST['delete']) {
if (file_exists("/var/log/snort/snort_{$if_real}{$snort_uuid}/alert")) {
conf_mount_rw();
snort_post_delete_logs($snort_uuid);
- @file_put_contents("/var/log/snort/snort_{$if_real}{$snort_uuid}/alert", "");
+ $fd = fopen("/var/log/snort/snort_{$if_real}{$snort_uuid}/alert", "w");
+ if ($fd) {
+ @ftruncate($fd, 0);
+ fclose($fd);
+ }
+ conf_mount_ro();
/* XXX: This is needed is snort is run as snort user */
//mwexec('/usr/sbin/chown snort:snort /var/log/snort/*', true);
mwexec('/bin/chmod 660 /var/log/snort/*', true);
- mwexec("/bin/pkill -HUP -F {$g['varrun_path']}/snort_{$if_real}{$snort_uuid}.pid -a");
- conf_mount_ro();
+ if (file_exists("{$g['varrun_path']}/snort_{$if_real}{$snort_uuid}.pid"))
+ mwexec("/bin/pkill -HUP -F {$g['varrun_path']}/snort_{$if_real}{$snort_uuid}.pid -a");
}
header("Location: /snort/snort_alerts.php?instance={$instanceid}");
exit;