Misc changes
This commit is contained in:
parent
fa6e941e56
commit
edb03b7862
2 changed files with 147 additions and 138 deletions
|
@ -1,160 +1,169 @@
|
||||||
<h2>System Status Checks</h2>
|
<h2>System Status Checks</h2>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#system-checks .heading td {
|
#system-checks .heading td {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
padding-top: 1.5em;
|
padding-top: 1.5em;
|
||||||
}
|
}
|
||||||
#system-checks .heading.first td {
|
|
||||||
border-top: none;
|
#system-checks .heading.first td {
|
||||||
padding-top: 0;
|
border-top: none;
|
||||||
}
|
padding-top: 0;
|
||||||
#system-checks .status-error td {
|
}
|
||||||
color: #733;
|
|
||||||
}
|
#system-checks .status-error td {
|
||||||
#system-checks .status-warning td {
|
color: rgb(180, 0, 0);
|
||||||
color: #770;
|
}
|
||||||
}
|
|
||||||
#system-checks .status-ok td {
|
#system-checks .status-warning td {
|
||||||
color: #040;
|
color: rgb(180, 180, 0);
|
||||||
}
|
}
|
||||||
#system-checks div.extra {
|
|
||||||
display: none;
|
#system-checks .status-ok td {
|
||||||
margin-top: 1em;
|
color: rgb(0, 180, 0);
|
||||||
max-width: 50em;
|
}
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
#system-checks div.extra {
|
||||||
#system-checks a.showhide {
|
display: none;
|
||||||
display: none;
|
margin-top: 1em;
|
||||||
font-size: 85%;
|
max-width: 50em;
|
||||||
}
|
word-wrap: break-word;
|
||||||
#system-checks .pre {
|
}
|
||||||
margin: 1em;
|
|
||||||
font-family: monospace;
|
#system-checks a.showhide {
|
||||||
white-space: pre-wrap;
|
display: none;
|
||||||
}
|
font-size: 85%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#system-checks .pre {
|
||||||
|
margin: 1em;
|
||||||
|
font-family: monospace;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-push-9 col-md-3">
|
<div class="col-md-push-9 col-md-3">
|
||||||
|
|
||||||
<div id="system-reboot-required" style="display: none; margin-bottom: 1em;">
|
<div id="system-reboot-required" style="display: none; margin-bottom: 1em;">
|
||||||
<button type="button" class="btn btn-danger" onclick="confirm_reboot(); return false;">Reboot Box</button>
|
<button type="button" class="btn btn-danger" onclick="confirm_reboot(); return false;">Reboot Box</button>
|
||||||
<div>No reboot is necessary.</div>
|
<div>No reboot is necessary.</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="system-privacy-setting" style="display: none">
|
<div id="system-privacy-setting" style="display: none">
|
||||||
<div><a onclick="return enable_privacy(!current_privacy_setting)" href="#"><span>Enable/Disable</span> New-Version Check</a></div>
|
<div><a onclick="return enable_privacy(!current_privacy_setting)" href="#"><span>Enable/Disable</span>
|
||||||
<p style="line-height: 125%"><small>(When enabled, status checks phone-home to check for a new release of Mail-in-a-Box.)</small></p>
|
New-Version Check</a></div>
|
||||||
</div>
|
<p style="line-height: 125%"><small>(When enabled, status checks phone-home to check for a new release of
|
||||||
|
Mail-in-a-Box.)</small></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div> <!-- /col -->
|
</div> <!-- /col -->
|
||||||
<div class="col-md-pull-3 col-md-8">
|
<div class="col-md-pull-3 col-md-8">
|
||||||
|
|
||||||
<table id="system-checks" class="table" style="max-width: 60em">
|
<table id="system-checks" class="table" style="max-width: 60em">
|
||||||
<thead>
|
<thead>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div> <!-- /col -->
|
</div> <!-- /col -->
|
||||||
</div> <!-- /row -->
|
</div> <!-- /row -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function show_system_status() {
|
function show_system_status() {
|
||||||
$('#system-checks tbody').html("<tr><td colspan='2' class='text-muted'>Loading...</td></tr>")
|
$('#system-checks tbody').html("<tr><td colspan='2' class='text-muted'>Loading...</td></tr>")
|
||||||
|
|
||||||
api(
|
api(
|
||||||
"/system/privacy",
|
"/system/privacy",
|
||||||
"GET",
|
"GET",
|
||||||
{ },
|
{},
|
||||||
function(r) {
|
function (r) {
|
||||||
current_privacy_setting = r;
|
current_privacy_setting = r;
|
||||||
$('#system-privacy-setting').show();
|
$('#system-privacy-setting').show();
|
||||||
$('#system-privacy-setting a span').text(r ? "Enable" : "Disable");
|
$('#system-privacy-setting a span').text(r ? "Enable" : "Disable");
|
||||||
$('#system-privacy-setting p').toggle(r);
|
$('#system-privacy-setting p').toggle(r);
|
||||||
});
|
});
|
||||||
|
|
||||||
api(
|
api(
|
||||||
"/system/reboot",
|
"/system/reboot",
|
||||||
"GET",
|
"GET",
|
||||||
{ },
|
{},
|
||||||
function(r) {
|
function (r) {
|
||||||
$('#system-reboot-required').show(); // show when r becomes available
|
$('#system-reboot-required').show(); // show when r becomes available
|
||||||
$('#system-reboot-required').find('button').toggle(r);
|
$('#system-reboot-required').find('button').toggle(r);
|
||||||
$('#system-reboot-required').find('div').toggle(!r);
|
$('#system-reboot-required').find('div').toggle(!r);
|
||||||
});
|
});
|
||||||
|
|
||||||
api(
|
api(
|
||||||
"/system/status",
|
"/system/status",
|
||||||
"POST",
|
"POST",
|
||||||
{ },
|
{},
|
||||||
function(r) {
|
function (r) {
|
||||||
$('#system-checks tbody').html("");
|
$('#system-checks tbody').html("");
|
||||||
for (var i = 0; i < r.length; i++) {
|
for (var i = 0; i < r.length; i++) {
|
||||||
var n = $("<tr><td class='status'/><td class='message'><p style='margin: 0'/><div class='extra'/><a class='showhide' href='#'/></tr>");
|
var n = $("<tr><td class='status'/><td class='message'><p style='margin: 0'/><div class='extra'/><a class='showhide' href='#'/></tr>");
|
||||||
if (i == 0) n.addClass('first')
|
if (i == 0) n.addClass('first')
|
||||||
if (r[i].type == "heading")
|
if (r[i].type == "heading")
|
||||||
n.addClass(r[i].type)
|
n.addClass(r[i].type)
|
||||||
else
|
else
|
||||||
n.addClass("status-" + r[i].type)
|
n.addClass("status-" + r[i].type)
|
||||||
if (r[i].type == "ok") n.find('td.status').text("✓")
|
if (r[i].type == "ok") n.find('td.status').text("✓")
|
||||||
if (r[i].type == "error") n.find('td.status').text("✖")
|
if (r[i].type == "error") n.find('td.status').text("✖")
|
||||||
if (r[i].type == "warning") n.find('td.status').text("?")
|
if (r[i].type == "warning") n.find('td.status').text("?")
|
||||||
n.find('td.message p').text(r[i].text)
|
n.find('td.message p').text(r[i].text)
|
||||||
$('#system-checks tbody').append(n);
|
$('#system-checks tbody').append(n);
|
||||||
|
|
||||||
if (r[i].extra.length > 0) {
|
if (r[i].extra.length > 0) {
|
||||||
n.find('a.showhide').show().text("show more").click(function() {
|
n.find('a.showhide').show().text("show more").click(function () {
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
$(this).parent().find('.extra').fadeIn();
|
$(this).parent().find('.extra').fadeIn();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < r[i].extra.length; j++) {
|
for (var j = 0; j < r[i].extra.length; j++) {
|
||||||
|
|
||||||
var m = $("<div/>").text(r[i].extra[j].text)
|
var m = $("<div/>").text(r[i].extra[j].text)
|
||||||
if (r[i].extra[j].monospace)
|
if (r[i].extra[j].monospace)
|
||||||
m.addClass("pre");
|
m.addClass("pre");
|
||||||
n.find('> td.message > div').append(m);
|
n.find('> td.message > div').append(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var current_privacy_setting = null;
|
var current_privacy_setting = null;
|
||||||
function enable_privacy(status) {
|
function enable_privacy(status) {
|
||||||
api(
|
api(
|
||||||
"/system/privacy",
|
"/system/privacy",
|
||||||
"POST",
|
"POST",
|
||||||
{
|
{
|
||||||
value: (status ? "private" : "off")
|
value: (status ? "private" : "off")
|
||||||
},
|
},
|
||||||
function(res) {
|
function (res) {
|
||||||
show_system_status();
|
show_system_status();
|
||||||
});
|
});
|
||||||
return false; // disable link
|
return false; // disable link
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirm_reboot() {
|
function confirm_reboot() {
|
||||||
show_modal_confirm(
|
show_modal_confirm(
|
||||||
"Reboot",
|
"Reboot",
|
||||||
$("<p>This will reboot your Mail-in-a-Box <code>{{hostname}}</code>.</p> <p>Until the machine is fully restarted, your users will not be able to send and receive email, and you will not be able to connect to this control panel or with SSH. The reboot cannot be cancelled.</p>"),
|
$("<p>This will reboot your Mail-in-a-Box <code>{{hostname}}</code>.</p> <p>Until the machine is fully restarted, your users will not be able to send and receive email, and you will not be able to connect to this control panel or with SSH. The reboot cannot be cancelled.</p>"),
|
||||||
"Reboot Now",
|
"Reboot Now",
|
||||||
function() {
|
function () {
|
||||||
api(
|
api(
|
||||||
"/system/reboot",
|
"/system/reboot",
|
||||||
"POST",
|
"POST",
|
||||||
{ },
|
{},
|
||||||
function(r) {
|
function (r) {
|
||||||
var msg = "<p>Please reload this page after a minute or so.</p>";
|
var msg = "<p>Please reload this page after a minute or so.</p>";
|
||||||
if (r) msg = "<p>The reboot command said:</p> <pre>" + $("<pre/>").text(r).html() + "</pre>"; // successful reboots don't produce any output; the output must be HTML-escaped
|
if (r) msg = "<p>The reboot command said:</p> <pre>" + $("<pre/>").text(r).html() + "</pre>"; // successful reboots don't produce any output; the output must be HTML-escaped
|
||||||
show_modal_error("Reboot", msg);
|
show_modal_error("Reboot", msg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -58,7 +58,7 @@ tools/editconf.py /etc/postfix/main.cf \
|
||||||
smtp_bind_address=$PRIVATE_IP \
|
smtp_bind_address=$PRIVATE_IP \
|
||||||
smtp_bind_address6=$PRIVATE_IPV6 \
|
smtp_bind_address6=$PRIVATE_IPV6 \
|
||||||
myhostname=$PRIMARY_HOSTNAME\
|
myhostname=$PRIMARY_HOSTNAME\
|
||||||
smtpd_banner="\$myhostname ESMTP Hi, I'm a Mail-in-a-Box (Ubuntu/Postfix; see https://mailinabox.email/)" \
|
smtpd_banner="\$myhostname ESMTP Hi, I'm a Power Mail-in-a-Box (Debian/Postfix)" \
|
||||||
mydestination=localhost
|
mydestination=localhost
|
||||||
|
|
||||||
# Tweak some queue settings:
|
# Tweak some queue settings:
|
||||||
|
@ -100,7 +100,7 @@ tools/editconf.py /etc/postfix/master.cf -s -w \
|
||||||
# Install the `outgoing_mail_header_filters` file required by the new 'authclean' service.
|
# Install the `outgoing_mail_header_filters` file required by the new 'authclean' service.
|
||||||
cp conf/postfix_outgoing_mail_header_filters /etc/postfix/outgoing_mail_header_filters
|
cp conf/postfix_outgoing_mail_header_filters /etc/postfix/outgoing_mail_header_filters
|
||||||
|
|
||||||
# Modify the `outgoing_mail_header_filters` file to use the local machine name and ip
|
# Modify the `outgoing_mail_header_filters` file to use the local machine name and ip
|
||||||
# on the first received header line. This may help reduce the spam score of email by
|
# on the first received header line. This may help reduce the spam score of email by
|
||||||
# removing the 127.0.0.1 reference.
|
# removing the 127.0.0.1 reference.
|
||||||
sed -i "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" /etc/postfix/outgoing_mail_header_filters
|
sed -i "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" /etc/postfix/outgoing_mail_header_filters
|
||||||
|
|
Loading…
Reference in a new issue