Skip to content

Commit d96613b

Browse files
deflume1JoshData
authored andcommitted
minimal changeset to get things working on 18.04
@JoshData squashed pull request mail-in-a-box#1398, removed some comments, and added these notes: * The old init.d script for the management daemon is replaced with a systemd service. * A systemd service configuration is added to configure permissions for munin on startup. * nginx SSL settings are updated because nginx's options and defaults have changed, and we now enable http2. * Automatic SSHFP record generation is updated to know that 22 is the default SSH daemon port, since it is no longer explicit in sshd_config. * The dovecot-lucene package is dropped because the Mail-in-a-Box PPA where we built the package has not been updated for Ubuntu 18.04. * The stock postgrey package is installed instead of the one from our PPA (which we no longer support), which loses the automatic whitelisting of DNSWL.org-whitelisted senders. * Drop memcached and the status check for memcached, which we used to use with ownCloud long ago but are no longer installing. * Other minor changes.
1 parent 504a9b0 commit d96613b

20 files changed

+101
-412
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
CHANGELOG
22
=========
33

4+
This branch supports Ubuntu 18.04 **only**. When upgrading, **always** upgrade your **existing** Ubuntu 14.04 machine to version the latest release supporting Ubuntu 14.04 --- v0.28. If you are running an older version of Mail-in-a-Box which has an old version of ownCloud or Nextcloud, you will *not* be able to upgrade your data because older versions of ownCloud and Nextcloud that are required to perform the upgrade *cannot* be run on Ubuntu 18.04.
5+
46
In Development
57
--------------
68

79
* Starting with v0.28, TLS certificate provisioning wouldn't work on new boxes until the mailinabox setup command was run a second time because of a problem with the non-interactive setup.
10+
811
* Update to Nextcloud 13.0.5.
912
* Update to Roundcube 1.3.7.
1013
* Update to Z-Push 2.4.4.

Vagrantfile

+1-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22
# vi: set ft=ruby :
33

44
Vagrant.configure("2") do |config|
5-
config.vm.box = "ubuntu14.04"
6-
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
7-
8-
if Vagrant.has_plugin?("vagrant-cachier")
9-
# Configure cached packages to be shared between instances of the same base box.
10-
# More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
11-
config.cache.scope = :box
12-
end
5+
config.vm.box = "ubuntu/bionic64"
136

147
# Network config: Since it's a mail server, the machine must be connected
158
# to the public web. However, we currently don't want to expose SSH since

conf/mailinabox.service

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Unit]
2+
Description=Mail-in-a-Box System Management Service
3+
After=multi-user.target
4+
5+
[Service]
6+
Type=idle
7+
ExecStart=/usr/local/lib/mailinabox/start
8+
9+
[Install]
10+
WantedBy=multi-user.target

conf/management-initscript

-135
This file was deleted.

conf/munin.service

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Unit]
2+
Description=Munin System Monitoring Startup Script
3+
After=multi-user.target
4+
5+
[Service]
6+
Type=idle
7+
ExecStart=/usr/local/lib/mailinabox/munin_start.sh
8+
9+
[Install]
10+
WantedBy=multi-user.target

conf/nginx-ssl.conf

+7-63
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,20 @@
1-
# from https://gist.github.com/konklone/6532544 and https://mozilla.github.io/server-side-tls/ssl-config-generator/
2-
###################################################################################################################
3-
4-
# Basically the nginx configuration I use at konklone.com.
5-
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
6-
#
7-
# To provide feedback, please tweet at @konklone or email [email protected].
8-
# Comments on gists don't notify the author.
9-
#
10-
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
11-
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
12-
13-
# Path to certificate and private key.
14-
# The .crt may omit the root CA cert, if it's a standard CA that ships with clients.
15-
#ssl_certificate /path/to/unified.crt;
16-
#ssl_certificate_key /path/to/my-private-decrypted.key;
17-
18-
# Tell browsers to require SSL (warning: difficult to change your mind)
19-
# Handled by the management daemon because we can toggle this version or a
20-
# preload version.
21-
#add_header Strict-Transport-Security max-age=31536000;
22-
23-
# Prefer certain ciphersuites, to enforce Forward Secrecy and avoid known vulnerabilities.
24-
#
25-
# Forces forward secrecy in all browsers and clients that can use TLS,
26-
# but with a small exception (DES-CBC3-SHA) for IE8/XP users.
27-
#
28-
# Reference client: https://www.ssllabs.com/ssltest/analyze.html
29-
ssl_prefer_server_ciphers on;
30-
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
31-
32-
# Cut out (the old, broken) SSLv3 entirely.
33-
# This **excludes IE6 users** and (apparently) Yandexbot.
34-
# Just comment out if you need to support IE6, bless your soul.
1+
# We track the Mozilla "intermediate" compatibility TLS recommendations.
2+
# Note that these settings are repeated in the SMTP and IMAP configuration.
353
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
4+
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
5+
ssl_dhparam STORAGE_ROOT/ssl/dh2048.pem;
366

37-
# Turn on session resumption, using a cache shared across nginx processes,
387
# as recommended by http://nginx.org/en/docs/http/configuring_https_servers.html
398
ssl_session_cache shared:SSL:50m;
409
ssl_session_timeout 1d;
41-
#keepalive_timeout 70; # in Ubuntu 14.04/nginx 1.4.6 the default is 65, so plenty good
4210

4311
# Buffer size of 1400 bytes fits in one MTU.
4412
# nginx 1.5.9+ ONLY
45-
#ssl_buffer_size 1400;
46-
47-
# SPDY header compression (0 for none, 9 for slow/heavy compression). Preferred is 6.
48-
#
49-
# BUT: header compression is flawed and vulnerable in SPDY versions 1 - 3.
50-
# Disable with 0, until using a version of nginx with SPDY 4.
51-
spdy_headers_comp 0;
52-
53-
# Now let's really get fancy, and pre-generate a 2048 bit random parameter
54-
# for DH elliptic curves. If not created and specified, default is only 1024 bits.
55-
#
56-
# Generated by OpenSSL with the following command:
57-
# openssl dhparam -outform pem -out dhparam2048.pem 2048
58-
#
59-
# Note: raising the bits to 2048 excludes Java 6 clients. Comment out if a problem.
60-
ssl_dhparam STORAGE_ROOT/ssl/dh2048.pem;
61-
13+
ssl_buffer_size 1400;
6214

63-
# OCSP stapling - means nginx will poll the CA for signed OCSP responses,
64-
# and send them to clients so clients don't make their own OCSP calls.
65-
# http://en.wikipedia.org/wiki/OCSP_stapling
66-
#
67-
# while the ssl_certificate above may omit the root cert if the CA is trusted,
68-
# ssl_trusted_certificate below must point to a chain of **all** certs
69-
# in the trust path - (your cert, intermediary certs, root cert)
70-
#
71-
# 8.8.8.8 and 8.8.4.4 below are Google's public IPv4 DNS servers.
72-
# nginx will use them to talk to the CA.
7315
ssl_stapling on;
7416
ssl_stapling_verify on;
7517
resolver 127.0.0.1 valid=86400;
7618
resolver_timeout 10;
19+
20+
# h/t https://gist.github.com/konklone/6532544

conf/nginx.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ server {
3131

3232
# The secure HTTPS server.
3333
server {
34-
listen 443 ssl;
35-
listen [::]:443 ssl;
34+
listen 443 ssl http2;
35+
listen [::]:443 ssl http2;
3636

3737
server_name $HOSTNAME;
3838

management/dns_update.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,20 @@ def build_sshfp_records():
354354
# Get our local fingerprints by running ssh-keyscan. The output looks
355355
# like the known_hosts file: hostname, keytype, fingerprint. The order
356356
# of the output is arbitrary, so sort it to prevent spurrious updates
357-
# to the zone file (that trigger bumping the serial number).
358-
359-
# scan the sshd_config and find the ssh ports (port 22 may be closed)
357+
# to the zone file (that trigger bumping the serial number). However,
358+
# if SSH has been configured to listen on a nonstandard port, we must
359+
# specify that port to sshkeyscan.
360+
port = 22
360361
with open('/etc/ssh/sshd_config', 'r') as f:
361-
ports = []
362-
t = f.readlines()
363-
for line in t:
364-
s = line.split()
362+
for line in f:
363+
s = line.rstrip().split()
365364
if len(s) == 2 and s[0] == 'Port':
366-
ports = ports + [s[1]]
367-
# the keys are the same at each port, so we only need to get
368-
# them at the first port found (may not be port 22)
369-
keys = shell("check_output", ["ssh-keyscan", "-t", "rsa,dsa,ecdsa,ed25519", "-p", ports[0], "localhost"])
365+
try:
366+
port = int(s[1])
367+
except ValueError:
368+
pass
369+
break
370+
keys = shell("check_output", ["ssh-keyscan", "-t", "rsa,dsa,ecdsa,ed25519", "-p", str(port), "localhost"])
370371
for key in sorted(keys.split("\n")):
371372
if key.strip() == "" or key[0] == "#": continue
372373
try:

management/munin_start.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
mkdir -p /var/run/munin && chown munin /var/run/munin

management/status_checks.py

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def get_services():
2828
{ "name": "Spamassassin", "port": 10025, "public": False, },
2929
{ "name": "OpenDKIM", "port": 8891, "public": False, },
3030
{ "name": "OpenDMARC", "port": 8893, "public": False, },
31-
{ "name": "Memcached", "port": 11211, "public": False, },
3231
{ "name": "Mail-in-a-Box Management Daemon", "port": 10222, "public": False, },
3332
{ "name": "SSH Login (ssh)", "port": get_ssh_port(), "public": True, },
3433
{ "name": "Public DNS (nsd4)", "port": 53, "public": True, },

setup/dkim.sh

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ mkdir -p $STORAGE_ROOT/mail/dkim
2121
# Not quite sure why.
2222
echo "127.0.0.1" > /etc/opendkim/TrustedHosts
2323

24+
# We need to at least create these files, since we reference them later.
25+
# Otherwise, opendkim startup will fail
26+
touch /etc/opendkim/KeyTable
27+
touch /etc/opendkim/SigningTable
28+
2429
if grep -q "ExternalIgnoreList" /etc/opendkim.conf; then
2530
true # already done #NODOC
2631
else
@@ -75,6 +80,9 @@ tools/editconf.py /etc/postfix/main.cf \
7580
non_smtpd_milters=\$smtpd_milters \
7681
milter_default_action=accept
7782

83+
# We need to explicitly enable the opendmarc service, or it will not start
84+
hide_output systemctl enable opendmarc
85+
7886
# Restart services.
7987
restart_service opendkim
8088
restart_service opendmarc

setup/mail-dovecot.sh

+1-12
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ source /etc/mailinabox.conf # load global vars
2626
echo "Installing Dovecot (IMAP server)..."
2727
apt_install \
2828
dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-sqlite sqlite3 \
29-
dovecot-sieve dovecot-managesieved dovecot-lucene
29+
dovecot-sieve dovecot-managesieved
3030

3131
# The `dovecot-imapd`, `dovecot-pop3d`, and `dovecot-lmtpd` packages automatically
3232
# enable IMAP, POP and LMTP protocols.
@@ -112,17 +112,6 @@ tools/editconf.py /etc/dovecot/conf.d/20-imap.conf \
112112
tools/editconf.py /etc/dovecot/conf.d/20-pop3.conf \
113113
pop3_uidl_format="%08Xu%08Xv"
114114

115-
# Full Text Search - Enable full text search of mail using dovecot's lucene plugin,
116-
# which *we* package and distribute (dovecot-lucene package).
117-
tools/editconf.py /etc/dovecot/conf.d/10-mail.conf \
118-
mail_plugins="\$mail_plugins fts fts_lucene"
119-
cat > /etc/dovecot/conf.d/90-plugin-fts.conf << EOF;
120-
plugin {
121-
fts = lucene
122-
fts_lucene = whitespace_chars=@.
123-
}
124-
EOF
125-
126115
# ### LDA (LMTP)
127116

128117
# Enable Dovecot's LDA service with the LMTP protocol. It will listen

setup/mail-postfix.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ source /etc/mailinabox.conf # load global vars
4848
# > Every user with more than 100’000 queries per day on the public nameserver
4949
# > infrastructure and every commercial vendor of dnswl.org data (eg through
5050
# > anti-spam solutions) must register with dnswl.org and purchase a subscription.
51-
5251
echo "Installing Postfix (SMTP server)..."
53-
apt_install postfix postfix-pcre postgrey ca-certificates
52+
apt_install postfix postfix-sqlite postfix-pcre postgrey ca-certificates
5453

5554
# ### Basic Settings
5655

0 commit comments

Comments
 (0)