Change admin layout, add Postfix logs
parent
aa98d86feb
commit
3b80a1af37
|
@ -7,9 +7,21 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
||||||
$tfa_data = get_tfa();
|
$tfa_data = get_tfa();
|
||||||
?>
|
?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h4><span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?=$lang['admin']['access'];?></h4>
|
|
||||||
|
|
||||||
<div class="panel-group">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
|
<li role="presentation" class="active">
|
||||||
|
<a href="#tab-access" aria-controls="tab-access" role="tab" data-toggle="tab"><?=$lang['admin']['access'];?></a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation">
|
||||||
|
<a href="#tab-config" aria-controls="tab-config" role="tab" data-toggle="tab"><?=$lang['admin']['configuration'];?></a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation">
|
||||||
|
<a href="#tab-logs" aria-controls="tab-logs" role="tab" data-toggle="tab"><?=$lang['admin']['logs'];?></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" style="padding-top:20px">
|
||||||
|
<div role="tabpanel" class="tab-pane active" id="tab-access">
|
||||||
<div class="panel panel-danger">
|
<div class="panel panel-danger">
|
||||||
<div class="panel-heading"><?=$lang['admin']['admin_details'];?></div>
|
<div class="panel-heading"><?=$lang['admin']['admin_details'];?></div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
@ -138,10 +150,8 @@ $tfa_data = get_tfa();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4><span class="glyphicon glyphicon-wrench" aria-hidden="true"></span> <?=$lang['admin']['configuration'];?></h4>
|
|
||||||
|
|
||||||
<div class="panel-group">
|
|
||||||
|
|
||||||
|
<div role="tabpanel" class="tab-pane" id="tab-config">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading"><?=$lang['admin']['dkim_keys'];?></div>
|
<div class="panel-heading"><?=$lang['admin']['dkim_keys'];?></div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
@ -329,16 +339,39 @@ $tfa_data = get_tfa();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4><span class="glyphicon glyphicon-book" aria-hidden="true"></span> Mail Logs</h4>
|
<div role="tabpanel" class="tab-pane" id="tab-logs">
|
||||||
<div class="panel-group">
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">Logs</div>
|
<div class="panel-heading">Dovecot
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<a class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['admin']['action'];?> <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="#" id="refresh_dovecot_log"><?=$lang['admin']['refresh'];?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped" id="dovecot_log"></table>
|
<table class="table table-striped" id="dovecot_log"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Postfix
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<a class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" href="#"><?=$lang['admin']['action'];?> <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="#" id="refresh_postfix_log"><?=$lang['admin']['refresh'];?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped" id="postfix_log"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- /container -->
|
</div> <!-- /container -->
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
|
|
|
@ -11,3 +11,6 @@ table.footable>tbody>tr.footable-empty>td {
|
||||||
.table-responsive {
|
.table-responsive {
|
||||||
overflow: visible !important;
|
overflow: visible !important;
|
||||||
}
|
}
|
||||||
|
body {
|
||||||
|
overflow-y:scroll;
|
||||||
|
}
|
||||||
|
|
|
@ -5202,7 +5202,10 @@ function get_logs($container, $lines = 100) {
|
||||||
}
|
}
|
||||||
if ($container == "postfix-mailcow") {
|
if ($container == "postfix-mailcow") {
|
||||||
if ($data = $redis->lRange('POSTFIX_MAILLOG', 1, $lines)) {
|
if ($data = $redis->lRange('POSTFIX_MAILLOG', 1, $lines)) {
|
||||||
return $data;
|
foreach ($data as $json_line) {
|
||||||
|
$data_array[] = json_decode($json_line, true);
|
||||||
|
}
|
||||||
|
return $data_array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -21,8 +21,8 @@ $csrfProtector = new csrfProtector;
|
||||||
class mailcowCsrfProtector extends csrfprotector {
|
class mailcowCsrfProtector extends csrfprotector {
|
||||||
public static function logCSRFattack() {
|
public static function logCSRFattack() {
|
||||||
$_SESSION['return'] = array(
|
$_SESSION['return'] = array(
|
||||||
'type' => 'danger',
|
'type' => 'warning',
|
||||||
'msg' => 'CSRF violation'
|
'msg' => 'CSRF violation, please try again.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,20 +39,42 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$("#refresh_dovecot_log").on('click', function(e) {
|
||||||
|
function unix_time_format(tm) {
|
||||||
|
var date = new Date(tm ? tm * 1000 : 0);
|
||||||
|
return date.toLocaleString();
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
if (typeof ft_dovecot_logs != 'undefined') {
|
||||||
|
ft_dovecot_logs.destroy();
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
url: '/api/v1/get/logs/dovecot/all',
|
url: '/api/v1/get/logs/dovecot/1000',
|
||||||
jsonp: false,
|
jsonp: false,
|
||||||
error: function () {
|
error: function () {
|
||||||
alert('Cannot draw dovecot log table');
|
alert('Cannot draw dovecot log table');
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$('#dovecot_log').footable({
|
$.each(data, function (i, item) {
|
||||||
|
var danger_class = ["emerg", "alert", "crit"];
|
||||||
|
var warning_class = ["warning"];
|
||||||
|
var info_class = ["notice", "info", "debug"];
|
||||||
|
if (jQuery.inArray(item.priority, danger_class) !== -1) {
|
||||||
|
item.priority = '<span class="label label-danger">' + item.priority + '</span>';
|
||||||
|
}
|
||||||
|
else if (jQuery.inArray(item.priority, warning_class) !== -1) {
|
||||||
|
item.priority = '<span class="label label-warning">' + item.priority + '</span>';
|
||||||
|
}
|
||||||
|
else if (jQuery.inArray(item.priority, info_class) !== -1) {
|
||||||
|
item.priority = '<span class="label label-info">' + item.priority + '</span>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ft_dovecot_logs = FooTable.init("#dovecot_log", {
|
||||||
"columns": [
|
"columns": [
|
||||||
{"name":"time","title":"time"},
|
{"name":"time","formatter":function unix_time_format(tm) {var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.time,"style":{"width":"170px"}},
|
||||||
{"name":"program","title":"program"},
|
{"name":"priority","title":lang.priority,"style":{"width":"80px"}},
|
||||||
{"name":"priority","title":"priority"},
|
{"name":"message","title":lang.message},
|
||||||
{"name":"message","title":"message"},
|
|
||||||
],
|
],
|
||||||
"rows": data,
|
"rows": data,
|
||||||
"empty": lang.empty,
|
"empty": lang.empty,
|
||||||
|
@ -72,4 +94,63 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
$("#refresh_postfix_log").on('click', function(e) {
|
||||||
|
function unix_time_format(tm) {
|
||||||
|
var date = new Date(tm ? tm * 1000 : 0);
|
||||||
|
return date.toLocaleString();
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
if (typeof ft_postfix_logs != 'undefined') {
|
||||||
|
ft_postfix_logs.destroy();
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
dataType: 'json',
|
||||||
|
url: '/api/v1/get/logs/postfix/1000',
|
||||||
|
jsonp: false,
|
||||||
|
error: function () {
|
||||||
|
alert('Cannot draw postfix log table');
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$.each(data, function (i, item) {
|
||||||
|
var danger_class = ["emerg", "alert", "crit"];
|
||||||
|
var warning_class = ["warning"];
|
||||||
|
var info_class = ["notice", "info", "debug"];
|
||||||
|
if (jQuery.inArray(item.priority, danger_class) !== -1) {
|
||||||
|
item.priority = '<span class="label label-danger">' + item.priority + '</span>';
|
||||||
|
}
|
||||||
|
else if (jQuery.inArray(item.priority, warning_class) !== -1) {
|
||||||
|
item.priority = '<span class="label label-warning">' + item.priority + '</span>';
|
||||||
|
}
|
||||||
|
else if (jQuery.inArray(item.priority, info_class) !== -1) {
|
||||||
|
item.priority = '<span class="label label-info">' + item.priority + '</span>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ft_postfix_logs = FooTable.init("#postfix_log", {
|
||||||
|
"columns": [
|
||||||
|
{"name":"time","formatter":function unix_time_format(tm) {var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.time,"style":{"width":"170px"}},
|
||||||
|
{"name":"priority","title":lang.priority,"style":{"width":"80px"}},
|
||||||
|
{"name":"message","title":lang.message},
|
||||||
|
],
|
||||||
|
"rows": data,
|
||||||
|
"empty": lang.empty,
|
||||||
|
"paging": {
|
||||||
|
"enabled": true,
|
||||||
|
"limit": 5,
|
||||||
|
"size": pagination_size
|
||||||
|
},
|
||||||
|
"filtering": {
|
||||||
|
"enabled": true,
|
||||||
|
"position": "left",
|
||||||
|
"placeholder": lang.filter_table
|
||||||
|
},
|
||||||
|
"sorting": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#refresh_dovecot_log").trigger('click');
|
||||||
|
$("#refresh_postfix_log").trigger('click');
|
||||||
});
|
});
|
|
@ -471,6 +471,11 @@ $lang['admin']['set_rr_failed'] = 'Kann Postfix Restriktionen nicht setzen';
|
||||||
$lang['admin']['no_record'] = 'Kein Eintrag';
|
$lang['admin']['no_record'] = 'Kein Eintrag';
|
||||||
$lang['admin']['filter_table'] = 'Tabelle Filtern';
|
$lang['admin']['filter_table'] = 'Tabelle Filtern';
|
||||||
$lang['admin']['empty'] = 'Keine Einträge vorhanden';
|
$lang['admin']['empty'] = 'Keine Einträge vorhanden';
|
||||||
|
$lang['admin']['time'] = 'Zeit';
|
||||||
|
$lang['admin']['priority'] = 'Gewichtung';
|
||||||
|
$lang['admin']['refresh'] = 'Neu laden';
|
||||||
|
$lang['admin']['logs'] = 'Logs';
|
||||||
|
$lang['admin']['message'] = 'Nachricht';
|
||||||
$lang['admin']['forwarding_hosts'] = 'Weiterleitungs-Hosts';
|
$lang['admin']['forwarding_hosts'] = 'Weiterleitungs-Hosts';
|
||||||
$lang['admin']['forwarding_hosts_hint'] = 'Eingehende Nachrichten werden von den hier gelisteten Hosts bedingungslos akzeptiert. Diese Hosts werden dann nicht mit DNSBLs abgeglichen oder Greylisting unterworfen. Von ihnen empfangener Spam wird nie abgelehnt und immer in den Spam-Ordner einsortiert. Die übliche Verwendung für diese Funktion ist, um Mailserver anzugeben, auf denen eine Weiterleitung zu Ihrem Mailcow-Server eingerichtet wurde.';
|
$lang['admin']['forwarding_hosts_hint'] = 'Eingehende Nachrichten werden von den hier gelisteten Hosts bedingungslos akzeptiert. Diese Hosts werden dann nicht mit DNSBLs abgeglichen oder Greylisting unterworfen. Von ihnen empfangener Spam wird nie abgelehnt und immer in den Spam-Ordner einsortiert. Die übliche Verwendung für diese Funktion ist, um Mailserver anzugeben, auf denen eine Weiterleitung zu Ihrem Mailcow-Server eingerichtet wurde.';
|
||||||
$lang['admin']['forwarding_hosts_add_hint'] = 'Sie können entweder IPv4/IPv6-Adressen, Netzwerke in CIDR-Notation, Hostnamen (die zu IP-Adressen aufgelöst werden), oder Domainnamen (die zu IP-Adressen aufgelöst werden, indem ihr SPF-Record abgefragt wird oder, in dessen Abwesenheit, ihre MX-Records) angeben.';
|
$lang['admin']['forwarding_hosts_add_hint'] = 'Sie können entweder IPv4/IPv6-Adressen, Netzwerke in CIDR-Notation, Hostnamen (die zu IP-Adressen aufgelöst werden), oder Domainnamen (die zu IP-Adressen aufgelöst werden, indem ihr SPF-Record abgefragt wird oder, in dessen Abwesenheit, ihre MX-Records) angeben.';
|
||||||
|
|
|
@ -483,6 +483,11 @@ $lang['admin']['set_rr_failed'] = 'Cannot set Postfix restrictions';
|
||||||
$lang['admin']['no_record'] = 'No record';
|
$lang['admin']['no_record'] = 'No record';
|
||||||
$lang['admin']['filter_table'] = 'Filter table';
|
$lang['admin']['filter_table'] = 'Filter table';
|
||||||
$lang['admin']['empty'] = 'No results';
|
$lang['admin']['empty'] = 'No results';
|
||||||
|
$lang['admin']['time'] = 'Time';
|
||||||
|
$lang['admin']['priority'] = 'Priority';
|
||||||
|
$lang['admin']['message'] = 'Message';
|
||||||
|
$lang['admin']['refresh'] = 'Refresh';
|
||||||
|
$lang['admin']['logs'] = 'Logs';
|
||||||
$lang['admin']['forwarding_hosts'] = 'Forwarding Hosts';
|
$lang['admin']['forwarding_hosts'] = 'Forwarding Hosts';
|
||||||
$lang['admin']['forwarding_hosts_hint'] = 'Incoming messages are unconditionally accepted from any hosts listed here. These hosts are then not checked against DNSBLs or subjected to greylisting. Spam received from them is never rejected and always filed into the Junk folder. The most common use for this is to specify mail servers on which you have set up a rule that forwards incoming emails to your Mailcow server.';
|
$lang['admin']['forwarding_hosts_hint'] = 'Incoming messages are unconditionally accepted from any hosts listed here. These hosts are then not checked against DNSBLs or subjected to greylisting. Spam received from them is never rejected and always filed into the Junk folder. The most common use for this is to specify mail servers on which you have set up a rule that forwards incoming emails to your Mailcow server.';
|
||||||
$lang['admin']['forwarding_hosts_add_hint'] = 'You can either specify IPv4/IPv6 addresses, networks in CIDR notation, host names (which will be resolved to IP addresses), or domain names (which will be resolved to IP addresses by querying SPF records or, in their absence, MX records).';
|
$lang['admin']['forwarding_hosts_add_hint'] = 'You can either specify IPv4/IPv6 addresses, networks in CIDR notation, host names (which will be resolved to IP addresses), or domain names (which will be resolved to IP addresses by querying SPF records or, in their absence, MX records).';
|
||||||
|
|
Loading…
Reference in New Issue