Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Logging the SQL host on the authentication log #17415

@jb-boin

Description

@jb-boin

We are using a single PMA for multiple servers and identical usernames can exist on more than one server, logging the hostname in addition to the username on the AuthLog is thus needed.

Here is the current patch i use on 5.1.3 :

--- libraries/common.inc.php	2022-02-10 23:16:06.000000000 +0100
+++ libraries/common.inc.php	2022-02-22 18:40:03.732456853 +0100
@@ -279,7 +279,7 @@
         $auth_plugin->checkTwoFactor();
 
         /* Log success */
-        Logging::logUser($cfg['Server']['user']);
+        Logging::logUser($cfg['Server']['user']."@".$cfg['Server']['host']);
 
         if ($dbi->getVersion() < $cfg['MysqlMinVersion']['internal']) {
             Core::fatalError(

Before, on the AuthLog :

Feb 22 18:51:04 phpmyadmin: user authenticated: sqluser from 1.2.3.4
Feb 22 18:51:10 phpmyadmin: user authenticated: sqluser from 4.3.2.1

With the patch :

Feb 22 18:51:04 phpmyadmin: user authenticated: sqluser@sqlserver1 from 1.2.3.4
Feb 22 18:51:10 phpmyadmin: user authenticated: sqluser@sqlserver2 from 4.3.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementA feature request for improving phpMyAdminpatch

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions