diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql index 671e3742b1301930618bf917ce2c84b2ff722eb1..26ad1d6c479622d538f4dc3f15d3ae1697abfe9d 100644 --- a/install/sql/incremental/upd_dev_collection.sql +++ b/install/sql/incremental/upd_dev_collection.sql @@ -166,3 +166,12 @@ CREATE TABLE IF NOT EXISTS `sys_mailqueue` ( ALTER TABLE `web_domain` ADD `jailkit_jkupdate_cron` enum('n','y') NOT NULL DEFAULT 'y' AFTER `custom_php_ini`; ALTER TABLE `sys_datalog` ADD `session_id` varchar(64) NOT NULL DEFAULT '' AFTER `error`; + +CREATE TABLE IF NOT EXISTS `sys_login` ( + `session_id` varchar(64) NOT NULL, + `username` varchar(64) NOT NULL default '', + `ip` varchar(255) NOT NULL default '', + `login-time` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`session_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 75a698e76351c0aaee2b027148aeb7e49598a7e3..a94f859c45b95b9dbd289525585dff6d66d2f90c 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1556,6 +1556,21 @@ CREATE TABLE `sys_group` ( PRIMARY KEY (`groupid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_login` +-- + +CREATE TABLE `sys_login` ( + `session_id` varchar(64) NOT NULL, + `username` varchar(64) NOT NULL default '', + `ip` varchar(255) NOT NULL default '', + `login-time` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`session_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + -- -------------------------------------------------------- -- diff --git a/interface/web/login/index.php b/interface/web/login/index.php index b55ac74f191eee74e4991fbdef7a8091e0921bb8..c439a636fb7ff337b8d510acdb0d33bd0f1d8844 100644 --- a/interface/web/login/index.php +++ b/interface/web/login/index.php @@ -262,25 +262,18 @@ if(count($_POST) > 0) { $app->plugin->raiseEvent('login', $username); //* Save successfull login message to var - $authlog = 'Successful login for user \''. $username .'\' from '. $_SERVER['REMOTE_ADDR'] .' at '. date('Y-m-d H:i:s') . ' with session ID ' .session_id(); + //$authlog = 'Successful login for user \''. $username .'\' from '. $_SERVER['REMOTE_ADDR'] .' at '. date('Y-m-d H:i:s'); + $authlog = 'Successful login for user \''. $username .'\' from '. $_SERVER['REMOTE_ADDR'] .' at '. date('Y-m-d H:i:s') . ' with session ID ' .session_id(); $authlog_handle = fopen($conf['ispconfig_log_dir'].'/auth.log', 'a'); fwrite($authlog_handle, $authlog ."\n"); fclose($authlog_handle); - - // get last IP used to login - $user_data = $app->db->queryOneRecord("SELECT last_login_ip,last_login_at FROM sys_user WHERE username = ?", $username); - - $_SESSION['s']['last_login_ip'] = $user_data['last_login_ip']; - $_SESSION['s']['last_login_at'] = $user_data['last_login_at']; - if(!$loginAs) { - $app->db->query("UPDATE sys_user SET last_login_ip = ?, last_login_at = ? WHERE username = ?", $_SERVER['REMOTE_ADDR'], time(), $username); - } + $app->db->query("INSERT INTO sys_login (`session_id`, `username`, `ip`, `login-time`) VALUES (?, ?, ?, CURRENT_TIMESTAMP) ON DUPLICATE KEY UPDATE `login-time`=CURRENT_TIMESTAMP", session_id(), $username, $_SERVER['REMOTE_ADDR']); /* * We need LOGIN_REDIRECT instead of HEADER_REDIRECT to load the * new theme, if the logged-in user has another */ - if($loginAs) { + if ($loginAs){ echo 'LOGIN_REDIRECT:'.$_SESSION['s']['module']['startpage']; exit; } else { @@ -292,7 +285,8 @@ if(count($_POST) > 0) { $error = $app->lng('error_user_blocked'); } } else { - if(!$alreadyfailed['times']) { + if(!$alreadyfailed['times'] ) + { //* user login the first time wrong $sql = "INSERT INTO `attempts_login` (`ip`, `times`, `login_time`) VALUES (?, 1, NOW())"; $app->db->query($sql, $ip); @@ -351,17 +345,7 @@ $app->tpl->setVar('current_theme', isset($_SESSION['s']['theme']) ? $_SESSION['s //die(isset($_SESSION['s']['theme']) ? $_SESSION['s']['theme'] : 'default'); // Logo -$logo = $app->db->queryOneRecord("SELECT * FROM sys_ini WHERE sysini_id = 1"); -if($logo['custom_logo'] != ''){ - $base64_logo_txt = $logo['custom_logo']; -} else { - $base64_logo_txt = $logo['default_logo']; -} -$tmp_base64 = explode(',', $base64_logo_txt, 2); -$logo_dimensions = $app->functions->getimagesizefromstring(base64_decode($tmp_base64[1])); -$app->tpl->setVar('base64_logo_width', $logo_dimensions[0].'px'); -$app->tpl->setVar('base64_logo_height', $logo_dimensions[1].'px'); -$app->tpl->setVar('base64_logo_txt', $base64_logo_txt); +$app->tpl->logo(); // Title if (!empty($sys_config['company_name'])) { diff --git a/interface/web/monitor/dataloghistory_view.php b/interface/web/monitor/dataloghistory_view.php index ae0821b535a70af6670fc3c24f6b37aaab8ff986..450fb4203024c8cb2c66466be6512e83f2ed65f4 100644 --- a/interface/web/monitor/dataloghistory_view.php +++ b/interface/web/monitor/dataloghistory_view.php @@ -57,6 +57,13 @@ $out['action_name'] = $app->lng($record['action']); $out['session_id'] = $record['session_id']; +if ($out['session_id'] != '') { + $temp = $app->db->queryOneRecord("SELECT username, ip FROM sys_login WHERE session_id = ?", $out['session_id']); + $out['datalog_username'] = $temp['username']; + $out['datalog_userip'] = $temp['ip']; + unset($temp); +} + if(!$data = unserialize(stripslashes($record['data']))) { $data = unserialize($record['data']); } @@ -118,7 +125,7 @@ function show_diff_if_needed($old, $new) { global $app; $diff_min_lines = 6; - +$where = @($action == 'd')?$data['old']['parent_domain_id']:$data['new']['parent_domain_id']; if (substr_count($old, "\n") >= $diff_min_lines || substr_count($new, "\n") >= $diff_min_lines) { $opcodes = FineDiff::getDiffOpcodes($old, $new); $html = FineDiff::renderUTF8DiffToHTMLFromOpcodes($old, $opcodes); @@ -128,7 +135,7 @@ function show_diff_if_needed($old, $new) { } } -function describe($dbtable, $data, $out) { +function describe($dbtable, $data, $out, $action) { global $app; $out['describe'] = $app->lng('describe_'.$dbtable); switch ($dbtable) { @@ -149,6 +156,14 @@ function describe($dbtable, $data, $out) { case 'ftp_user': $check = 'username'; break; + case 'mail_archive': + $check = 'storage'; + break; + case 'mail_archive_store': + $where = @($action == 'd')?$data['old']['domain_id']:$data['new']['domain_id']; + $temp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain_id = ?", $where); + $out['describe_data'] = $temp['domain']; + break; case 'mail_domain': $check = 'domain'; break; @@ -161,6 +176,12 @@ function describe($dbtable, $data, $out) { case 'mail_user_filter': $check = 'rulename'; break; + case 'managed_monitor_checks': + $check = 'description'; + break; + case 'managed_php': + $check = 'version'; + break; case 'remote_user': $check = 'remote_username'; break; @@ -190,7 +211,7 @@ function describe($dbtable, $data, $out) { break; } - if(!isset($out['describe_data'])) { + if(!isset($out['describe_data'])) { $out['describe_data'] = @(isset($data['old'][$check]) && $data['old'][$check] != $data['new'][$check])?$data['old'][$check].'/'.$data['new'][$check]:$data['new'][$check]; } diff --git a/interface/web/monitor/lib/lang/de_dataloghistory_view.lng b/interface/web/monitor/lib/lang/de_dataloghistory_view.lng index de331bfebcaa1250720a7b85bc2b85e1208e230d..1917564f8126af571c4f2fa75da617c892084d46 100644 --- a/interface/web/monitor/lib/lang/de_dataloghistory_view.lng +++ b/interface/web/monitor/lib/lang/de_dataloghistory_view.lng @@ -23,15 +23,21 @@ $wb['new_txt'] = 'Neu'; $wb['btn_cancel_txt'] = 'Zurück'; $wb['undo_txt'] = 'Rückgängig machen'; $wb['undo_confirmation_txt'] = 'Soll diese Änderung wirklich rückgängig gemacht werden?'; +$wb['datalog_username_txt'] = 'Username'; +$wb['datalog_userip_txt'] = 'IP'; $wb['describe_client'] = 'Username'; $wb['describe_cron'] = 'Webseite'; $wb['describe_directive_snippets'] = 'Direktiven Schnippsel'; $wb['describe_domain'] = 'Domain'; $wb['describe_ftp_user'] = 'FTP-User'; +$wb['describe_mail_archive'] = 'Mail-Archiv'; +$wb['describe_mail_archive_store'] = 'Archiviert Email-Domain'; $wb['describe_mail_domain'] = 'Email-Domain'; $wb['describe_mail_forwarding'] = 'Quelle'; $wb['describe_mail_user'] = 'Email'; $wb['describe_mail_user_filter'] = 'Mailuser-Filter'; +$wb['describe_managed_php'] = 'PHP Version'; +$wb['describe_managed_monitor_checks'] = 'Check'; $wb['describe_remote_user'] = 'Remote-User'; $wb['describe_server_php'] = 'PHP Version'; $wb['describe_shell_user'] = 'Shell-User'; diff --git a/interface/web/monitor/lib/lang/en_dataloghistory_view.lng b/interface/web/monitor/lib/lang/en_dataloghistory_view.lng index bdb961ffa9556be856a120f710c13cb0931979c8..cd24f59986f0c3fca2073eba21848dec15cdf549 100644 --- a/interface/web/monitor/lib/lang/en_dataloghistory_view.lng +++ b/interface/web/monitor/lib/lang/en_dataloghistory_view.lng @@ -23,15 +23,21 @@ $wb['new_txt'] = 'New'; $wb['btn_cancel_txt'] = 'Back'; $wb['undo_txt'] = 'Undo action'; $wb['undo_confirmation_txt'] = 'Do you really want to undo this action?'; +$wb['datalog_username_txt'] = 'Username'; +$wb['datalog_userip_txt'] = 'IP'; $wb['describe_client'] = 'Username'; $wb['describe_cron'] = 'Website'; $wb['describe_directive_snippets'] = 'Direktive Snippet'; $wb['describe_domain'] = 'Domain'; $wb['describe_ftp_user'] = 'FTP-User'; +$wb['describe_mail_archive'] = 'Mail-Archiv'; +$wb['describe_mail_archive_store'] = 'Archived Email-Domain'; $wb['describe_mail_domain'] = 'Email-Domain'; $wb['describe_mail_forwarding'] = 'Source'; $wb['describe_mail_user'] = 'Email'; $wb['describe_mail_user_filter'] = 'Mailuser-Filter'; +$wb['describe_managed_monitor_checks'] = 'Check'; +$wb['describe_managed_php'] = 'PHP Version'; $wb['describe_remote_user'] = 'Remote-User'; $wb['describe_shell_user'] = 'Shell-User'; $wb['describe_server_php'] = 'PHP Version'; diff --git a/interface/web/monitor/templates/dataloghistory_view.htm b/interface/web/monitor/templates/dataloghistory_view.htm index f92a9a1e49f7ffaa8978054ab5cc83e1914241e0..1ff5ec50901e8314d6fd6a6e554168a6760bda6f 100644 --- a/interface/web/monitor/templates/dataloghistory_view.htm +++ b/interface/web/monitor/templates/dataloghistory_view.htm @@ -34,6 +34,12 @@ + + + + (: ) + + diff --git a/server/lib/classes/cron.d/200-logfiles.inc.php b/server/lib/classes/cron.d/200-logfiles.inc.php index 6f38f0b403d66dee84f581dad70ed70e5bf21a5d..153539a06e577430aabc3cf8fc15ae4793bbc71a 100644 --- a/server/lib/classes/cron.d/200-logfiles.inc.php +++ b/server/lib/classes/cron.d/200-logfiles.inc.php @@ -206,6 +206,8 @@ class cronjob_logfiles extends cronjob { } } + $app->db->query("DELETE FROM `sys_login` WHERE `login-time` < ADDDATE(NOW(), INTERVAL -? DAY)", $max_syslog); + //###################################################################################################### // Cleanup website tmp directories //######################################################################################################