aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-06-24 18:35:31 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-06-24 18:35:31 -0400
commite8d8ec142abcb5dc5933ede14ab6236efb60b873 (patch)
tree010368ba550e0be281d4d9806af543d78a160ce3
parent8096a45a34680719162fb6c42655f62815ba926d (diff)
downloadpfsense-packages-e8d8ec142abcb5dc5933ede14ab6236efb60b873.tar.gz
pfsense-packages-e8d8ec142abcb5dc5933ede14ab6236efb60b873.tar.bz2
pfsense-packages-e8d8ec142abcb5dc5933ede14ab6236efb60b873.zip
Add package log viewer for access log. TODO: error log
-rw-r--r--config/apache_mod_security/apache_mod_security.xml6
-rw-r--r--config/apache_mod_security/apache_mod_security_settings.xml4
-rw-r--r--config/apache_mod_security/apache_mod_security_view_logs.php109
3 files changed, 118 insertions, 1 deletions
diff --git a/config/apache_mod_security/apache_mod_security.xml b/config/apache_mod_security/apache_mod_security.xml
index efd7645a..d31dcf0e 100644
--- a/config/apache_mod_security/apache_mod_security.xml
+++ b/config/apache_mod_security/apache_mod_security.xml
@@ -65,7 +65,11 @@
<tab>
<text>Site Proxies</text>
<url>/pkg.php?xml=apache_mod_security.xml</url>
- <active/>
+ <active/>
+ </tab>
+ <tab>
+ <text>Logs</text>
+ <url>/pkg.php?xml=apache_mod_security_view_logs.php</url>
</tab>
</tabs>
<adddeleteeditpagefields>
diff --git a/config/apache_mod_security/apache_mod_security_settings.xml b/config/apache_mod_security/apache_mod_security_settings.xml
index 84421b11..473632ef 100644
--- a/config/apache_mod_security/apache_mod_security_settings.xml
+++ b/config/apache_mod_security/apache_mod_security_settings.xml
@@ -52,6 +52,10 @@
<text>Site Proxies</text>
<url>/pkg.php?xml=apache_mod_security.xml</url>
</tab>
+ <tab>
+ <text>Logs</text>
+ <url>/pkg.php?xml=apache_mod_security_view_logs.php</url>
+ </tab>
</tabs>
<fields>
<field>
diff --git a/config/apache_mod_security/apache_mod_security_view_logs.php b/config/apache_mod_security/apache_mod_security_view_logs.php
new file mode 100644
index 00000000..be47f8e3
--- /dev/null
+++ b/config/apache_mod_security/apache_mod_security_view_logs.php
@@ -0,0 +1,109 @@
+<?php
+/* $Id$ */
+/*
+ apache_mod_security_view_logs.php.php
+ part of pfSense (http://www.pfsense.com/)
+ Copyright (C) 2009 Scott Ullrich <sullrich@gmail.com>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("guiconfig.inc");
+
+if($_REQUEST['getactivity']) {
+ $apachelogs = `cat /var/log/httpd-access.log`;
+ echo "Apache+Mod_Security_Proxy Server logs as of " . date("D M j G:i:s T Y") . "\n\n";
+ echo $apachelogs;
+ exit;
+}
+
+$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
+if(strstr($pfSversion, "1.2"))
+ $one_two = true;
+
+$pgtitle = "Services: Mod_Security+Apache+Proxy: Logs";
+include("head.inc");
+
+/* XXX */
+if ($_POST['clear']) { }
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ function getlogactivity() {
+ var url = "/apache_mod_security_view_logs.php.php";
+ var pars = 'getactivity=yes';
+ var myAjax = new Ajax.Request(
+ url,
+ {
+ method: 'post',
+ parameters: pars,
+ onComplete: activitycallback
+ });
+ }
+ function activitycallback(transport) {
+ $('apachelogs').innerHTML = '<font face="Courier"><pre>' + transport.responseText + '</pre></font>';
+ setTimeout('getlogactivity()', 2500);
+ }
+ setTimeout('getlogactivity()', 1000);
+ </script>
+<?php include("fbegin.inc"); ?>
+
+<?php if($one_two): ?>
+<p class="pgtitle"><?=$pgtitle?></font></p>
+<?php endif; ?>
+
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Proxy Server Settings"), false, "/pkg_edit.php?xml=apache_mod_security_settings.xml&amp;id=0");
+ $tab_array[] = array(gettext("Site Proxies"), false, "/pkg.php?xml=apache_mod_security.xml");
+ $tab_array[] = array(gettext("Logs"), true, "/apache_mod_security_view_logs.php");
+ display_top_tabs($tab_array);
+?>
+</table>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+ <form action="apache_mod_security_view_logs.php.php" method="post">
+ <br>
+ <div id="apachelogs">
+ <pre>One moment please, loading Apache logs...</pre>
+ </div>
+ </td>
+ </tr>
+</table>
+<td align="left" valign="top">
+ <form id="filterform" name="filterform" action="apache_mod_security_view_logs.php.php" method="post" style="margin-top: 14px;">
+ <p/>
+ <input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
+ </form>
+</td>
+</div>
+<?php include("fend.inc"); ?>
+</body>
+</html>