Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Helmo
ISPConfig 3
Commits
118ed211
Commit
118ed211
authored
May 28, 2019
by
Florian Schaal
Browse files
show user + ip in dataloghistory
parent
a122f6ee
Changes
8
Hide whitespace changes
Inline
Side-by-side
install/sql/incremental/upd_dev_collection.sql
View file @
118ed211
...
...
@@ -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
;
install/sql/ispconfig3.sql
View file @
118ed211
...
...
@@ -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
;
-- --------------------------------------------------------
--
...
...
interface/web/login/index.php
View file @
118ed211
...
...
@@ -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'
]))
{
...
...
interface/web/monitor/dataloghistory_view.php
View file @
118ed211
...
...
@@ -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
];
}
...
...
interface/web/monitor/lib/lang/de_dataloghistory_view.lng
View file @
118ed211
...
...
@@ -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'
;
...
...
interface/web/monitor/lib/lang/en_dataloghistory_view.lng
View file @
118ed211
...
...
@@ -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'
;
...
...
interface/web/monitor/templates/dataloghistory_view.htm
View file @
118ed211
...
...
@@ -34,6 +34,12 @@
<td><tmpl_var
name=
"session_id_txt"
></td>
<td><tmpl_var
name=
"session_id"
></td>
</tr>
<tmpl_if
name=
"datalog_username"
op=
"!="
value=
""
>
<tr>
<td><tmpl_var
name=
"datalog_username_txt"
></td>
<td><tmpl_var
name=
"datalog_username"
>
(
<tmpl_var
name=
"datalog_userip_txt"
>
:
<tmpl_var
name=
"datalog_userip"
>
)
</td>
</tr>
</tmpl_if>
</tbody>
</table>
</div>
...
...
server/lib/classes/cron.d/200-logfiles.inc.php
View file @
118ed211
...
...
@@ -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
//######################################################################################################
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment