first update
This commit is contained in:
81
services/custombuild/patches/pma_auth_logging.patch.1
Normal file
81
services/custombuild/patches/pma_auth_logging.patch.1
Normal file
@@ -0,0 +1,81 @@
|
||||
diff -rupN libraries.orig/common.inc.php libraries/common.inc.php
|
||||
--- libraries.orig/common.inc.php 2014-12-10 01:51:22.838996733 -0700
|
||||
+++ libraries/common.inc.php 2014-12-10 01:53:35.109996605 -0700
|
||||
@@ -869,6 +869,9 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
$auth_plugin = new $auth_class($plugin_manager);
|
||||
|
||||
if (! $auth_plugin->authCheck()) {
|
||||
+ //DA logging
|
||||
+ log_to_file('', "not authenticated");
|
||||
+
|
||||
/* Force generating of new session on login */
|
||||
PMA_secureSession();
|
||||
$auth_plugin->auth();
|
||||
diff -rupN libraries.orig/logging.lib.php libraries/logging.lib.php
|
||||
--- libraries.orig/logging.lib.php 2014-12-10 01:51:22.830996865 -0700
|
||||
+++ libraries/logging.lib.php 2014-12-10 01:57:20.972996510 -0700
|
||||
@@ -11,6 +11,55 @@ if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
+$LOG_DIR="./log";
|
||||
+$LOG_FILE=$LOG_DIR."/auth.log";
|
||||
+
|
||||
+function ensure_log_dir()
|
||||
+{
|
||||
+ global $LOG_DIR;
|
||||
+ if (is_dir($LOG_DIR))
|
||||
+ return true;
|
||||
+
|
||||
+ if (!mkdir($LOG_DIR, 0770))
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+function log_to_file($user, $status)
|
||||
+{
|
||||
+ if (!ensure_log_dir())
|
||||
+ return false;
|
||||
+
|
||||
+ global $LOG_FILE;
|
||||
+
|
||||
+ if ($user == '')
|
||||
+ {
|
||||
+ //global $PHP_AUTH_USER;
|
||||
+ //$user = $PHP_AUTH_USER;
|
||||
+
|
||||
+ $user = PMA_getenv('PHP_AUTH_USER');
|
||||
+ }
|
||||
+
|
||||
+ if ($user == '')
|
||||
+ return true;
|
||||
+
|
||||
+ //remove any ' characters from $user
|
||||
+ $user = urlencode($user);
|
||||
+
|
||||
+ $log_str = date('M d H:i:s').":: pma auth user='$user' status='$status' ip='".$_SERVER["REMOTE_ADDR"]."'";
|
||||
+
|
||||
+ $fp = fopen($LOG_FILE, 'a');
|
||||
+ if ($fp === false)
|
||||
+ {
|
||||
+ //log to apache error log instead
|
||||
+ error_log($log_str."\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ fwrite($fp, $log_str."\n");
|
||||
+
|
||||
+ fclose($fp);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Logs user information to webserver logs.
|
||||
*
|
||||
@@ -25,6 +74,8 @@ function PMA_logUser($user, $status = 'o
|
||||
apache_note('userID', $user);
|
||||
apache_note('userStatus', $status);
|
||||
}
|
||||
+
|
||||
+ log_to_file($user, $status);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user