aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort/snort_alerts.php
diff options
context:
space:
mode:
Diffstat (limited to 'config/snort/snort_alerts.php')
-rw-r--r--config/snort/snort_alerts.php51
1 files changed, 22 insertions, 29 deletions
diff --git a/config/snort/snort_alerts.php b/config/snort/snort_alerts.php
index 8e81d16a..53b9e3a2 100644
--- a/config/snort/snort_alerts.php
+++ b/config/snort/snort_alerts.php
@@ -80,34 +80,36 @@ if ($_POST['save'])
write_config();
header("Location: /snort/snort_alerts.php");
+ exit;
}
}
-if ($_POST['delete'])
+if ($_GET['action'] == "clear" || $_POST['clear'])
{
- conf_mount_rw();
if(file_exists('/var/log/snort/alert'))
{
- @file_put_content("/var/log/snort/alert", "");
+ conf_mount_rw();
+ @file_put_contents("/var/log/snort/alert", "");
post_delete_logs();
- mwexec('/usr/sbin/chown snort:snort /var/log/snort/*', true);
+ /* 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);
- sleep(2);
mwexec('/usr/bin/killall -HUP snort', true);
+ conf_mount_ro();
}
- conf_mount_ro();
+ header("Location: /snort/snort_alerts.php");
+ exit;
}
if ($_POST['download'])
{
- ob_start(); //importanr or other post will fail
$save_date = exec('/bin/date "+%Y-%m-%d-%H-%M-%S"');
$file_name = "snort_logs_{$save_date}.tar.gz";
- exec("/usr/bin/tar cfz /tmp/snort_logs_{$save_date}.tar.gz /var/log/snort");
+ exec("/usr/bin/tar cfz /tmp/{$file_name} /var/log/snort");
- if (file_exists("/tmp/snort_logs_{$save_date}.tar.gz")) {
+ if (file_exists("/tmp/{$file_name}")) {
$file = "/tmp/snort_logs_{$save_date}.tar.gz";
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
header("Pragma: private"); // needed for IE
@@ -117,10 +119,11 @@ if ($_POST['download'])
header("Content-length: ".filesize($file));
header("Content-disposition: attachment; filename = {$file_name}");
readfile("$file");
- exec("/bin/rm /tmp/snort_logs_{$save_date}.tar.gz");
- od_end_clean(); //importanr or other post will fail
- } else
- echo 'Error no saved file.';
+ exec("/bin/rm /tmp/{$file_name}");
+ }
+
+ header("Location: /snort/snort_alerts.php");
+ exit;
}
@@ -301,9 +304,9 @@ if ($pconfig['arefresh'] == 'on')
<td width="78%" class="vtable">
<form action="/snort/snort_alerts.php" method="post"><input
name="download" type="submit" class="formbtn" value="Download"> All
- log files will be saved. <input name="delete" type="submit"
+ log files will be saved. <a href="/snort/snort_alerts.php?action=clear"><input name="delete" type="button"
class="formbtn" value="Clear"
- onclick="return confirm('Do you really want to remove all your logs ? All snort rule interfces may have to be restarted.')">
+ onclick="return confirm('Do you really want to remove all your logs ? All snort rule interfces may have to be restarted.')"></a>
<span class="red"><strong>Warning:</strong></span> all log files
will be deleted.</form>
</td>
@@ -558,21 +561,11 @@ if ($pconfig['arefresh'] == 'on')
</div>
- <?php
-
- include("fend.inc");
-
- echo $snort_custom_rnd_box;
-
- ?>
-
+<?php
+include("fend.inc");
-<script type="text/javascript">
- var myTable = {};
- window.addEvent('domready', function(){
- myTable = new sortableTable('myTable', {overCls: 'over'});
- });
- </script>
+echo $snort_custom_rnd_box;
+?>
</body>
</html>