From 3ad89438237f2627435c3216dc8598bc6f55bc53 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 16 Sep 2015 00:15:01 +0200 Subject: apache_mod_security - pfSense 2.1.x and 2.2.x and other fixes apache_mod_security_view_logs.php - Valid XHTML - Fix broken error logs view and inverted logic - Make the no-op "Clear log" button actually produce the requested action - Nuke useless pfSense 1.2.x junk - Code style and indentation fixes --- .../apache_mod_security_view_logs.php | 139 +++++++++++---------- 1 file changed, 76 insertions(+), 63 deletions(-) diff --git a/config/apache_mod_security/apache_mod_security_view_logs.php b/config/apache_mod_security/apache_mod_security_view_logs.php index b2e60320..2fbcdcaa 100644 --- a/config/apache_mod_security/apache_mod_security_view_logs.php +++ b/config/apache_mod_security/apache_mod_security_view_logs.php @@ -1,9 +1,9 @@ + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009, 2010 Scott Ullrich + Copyright (C) 2015 ESF, LLC All rights reserved. Redistribution and use in source and binary forms, with or without @@ -27,31 +27,33 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -require("guiconfig.inc"); +require_once("guiconfig.inc"); +require_once("util.inc"); +require_once("/usr/local/pkg/apache_mod_security.inc"); if($_REQUEST['getactivity']) { - if($_REQUEST['logtype'] == "error") - $apachelogs = `cat /var/log/httpd-error.log`; - else - $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";
+	if ($_REQUEST['logtype'] == "error") {
+		$apachelogs = shell_exec("/bin/cat /var/log/httpd-error.log");
+		$logtype = "Error";
+	} else {
+		$apachelogs = shell_exec("/bin/cat /var/log/httpd-access.log");
+		$logtype = "Access";
+	}
+	echo "

Apache+Mod_Security_Proxy Server {$logtype} Logs as of " . date("D M j G:i:s T Y") . "

\n\n";
 	echo $apachelogs;
 	exit;
 }
 
-$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
-if ($pf_version < 2.0)
-	$one_two = true;
+if ($_POST['clear']) {
+	unlink_if_exists("/var/log/httpd-error.log");
+	unlink_if_exists("/var/log/httpd-access.log");
+	apache_mod_security_restart();
+}
 
+$closehead = false;
 $pgtitle = "Services: Mod_Security+Apache+Proxy: Logs";
 include("head.inc");
-
-/* XXX */
-if ($_POST['clear']) { }
-
 ?>
-
 
 
-	
+
+
+
 
-
-
-

- -
- +
+
-
- - - + - -
-
-
-
-
One moment please, loading Apache logs...
+
+
+ + +
+ +
+
+
One moment please, loading Apache logs...
+
+ +
-
- -
-

- " /> -

- + + +
+

+ " /> +

+ +
View error logs"; + if ($_REQUEST['logtype'] != "error") { + echo "
View Error Logs"; } else { - echo "
View access logs"; + echo "
View Access Logs"; } ?> -- cgit v1.2.3