From fcff1f5d2c599b448e94a6f5ee7388829725c727 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 11 Apr 2020 19:12:40 +0100 Subject: [PATCH 001/165] Change environment to Debian 10 --- Vagrantfile | 7 ++++++- setup/preflight.sh | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 467fb95e..5f9d780f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,7 +2,12 @@ # vi: set ft=ruby : Vagrant.configure("2") do |config| - config.vm.box = "ubuntu/bionic64" + # Recreate our conditions + config.vm.box = "generic/debian10" + config.vm.provider "hyperv" do |v| + v.memory = 1024 + v.cpus = 1 + end # Network config: Since it's a mail server, the machine must be connected # to the public web. However, we currently don't want to expose SSH since diff --git a/setup/preflight.sh b/setup/preflight.sh index 2547c410..bb755f9e 100644 --- a/setup/preflight.sh +++ b/setup/preflight.sh @@ -7,9 +7,9 @@ if [[ $EUID -ne 0 ]]; then exit fi -# Check that we are running on Ubuntu 18.04 LTS (or 18.04.xx). -if [ "`lsb_release -d | sed 's/.*:\s*//' | sed 's/18\.04\.[0-9]/18.04/' `" != "Ubuntu 18.04 LTS" ]; then - echo "Mail-in-a-Box only supports being installed on Ubuntu 18.04, sorry. You are running:" +# Check that we are running on Debian GNU/Linux +if [ "`lsb_release -d | sed 's/.*:\s*//' | sed -r 's/ [[:digit:]]+ (.*)//' `" != "Debian GNU/Linux" ]; then + echo "Mail-in-a-Box only supports being installed on Debian (ideally, 10 or later), sorry. You are running:" echo lsb_release -d | sed 's/.*:\s*//' echo From 9fb02090bf6653abf9d176e4abf351883683ab13 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 11 Apr 2020 19:23:33 +0100 Subject: [PATCH 002/165] Remove operations not applicable to Debian Signed-off-by: David Duque --- setup/system.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/setup/system.sh b/setup/system.sh index 28043b16..66804919 100755 --- a/setup/system.sh +++ b/setup/system.sh @@ -86,12 +86,9 @@ if [ ! -f /usr/bin/add-apt-repository ]; then apt_install software-properties-common fi -# Ensure the universe repository is enabled since some of our packages -# come from there and minimal Ubuntu installs may have it turned off. -hide_output add-apt-repository -y universe +# N/A to Debian -# Install the certbot PPA. -hide_output add-apt-repository -y ppa:certbot/certbot +# Certbot doesn't require a PPA in Debian # ### Update Packages From 0568bcc5d392504afd31fae30452a84c126b36f6 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 12 Apr 2020 00:44:19 +0100 Subject: [PATCH 003/165] Early configuration of the nsd service --- setup/dns.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup/dns.sh b/setup/dns.sh index 5d86227a..48453d21 100755 --- a/setup/dns.sh +++ b/setup/dns.sh @@ -16,11 +16,14 @@ source /etc/mailinabox.conf # load global vars # * ldnsutils: Helper utilities for signing DNSSEC zones. # * openssh-client: Provides ssh-keyscan which we use to create SSHFP records. echo "Installing nsd (DNS server)..." -apt_install nsd ldnsutils openssh-client +apt_install ldnsutils openssh-client # Prepare nsd's configuration. mkdir -p /var/run/nsd +mkdir -p /etc/nsd +mkdir -p /etc/nsd/zones +touch /etc/nsd/nsd.conf cat > /etc/nsd/nsd.conf << EOF; # Do not edit. Overwritten by Mail-in-a-Box setup. @@ -64,6 +67,9 @@ done echo "include: /etc/nsd/zones.conf" >> /etc/nsd/nsd.conf; +# Attempting a late install of nsd (after configuration) +apt_install nsd + # Create DNSSEC signing keys. mkdir -p "$STORAGE_ROOT/dns/dnssec"; From 5c93d698b4fa727f6944f480303e828763ecc049 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 12 Apr 2020 00:50:31 +0100 Subject: [PATCH 004/165] Update PHP version (7.2 -> 7.3) --- setup/web.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/setup/web.sh b/setup/web.sh index e6aac6ef..893dd25f 100755 --- a/setup/web.sh +++ b/setup/web.sh @@ -2,6 +2,8 @@ # HTTP: Turn on a web server serving static files ################################################# +PHP_VERSION="7.3" # Expected php version + source setup/functions.sh # load our functions source /etc/mailinabox.conf # load global vars @@ -46,15 +48,15 @@ tools/editconf.py /etc/nginx/nginx.conf -s \ ssl_protocols="TLSv1.2 TLSv1.3;" # Tell PHP not to expose its version number in the X-Powered-By header. -tools/editconf.py /etc/php/7.2/fpm/php.ini -c ';' \ +tools/editconf.py /etc/php/$PHP_VERSION/fpm/php.ini -c ';' \ expose_php=Off # Set PHPs default charset to UTF-8, since we use it. See #367. -tools/editconf.py /etc/php/7.2/fpm/php.ini -c ';' \ +tools/editconf.py /etc/php/$PHP_VERSION/fpm/php.ini -c ';' \ default_charset="UTF-8" # Configure the path environment for php-fpm -tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \ +tools/editconf.py /etc/php/$PHP_VERSION/fpm/pool.d/www.conf -c ';' \ env[PATH]=/usr/local/bin:/usr/bin:/bin \ # Configure php-fpm based on the amount of memory the machine has @@ -64,7 +66,7 @@ tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \ TOTAL_PHYSICAL_MEM=$(head -n 1 /proc/meminfo | awk '{print $2}' || /bin/true) if [ $TOTAL_PHYSICAL_MEM -lt 1000000 ] then - tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \ + tools/editconf.py /etc/php/$PHP_VERSION/fpm/pool.d/www.conf -c ';' \ pm=ondemand \ pm.max_children=8 \ pm.start_servers=2 \ @@ -72,7 +74,7 @@ then pm.max_spare_servers=3 elif [ $TOTAL_PHYSICAL_MEM -lt 2000000 ] then - tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \ + tools/editconf.py /etc/php/$PHP_VERSION/fpm/pool.d/www.conf -c ';' \ pm=ondemand \ pm.max_children=16 \ pm.start_servers=4 \ @@ -80,14 +82,14 @@ then pm.max_spare_servers=6 elif [ $TOTAL_PHYSICAL_MEM -lt 3000000 ] then - tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \ + tools/editconf.py /etc/php/$PHP_VERSION/fpm/pool.d/www.conf -c ';' \ pm=dynamic \ pm.max_children=60 \ pm.start_servers=6 \ pm.min_spare_servers=3 \ pm.max_spare_servers=9 else - tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \ + tools/editconf.py /etc/php/$PHP_VERSION/fpm/pool.d/www.conf -c ';' \ pm=dynamic \ pm.max_children=120 \ pm.start_servers=12 \ @@ -132,7 +134,7 @@ chown -R $STORAGE_USER $STORAGE_ROOT/www # Start services. restart_service nginx -restart_service php7.2-fpm +restart_service php$PHP_VERSION-fpm # Open ports. ufw_allow http From 6cee029d15cc7fdbbc44a24b4099b22069514605 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 12 Apr 2020 00:56:55 +0100 Subject: [PATCH 005/165] Move php version to functions.sh --- setup/functions.sh | 2 ++ setup/web.sh | 2 -- setup/webmail.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup/functions.sh b/setup/functions.sh index b36d14bc..cdf89bed 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -214,3 +214,5 @@ function git_clone { mv $TMPPATH/$SUBDIR $TARGETPATH rm -rf $TMPPATH } + +export PHP_VERSION="7.3" # Expected php version diff --git a/setup/web.sh b/setup/web.sh index 893dd25f..55db74c2 100755 --- a/setup/web.sh +++ b/setup/web.sh @@ -2,8 +2,6 @@ # HTTP: Turn on a web server serving static files ################################################# -PHP_VERSION="7.3" # Expected php version - source setup/functions.sh # load our functions source /etc/mailinabox.conf # load global vars diff --git a/setup/webmail.sh b/setup/webmail.sh index 89ed1722..86120c25 100755 --- a/setup/webmail.sh +++ b/setup/webmail.sh @@ -198,4 +198,4 @@ chmod 664 $STORAGE_ROOT/mail/roundcube/roundcube.sqlite # Enable PHP modules. phpenmod -v php mcrypt imap -restart_service php7.2-fpm +restart_service php$PHP_VERSION-fpm From 5f1343864cd404f4691d45fbc9c681926be6e9f1 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 12 Apr 2020 01:02:14 +0100 Subject: [PATCH 006/165] Use local PHP version --- setup/nextcloud.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index 3ab21176..92a2c753 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -112,7 +112,7 @@ fi if [ ! -d /usr/local/lib/owncloud/ ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextcloud_ver ]]; then # Stop php-fpm if running. If theyre not running (which happens on a previously failed install), dont bail. - service php7.2-fpm stop &> /dev/null || /bin/true + service php$PHP_VERSION-fpm stop &> /dev/null || /bin/true # Backup the existing ownCloud/Nextcloud. # Create a backup directory to store the current installation and database to @@ -239,7 +239,7 @@ fi # * We need to set the timezone to the system timezone to allow fail2ban to ban # users within the proper timeframe # * We need to set the logdateformat to something that will work correctly with fail2ban -# * mail_domain' needs to be set every time we run the setup. Making sure we are setting +# * mail_domain' needs to be set every time we run the setup. Making sure we are setting # the correct domain name if the domain is being change from the previous setup. # Use PHP to read the settings file, modify it, and write out the new settings array. TIMEZONE=$(cat /etc/timezone) @@ -285,7 +285,7 @@ if [ \( $? -ne 0 \) -a \( $? -ne 3 \) ]; then exit 1; fi # Set PHP FPM values to support large file uploads # (semicolon is the comment character in this file, hashes produce deprecation warnings) -tools/editconf.py /etc/php/7.2/fpm/php.ini -c ';' \ +tools/editconf.py /etc/php/$PHP_VERSION/fpm/php.ini -c ';' \ upload_max_filesize=16G \ post_max_size=16G \ output_buffering=16384 \ @@ -294,7 +294,7 @@ tools/editconf.py /etc/php/7.2/fpm/php.ini -c ';' \ short_open_tag=On # Set Nextcloud recommended opcache settings -tools/editconf.py /etc/php/7.2/cli/conf.d/10-opcache.ini -c ';' \ +tools/editconf.py /etc/php/$PHP_VERSION/cli/conf.d/10-opcache.ini -c ';' \ opcache.enable=1 \ opcache.enable_cli=1 \ opcache.interned_strings_buffer=8 \ @@ -304,8 +304,8 @@ tools/editconf.py /etc/php/7.2/cli/conf.d/10-opcache.ini -c ';' \ opcache.revalidate_freq=1 # If apc is explicitly disabled we need to enable it -if grep -q apc.enabled=0 /etc/php/7.2/mods-available/apcu.ini; then - tools/editconf.py /etc/php/7.2/mods-available/apcu.ini -c ';' \ +if grep -q apc.enabled=0 /etc/php/$PHP_VERSION/mods-available/apcu.ini; then + tools/editconf.py /etc/php/$PHP_VERSION/mods-available/apcu.ini -c ';' \ apc.enabled=1 fi @@ -330,4 +330,4 @@ rm -f /etc/cron.hourly/mailinabox-owncloud # ``` # Enable PHP modules and restart PHP. -restart_service php7.2-fpm +restart_service php$PHP_VERSION-fpm From 8667a574d4d74725eb395d557b10c5a1f93482a6 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 12 Apr 2020 01:04:55 +0100 Subject: [PATCH 007/165] Use local PHP version (ZPush) --- setup/zpush.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/zpush.sh b/setup/zpush.sh index a1253d2d..136ccb1e 100755 --- a/setup/zpush.sh +++ b/setup/zpush.sh @@ -102,7 +102,7 @@ EOF # Restart service. -restart_service php7.2-fpm +restart_service php$PHP_VERSION-fpm # Fix states after upgrade From fa6e941e5670c7228f2966261a1b1f674554c93f Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 12 Apr 2020 01:41:01 +0100 Subject: [PATCH 008/165] README update --- README.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4eef7ed9..30314637 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,32 @@ -Mail-in-a-Box -============= +(Power) Mail-in-a-Box +===================== + +This is a fork of MiaB (duh), hacked and tuned to my needs: + +βœ… - **Done** + +πŸ‘¨β€πŸ’» - **Not there yet, but soon!** + +πŸ’€ - **I did not begin this part yet!** + +- βœ… Proper support for Debian (I recommend Debian Buster or later, but if it works on your machine, it works!); + +- - I changed the pre-flight checks to accept Debian and Debian only. If you think you can also make this fork Ubuntu-compatible, shoot a PR or something. + +- πŸ’€ Native support for SMTP relays (For example: SendGrid); + +- πŸ’€ Ability for "static" pages to use PHP (e.g. host a domain shortener); + +- πŸ’€ Custom pages should not have their pages defaulting to the MiaB services (`/admin`, `/mail`, etc.); + +- πŸ’€ Possibility of disabling some services (\*cough\* NextCloud \*cough\*); + +- πŸ’€ Anything else I might need to use; + +All in all, I think I should rename this to something like "Central [Clown Computing](https://www.urbandictionary.com/define.php?term=clown%20computing)", since I'm trying to cram as many services as possible into that poor machine (Spending 5$ is better than spending 10$) + +Original Documentation +====================== By [@JoshData](https://github.com/JoshData) and [contributors](https://github.com/mail-in-a-box/mailinabox/graphs/contributors). @@ -15,7 +42,7 @@ Our goals are to: * Promote [decentralization](http://redecentralize.org/), innovation, and privacy on the web. * Have automated, auditable, and [idempotent](https://web.archive.org/web/20190518072631/https://sharknet.us/2014/02/01/automated-configuration-management-challenges-with-idempotency/) configuration. * **Not** make a totally unhackable, NSA-proof server. -* **Not** make something customizable by power users. +* ~~**Not** make something customizable by power users.~~ Additionally, this project has a [Code of Conduct](CODE_OF_CONDUCT.md), which supersedes the goals above. Please review it when joining our community. @@ -84,7 +111,7 @@ Post your question on the [discussion forum](https://discourse.mailinabox.email/ Contributing and Development ---------------------------- -Mail-in-a-Box is an open source project. Your contributions and pull requests are welcome. See [CONTRIBUTING](CONTRIBUTING.md) to get started. +Mail-in-a-Box is an open source project. Your contributions and pull requests are welcome. See [CONTRIBUTING](CONTRIBUTING.md) to get started. The Acknowledgements From edb03b78628ece64343157150251e0b1185f46af Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 12 Apr 2020 23:54:35 +0100 Subject: [PATCH 009/165] Misc changes --- management/templates/system-status.html | 281 ++++++++++++------------ setup/mail-postfix.sh | 4 +- 2 files changed, 147 insertions(+), 138 deletions(-) diff --git a/management/templates/system-status.html b/management/templates/system-status.html index dc9233a5..a56d0cd5 100644 --- a/management/templates/system-status.html +++ b/management/templates/system-status.html @@ -1,160 +1,169 @@

System Status Checks

-
+
- + - + -
-
+
+
- - - - - -
+ + + + + +
-
+
diff --git a/setup/mail-postfix.sh b/setup/mail-postfix.sh index 0a66cb0f..f7641b5b 100755 --- a/setup/mail-postfix.sh +++ b/setup/mail-postfix.sh @@ -58,7 +58,7 @@ tools/editconf.py /etc/postfix/main.cf \ smtp_bind_address=$PRIVATE_IP \ smtp_bind_address6=$PRIVATE_IPV6 \ 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 # 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. 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 # removing the 127.0.0.1 reference. sed -i "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" /etc/postfix/outgoing_mail_header_filters From 8d7f6bfb19787a790bd186a15ed1a6ca72da7b24 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 00:55:48 +0100 Subject: [PATCH 010/165] Change all occurrences of PHP 7.2 to PHP 7.3 --- conf/nginx-top.conf | 2 +- management/backup.py | 4 ++-- tools/owncloud-restore.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/nginx-top.conf b/conf/nginx-top.conf index 4d888366..435b5f7b 100644 --- a/conf/nginx-top.conf +++ b/conf/nginx-top.conf @@ -7,6 +7,6 @@ ## your own --- please do not ask for help from us. upstream php-fpm { - server unix:/var/run/php/php7.2-fpm.sock; + server unix:/var/run/php/php7.3-fpm.sock; } diff --git a/management/backup.py b/management/backup.py index e1651552..1bec8638 100755 --- a/management/backup.py +++ b/management/backup.py @@ -247,7 +247,7 @@ def perform_backup(full_backup): if quit: sys.exit(code) - service_command("php7.2-fpm", "stop", quit=True) + service_command("php7.3-fpm", "stop", quit=True) service_command("postfix", "stop", quit=True) service_command("dovecot", "stop", quit=True) @@ -281,7 +281,7 @@ def perform_backup(full_backup): # Start services again. service_command("dovecot", "start", quit=False) service_command("postfix", "start", quit=False) - service_command("php7.2-fpm", "start", quit=False) + service_command("php7.3-fpm", "start", quit=False) # Remove old backups. This deletes all backup data no longer needed # from more than 3 days ago. diff --git a/tools/owncloud-restore.sh b/tools/owncloud-restore.sh index 4b0ba4de..27fe1f38 100755 --- a/tools/owncloud-restore.sh +++ b/tools/owncloud-restore.sh @@ -26,7 +26,7 @@ if [ ! -f $1/config.php ]; then fi echo "Restoring backup from $1" -service php7.2-fpm stop +service php7.3-fpm stop # remove the current ownCloud/Nextcloud installation rm -rf /usr/local/lib/owncloud/ @@ -45,5 +45,5 @@ chown www-data.www-data $STORAGE_ROOT/owncloud/config.php sudo -u www-data php /usr/local/lib/owncloud/occ maintenance:mode --off -service php7.2-fpm start +service php7.3-fpm start echo "Done" From 0d17caccfea124e109e49d3c0e29e77429b8b298 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 01:07:16 +0100 Subject: [PATCH 011/165] Downgrade port 25 blockage error to warn; mention SMTP relays --- management/status_checks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/management/status_checks.py b/management/status_checks.py index a9d0595c..4e599887 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -278,9 +278,9 @@ def run_network_checks(env, output): if ret == 0: output.print_ok("Outbound mail (SMTP port 25) is not blocked.") else: - output.print_error("""Outbound mail (SMTP port 25) seems to be blocked by your network. You - will not be able to send any mail. Many residential networks block port 25 to prevent hijacked - machines from being able to send spam. A quick connection test to Google's mail server on port 25 + output.print_warning("""Outbound mail (SMTP port 25) seems to be blocked by your network. You + will not be able to send any mail without a SMTP relay. Many residential networks block port 25 to prevent + hijacked machines from being able to send spam. A quick connection test to Google's mail server on port 25 failed.""") # Stop if the IPv4 address is listed in the ZEN Spamhaus Block List. From 974c9bba61e24749869160fead2e9e5b7cf7d0a7 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 01:16:23 +0100 Subject: [PATCH 012/165] Fix status check colors, add SMTP relay stub --- .editorconfig | 3 + management/templates/index.html | 705 ++++++++++++------------ management/templates/smtp-relays.html | 6 + management/templates/system-status.html | 276 +++++----- 4 files changed, 506 insertions(+), 484 deletions(-) create mode 100644 management/templates/smtp-relays.html diff --git a/.editorconfig b/.editorconfig index fbe828c3..85e5fd9c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,9 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +[*.html] +indent_style = tab + [Makefile] indent_style = tab indent_size = 4 diff --git a/management/templates/index.html b/management/templates/index.html index 2c0d5a9a..5649ccfc 100644 --- a/management/templates/index.html +++ b/management/templates/index.html @@ -1,396 +1,409 @@ - - - - - {{hostname}} - Mail-in-a-Box Control Panel + + + + - + {{hostname}} - Mail-in-a-Box Control Panel - - - - - + h4:first-child { + margin-top: 6px; + } - - + .admin_panel { + display: none; + } - + table.table { + margin: 1.5em 0; + } -
-
- {% include "system-status.html" %} -
+ ol li { + margin-bottom: 1em; + } + + + -
- {% include "system-backup.html" %} -
+ -
- {% include "external-dns.html" %} -
+ + -
- {% include "custom-dns.html" %} -
+ -
- {% include "login.html" %} -
+
+
+ {% include "system-status.html" %} +
-
- {% include "mail-guide.html" %} -
+
+ {% include "system-backup.html" %} +
-
- {% include "users.html" %} -
+
+ {% include "external-dns.html" %} +
-
- {% include "aliases.html" %} -
+
+ {% include "custom-dns.html" %} +
-
- {% include "sync-guide.html" %} -
+
+ {% include "login.html" %} +
-
- {% include "web.html" %} -
+
+ {% include "mail-guide.html" %} +
-
- {% include "ssl.html" %} -
+
+ {% include "users.html" %} +
-
+
+ {% include "aliases.html" %} +
- -
+
+ {% include "sync-guide.html" %} +
- +
+ {% include "web.html" %} +
- +
+ {% include "ssl.html" %} +
- - +
- + -var ajax_num_executing_requests = 0; -function ajax_with_indicator(options) { - setTimeout("if (ajax_num_executing_requests > 0) $('#ajax_loading_indicator').fadeIn()", 100); - function hide_loading_indicator() { - ajax_num_executing_requests--; - if (ajax_num_executing_requests == 0) - $('#ajax_loading_indicator').stop(true).hide(); // stop() prevents an ongoing fade from causing the thing to be shown again after this call - } - var old_success = options.success; - var old_error = options.error; - options.success = function(data) { - hide_loading_indicator(); - if (data.status == "error") - show_modal_error("Error", data.message); - else if (old_success) - old_success(data); - }; - options.error = function(jqxhr) { - hide_loading_indicator(); - if (!old_error) - show_modal_error("Error", "Something went wrong, sorry.") - else - old_error(jqxhr.responseText, jqxhr); - }; - ajax_num_executing_requests++; - $.ajax(options); - return false; // handy when called from onclick -} + + - - diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html new file mode 100644 index 00000000..b578b7cf --- /dev/null +++ b/management/templates/smtp-relays.html @@ -0,0 +1,6 @@ + + +

SMTP Relays

+ +

Coming Soonβ„’

diff --git a/management/templates/system-status.html b/management/templates/system-status.html index a56d0cd5..09e94b7e 100644 --- a/management/templates/system-status.html +++ b/management/templates/system-status.html @@ -1,169 +1,169 @@

System Status Checks

-
+
- + - + -
-
+
+
- - - - - -
+ + + + + +
-
+
From 4aa671c20b6f57f2468c7ca761bf4c29cd6d9d2e Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 01:18:19 +0100 Subject: [PATCH 013/165] Working on SMTP relays! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30314637..219a909c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This is a fork of MiaB (duh), hacked and tuned to my needs: - - I changed the pre-flight checks to accept Debian and Debian only. If you think you can also make this fork Ubuntu-compatible, shoot a PR or something. -- πŸ’€ Native support for SMTP relays (For example: SendGrid); +- πŸ‘¨β€πŸ’» Native support for SMTP relays (For example: SendGrid); - πŸ’€ Ability for "static" pages to use PHP (e.g. host a domain shortener); From cd4c478986ca9faebd5d8906c66c5eb36780761d Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 01:24:36 +0100 Subject: [PATCH 014/165] Add smtp relay html page --- management/templates/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/management/templates/index.html b/management/templates/index.html index 5649ccfc..68efdfb0 100644 --- a/management/templates/index.html +++ b/management/templates/index.html @@ -125,6 +125,10 @@
+
+ {% include "smtp-relays.html" %} +
+
{% include "system-status.html" %}
From 4a20d50eea13a5c6b22036acd0f60fa087782b54 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 15:34:14 +0100 Subject: [PATCH 015/165] SMTP Relay Host stub --- management/templates/smtp-relays.html | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index b578b7cf..82f9092f 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -3,4 +3,22 @@

SMTP Relays

-

Coming Soonβ„’

+

SMTP Relays are third-party services you can hand off the responsability of getting the mail delivered. They + can be useful when, for example, port 25 is blocked.

+ +

Here, you can configure an authenticated SMTP relay (for example, SendGrid) over port 587.

+ +
+ SMTP Relay Configuration +
+
+ + +
+ +
+ +
+
+
From 664267357af36b15555ceed239c91f834e9a9993 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 15:53:47 +0100 Subject: [PATCH 016/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 82f9092f..5b7d62f1 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -10,11 +10,23 @@ target="_blank">SendGrid) over port 587.

- SMTP Relay Configuration +

SMTP Relay Configuration

- +
+ +
+ + +
+ +
+ + +
+ +
From 30221bdb11d1a57f8d7674a624b8d1ee6703f4a7 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 15:57:56 +0100 Subject: [PATCH 017/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 32 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 5b7d62f1..7fdb7e66 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -13,20 +13,28 @@

SMTP Relay Configuration

- -
- -
+ + + +
+ +
+ - -
- -
+ + +
+ +
+ - -
- -
+ + +
+ +
+ +
From aa62c6349e93a6203e8bc18240af46550202b1ef Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 16:13:26 +0100 Subject: [PATCH 018/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 38 ++++++++++++++++++--------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 7fdb7e66..fe8052cc 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -13,26 +13,38 @@

SMTP Relay Configuration

- +
- -
- -
+ + - -
- -
+ + - -
- -
+ +
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
From 3278c8cf94c9e4536dd6d3c9292db20131546fc6 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 16:18:26 +0100 Subject: [PATCH 019/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index fe8052cc..b3f9a305 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -13,7 +13,7 @@

SMTP Relay Configuration

- +
+ + + + + + From 9d23f67e8a665412a294b9910393cd282482845f Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 18:05:49 +0100 Subject: [PATCH 021/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index d28fe42d..6cb883d8 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -35,9 +35,13 @@ - - + + From 6393075f1144e38e75c58d6c4d40dcefd809211a Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 18:09:04 +0100 Subject: [PATCH 022/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 6cb883d8..19e47a30 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -36,11 +36,13 @@ From 51c288dcd5f5a7363b1b99284f55fb4eb1e2fad1 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 18:14:39 +0100 Subject: [PATCH 023/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 19e47a30..22ddc410 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -21,22 +21,22 @@

SMTP Relay Configuration

-
@@ -27,7 +27,7 @@
- +
@@ -38,7 +38,7 @@
- +
From 10993b915464e71afb18b4edd68b67e526b5f452 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 17:55:00 +0100 Subject: [PATCH 020/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index b3f9a305..d28fe42d 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -1,6 +1,14 @@ + +

SMTP Relays

SMTP Relays are third-party services you can hand off the responsability of getting the mail delivered. They @@ -23,6 +31,13 @@

:587
+ + + +
- + - +
+ +
+
- +
- +
:587:587
- +
From 6e462f6523225b6308801930119573be460b2711 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 18:21:33 +0100 Subject: [PATCH 024/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 22ddc410..9a18deb5 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -14,7 +14,7 @@

SMTP Relays are third-party services you can hand off the responsability of getting the mail delivered. They can be useful when, for example, port 25 is blocked.

-

Here, you can configure an authenticated SMTP relay (for example, Here, you can configure an authenticated SMTP relay (for example, SendGrid) over port 587.

@@ -70,7 +70,7 @@
-
+
From c004e55c76fe350248b3e79f81bea6ab1e3d3690 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 18:29:14 +0100 Subject: [PATCH 025/165] SMTP Relay Host stub progress --- management/daemon.py | 12 +++++++++++- management/templates/smtp-relays.html | 24 ++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/management/daemon.py b/management/daemon.py index 572b6b4a..481873b7 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -334,7 +334,7 @@ def ssl_get_status(): # What domains can we provision certificates for? What unexpected problems do we have? provision, cant_provision = get_certificates_to_provision(env, show_valid_certs=False) - + # What's the current status of TLS certificates on all of the domain? domains_status = get_web_domains_info(env) domains_status = [ @@ -520,6 +520,16 @@ def privacy_status_set(): utils.write_settings(config, env) return "OK" +@app.route('/system/smtp/relay', methods=["GET"]) +@authorized_personnel_only +def smtp_relay_get(): + pass + +@app.route('/system/smtp/relay', methods=["POST"]) +@authorized_personnel_only +def smtp_relay_set(): + pass + # MUNIN @app.route('/munin/') diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 9a18deb5..5942ecae 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -2,10 +2,14 @@ @@ -22,6 +26,18 @@
+ + + + + From ee688eb184ca8cf96757676e64c36c764d471420 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 18:36:56 +0100 Subject: [PATCH 026/165] SMTP Relay Host stub progress --- management/templates/smtp-relays.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 5942ecae..c2148754 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -8,8 +8,8 @@ document.getElementById("relay_host").disabled = !use_relay document.getElementById("relay_use_auth").disabled = !use_relay - document.getElementById("relay_auth_user").disabled = !use_relay && !use_auth - document.getElementById("relay_auth_pass").disabled = !use_relay && !use_auth + document.getElementById("relay_auth_user").disabled = !(use_relay && use_auth) + document.getElementById("relay_auth_pass").disabled = !(use_relay && use_auth) } From 109d8735c73bc36bbb2cff01073a743b5683b858 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 13 Apr 2020 19:32:38 +0100 Subject: [PATCH 027/165] Change admin panel footer --- management/templates/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/management/templates/index.html b/management/templates/index.html index 68efdfb0..35f27479 100644 --- a/management/templates/index.html +++ b/management/templates/index.html @@ -176,7 +176,8 @@
From 14ee44e8e2ad6a40a6c08354aaf4f807e54a6fcc Mon Sep 17 00:00:00 2001 From: David Duque Date: Tue, 14 Apr 2020 09:52:01 +0100 Subject: [PATCH 028/165] HTML JS Cleanup --- management/templates/index.html | 3 ++- management/templates/smtp-relays.html | 33 +++++++++++++++++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/management/templates/index.html b/management/templates/index.html index 35f27479..780e8cb2 100644 --- a/management/templates/index.html +++ b/management/templates/index.html @@ -376,9 +376,10 @@ var current_panel = null; var switch_back_to_panel = null; function show_panel(panelid) { - if (panelid.getAttribute) + if (panelid.getAttribute) { // we might be passed an HTMLElement . panelid = panelid.getAttribute('href').substring(1); + } $('.admin_panel').hide(); $('#panel_' + panelid).show(); diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index c2148754..74b3e86d 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -2,15 +2,34 @@

SMTP Relays

From 687721caf83f3d4f2bc4e313ff2db613dd895a96 Mon Sep 17 00:00:00 2001 From: David Duque Date: Tue, 14 Apr 2020 10:03:44 +0100 Subject: [PATCH 029/165] Load SMTP settings when entering the page --- management/templates/smtp-relays.html | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 74b3e86d..846ee649 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -8,15 +8,6 @@ const relay_auth_user = document.getElementById("relay_auth_user") const relay_auth_pass = document.getElementById("relay_auth_pass") - api( - "/system/smtp/relay", - "GET", - {}, - data => { - - } - ) - function checkfields() { let relay_enabled = use_relay.checked let auth_enabled = relay_use_auth.checked @@ -27,8 +18,20 @@ relay_auth_pass.disabled = !(relay_enabled && auth_enabled) } - checkfields() + api( + "/system/smtp/relay", + "GET", + {}, + data => { + use_relay.checked = data.enabled + relay_host.value = data.host + relay_use_auth.checked = data.auth_enabled + relay_auth_user.value = data.user + relay_auth_pass.value = "" + checkfields() + } + ) From bb26a2d12cae45c7c47ecd51adc164da0f646649 Mon Sep 17 00:00:00 2001 From: David Duque Date: Tue, 14 Apr 2020 10:08:11 +0100 Subject: [PATCH 030/165] Push script zone to the end of the document --- management/templates/smtp-relays.html | 67 +++++++++++++-------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 846ee649..97b31373 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -1,40 +1,6 @@ - -

SMTP Relays

SMTP Relays are third-party services you can hand off the responsability of getting the mail delivered. They @@ -113,3 +79,36 @@ + + From 21196620b636a3e13ac3d69005adde5624ed9d07 Mon Sep 17 00:00:00 2001 From: David Duque Date: Wed, 15 Apr 2020 15:02:20 +0100 Subject: [PATCH 031/165] Code debug --- management/templates/smtp-relays.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 97b31373..b50d336c 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -93,7 +93,7 @@ relay_host.disabled = !relay_enabled relay_use_auth.disabled = !relay_enabled - relay_auth_auth.disabled = !(relay_enabled && auth_enabled) + relay_auth_user.disabled = !(relay_enabled && auth_enabled) relay_auth_pass.disabled = !(relay_enabled && auth_enabled) } @@ -102,6 +102,7 @@ "GET", {}, data => { + console.log("Hi!") use_relay.checked = data.enabled relay_host.value = data.host relay_use_auth.checked = data.auth_enabled From 68768ed1126df701c1074cd1cfaa7c5c69a74fbb Mon Sep 17 00:00:00 2001 From: David Duque Date: Wed, 15 Apr 2020 18:01:33 +0100 Subject: [PATCH 032/165] Fix attempt --- management/templates/smtp-relays.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index b50d336c..85ec1603 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -97,7 +97,7 @@ relay_auth_pass.disabled = !(relay_enabled && auth_enabled) } - api( + $(api( "/system/smtp/relay", "GET", {}, @@ -111,5 +111,5 @@ checkfields() } - ) + )) From 03472788fd1405832190373fdcff8f82ac187314 Mon Sep 17 00:00:00 2001 From: David Duque Date: Thu, 16 Apr 2020 12:45:55 +0100 Subject: [PATCH 033/165] WIP --- management/templates/smtp-relays.html | 33 +++++++++++++++------------ 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 85ec1603..118e6b30 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -13,7 +13,7 @@

SMTP Relay Configuration

-
+ + +
+ +
+
@@ -41,7 +57,7 @@
+ onclick="checkfields();">
+
") + api( + "/system/smtp/relay", + "GET", + {}, + data => { + console.log("Hi!") + use_relay.checked = data.enabled + relay_host.value = data.host + relay_use_auth.checked = data.auth_enabled + relay_auth_user.value = data.user + relay_auth_pass.value = "" - checkfields() - } - )) + checkfields() + } + ) + } From bf83bd6ff77e569bd48a5f4501572d615af52320 Mon Sep 17 00:00:00 2001 From: David Duque Date: Thu, 16 Apr 2020 12:56:27 +0100 Subject: [PATCH 034/165] MiaB SMTP Daemon: Just return something for now --- management/daemon.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/management/daemon.py b/management/daemon.py index 481873b7..e4aa5456 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -7,7 +7,7 @@ from flask import Flask, request, render_template, abort, Response, send_from_di import auth, utils, multiprocessing.pool from mailconfig import get_mail_users, get_mail_users_ex, get_admins, add_mail_user, set_mail_password, remove_mail_user -from mailconfig import get_mail_user_privileges, add_remove_mail_user_privilege +from mailconfig import get_mail_user_privileges, add_remove_mail_user_privilege, open_database from mailconfig import get_mail_aliases, get_mail_aliases_ex, get_mail_domains, add_mail_alias, remove_mail_alias env = utils.load_environment() @@ -523,7 +523,13 @@ def privacy_status_set(): @app.route('/system/smtp/relay', methods=["GET"]) @authorized_personnel_only def smtp_relay_get(): - pass + # Just return something for now. + return { + enabled = False, + host = "", + auth_enabled = True, + user = "" + } @app.route('/system/smtp/relay', methods=["POST"]) @authorized_personnel_only From 09b3c378856ba19e7592f3cd85233e4ba9a44495 Mon Sep 17 00:00:00 2001 From: David Duque Date: Thu, 16 Apr 2020 14:04:45 +0100 Subject: [PATCH 035/165] Oops --- management/daemon.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/management/daemon.py b/management/daemon.py index e4aa5456..b267dbdb 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -525,10 +525,10 @@ def privacy_status_set(): def smtp_relay_get(): # Just return something for now. return { - enabled = False, - host = "", - auth_enabled = True, - user = "" + "enabled": False, + "host": "", + "auth_enabled": True, + "user": "" } @app.route('/system/smtp/relay', methods=["POST"]) From fcf5544fc8c381bcd01e7e0c6b47c4455fb75324 Mon Sep 17 00:00:00 2001 From: David Duque Date: Thu, 16 Apr 2020 14:09:24 +0100 Subject: [PATCH 036/165] WIP --- management/templates/smtp-relays.html | 1 - 1 file changed, 1 deletion(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 118e6b30..2bc4524e 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -98,7 +98,6 @@ } function show_smtp_relays() { - $('#smtp-relays tbody').html("") api( "/system/smtp/relay", "GET", From 785280c86be85c4a2fece5c330be58d44f8cce71 Mon Sep 17 00:00:00 2001 From: David Duque Date: Thu, 16 Apr 2020 17:01:49 +0100 Subject: [PATCH 037/165] Submission --- management/templates/smtp-relays.html | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/management/templates/smtp-relays.html b/management/templates/smtp-relays.html index 2bc4524e..d87ea363 100644 --- a/management/templates/smtp-relays.html +++ b/management/templates/smtp-relays.html @@ -11,7 +11,7 @@

SMTP Relay Configuration

- +
@@ -97,19 +97,22 @@ relay_auth_pass.disabled = !(relay_enabled && auth_enabled) } - $(api( - "/system/smtp/relay", - "GET", - {}, - data => { - console.log("Hi!") - use_relay.checked = data.enabled - relay_host.value = data.host - relay_use_auth.checked = data.auth_enabled - relay_auth_user.value = data.user - relay_auth_pass.value = "" + function show_smtp_relays() { + $('#smtp-relays tbody').html("
Loading...
Loading...
@@ -103,7 +103,6 @@ "GET", {}, data => { - console.log("Hi!") use_relay.checked = data.enabled relay_host.value = data.host relay_use_auth.checked = data.auth_enabled @@ -114,4 +113,23 @@ } ) } + + function set_smtp_relay_config() { + api( + "/system/smtp/relay", + "POST", + { + enabled: use_relay.checked, + host: relay_host.value, + auth_enabled: relay_use_auth.checked, + user: relay_auth_user.value, + key: relay_auth_pass.value + }, + () => { + show_modal_error("Done!", "The configuration has been updated and Postfix was restarted successfully. Please make sure everything is functioning as intended.", () => { + return false + }) + } + ) + } From 7ffc889c080e378e6bc3eb54d384edf7a69c24fa Mon Sep 17 00:00:00 2001 From: David Duque Date: Thu, 16 Apr 2020 19:52:01 +0100 Subject: [PATCH 038/165] Bump web dependencies (#1) - Bootstrap: 3.3.7 -> 4.4.1 - - New admin panel style and respective corrections applied. - JQuery: 2.1.4 -> 3.5.0 --- README.md | 2 + management/templates/index.html | 64 ++++----- management/templates/login.html | 226 ++++++++++++++++---------------- setup/management.sh | 8 +- 4 files changed, 153 insertions(+), 147 deletions(-) diff --git a/README.md b/README.md index 219a909c..dd3fba23 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ This is a fork of MiaB (duh), hacked and tuned to my needs: - πŸ’€ Possibility of disabling some services (\*cough\* NextCloud \*cough\*); +- βœ… Bumped the bootstrap and jQuery dependencies' versions - and we've got a brand new admin panel now! + - πŸ’€ Anything else I might need to use; All in all, I think I should rename this to something like "Central [Clown Computing](https://www.urbandictionary.com/define.php?term=clown%20computing)", since I'm trying to cram as many services as possible into that poor machine (Spending 5$ is better than spending 10$) diff --git a/management/templates/index.html b/management/templates/index.html index 780e8cb2..5aa8442a 100644 --- a/management/templates/index.html +++ b/management/templates/index.html @@ -69,7 +69,6 @@ margin-bottom: 1em; } - @@ -78,46 +77,51 @@ "); + var n = $(""); if (i == 0) n.addClass('first') if (r[i].type == "heading") n.addClass(r[i].type) From 7984d103a420fdb11cb425708d00d72148052098 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 25 Apr 2020 04:13:46 +0100 Subject: [PATCH 095/165] Test --- management/templates/system-status.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/templates/system-status.html b/management/templates/system-status.html index 82f0dada..4c0df601 100644 --- a/management/templates/system-status.html +++ b/management/templates/system-status.html @@ -103,7 +103,7 @@ function (r) { $('#system-checks tbody').html(""); for (var i = 0; i < r.length; i++) { - var n = $(""); + var n = $(""); if (i == 0) n.addClass('first') if (r[i].type == "heading") n.addClass(r[i].type) From e75d89113ac3e716d8fecdcca36f98f2777313f0 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 25 Apr 2020 04:17:55 +0100 Subject: [PATCH 096/165] Test --- management/templates/system-status.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/management/templates/system-status.html b/management/templates/system-status.html index 4c0df601..abb13fdd 100644 --- a/management/templates/system-status.html +++ b/management/templates/system-status.html @@ -31,7 +31,7 @@ word-wrap: break-word; } - #system-checks a.showhide { + #system-checks .showhide { display: none; font-size: 85%; } @@ -103,7 +103,7 @@ function (r) { $('#system-checks tbody').html(""); for (var i = 0; i < r.length; i++) { - var n = $(""); + var n = $(""); if (i == 0) n.addClass('first') if (r[i].type == "heading") n.addClass(r[i].type) @@ -116,7 +116,7 @@ $('#system-checks tbody').append(n); if (r[i].extra.length > 0) { - n.find('a.showhide').show().text("show more").click(function () { + n.find('.showhide').show().text("show more").click(function () { $(this).hide(); $(this).parent().find('.extra').fadeIn(); return false; From ad9979f9c6cfbca7b14ece1c9d80a63923db09e4 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 25 Apr 2020 04:26:24 +0100 Subject: [PATCH 097/165] Make the Show More link an actual button --- management/templates/system-status.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/management/templates/system-status.html b/management/templates/system-status.html index abb13fdd..c83b649f 100644 --- a/management/templates/system-status.html +++ b/management/templates/system-status.html @@ -103,7 +103,7 @@ function (r) { $('#system-checks tbody').html(""); for (var i = 0; i < r.length; i++) { - var n = $(""); + var n = $(""); if (i == 0) n.addClass('first') if (r[i].type == "heading") n.addClass(r[i].type) @@ -116,7 +116,7 @@ $('#system-checks tbody').append(n); if (r[i].extra.length > 0) { - n.find('.showhide').show().text("show more").click(function () { + n.find('.showhide').show().text("Show More").click(function () { $(this).hide(); $(this).parent().find('.extra').fadeIn(); return false; From b66ade73c8624c2e82c988e1a7dcffc04714b468 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 17 May 2020 02:33:26 +0100 Subject: [PATCH 098/165] Begin support for Ubuntu LTS --- setup/bootstrap.sh | 18 ++++-------------- setup/functions.sh | 9 ++++++++- setup/preflight.sh | 5 +++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 499722d0..c3729112 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -7,23 +7,13 @@ ######################################################### if [ -z "$TAG" ]; then - # If a version to install isn't explicitly given as an environment - # variable, then install the latest version. But the latest version - # depends on the operating system. Existing Ubuntu 14.04 users need - # to be able to upgrade to the latest version supporting Ubuntu 14.04, - # in part because an upgrade is required before jumping to Ubuntu 18.04. - # New users on Ubuntu 18.04 need to get the latest version number too. - # - # Also, the system status checks read this script for TAG = (without the - # space, but if we put it in a comment it would confuse the status checks!) - # to get the latest version, so the first such line must be the one that we - # want to display in status checks. - if [ "`lsb_release -d | sed 's/.*:\s*//' `" == "Debian GNU/Linux 10 (buster)" ]; then + # Make s + OS=`lsb_release -d | sed 's/.*:\s*//'` + if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS"]; then # This machine is running Ubuntu 18.04. TAG=v0.44.POWER.5 - else - echo "This script must be run on a system running Debian 10." + echo "This script must be run on a system running Debian 10 OR Ubuntu 20.04 LTS." exit 1 fi fi diff --git a/setup/functions.sh b/setup/functions.sh index cdf89bed..509d3dc0 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -215,4 +215,11 @@ function git_clone { rm -rf $TMPPATH } -export PHP_VERSION="7.3" # Expected php version +OS=`lsb_release -d | sed 's/.*:\s*//' ` + +# Expected php version +if [ "$OS" == "Debian GNU/Linux 10 (buster)" ]; then + export PHP_VERSION="7.3" +elif [ "$OS" == "Ubuntu 20.04 LTS" ]; then + export PHP_VERSION="7.4" +fi diff --git a/setup/preflight.sh b/setup/preflight.sh index 8e3fbdd7..51952693 100644 --- a/setup/preflight.sh +++ b/setup/preflight.sh @@ -8,8 +8,9 @@ if [[ $EUID -ne 0 ]]; then fi # Check that we are running on Debian GNU/Linux -if [ "`lsb_release -d | sed 's/.*:\s*//' `" != "Debian GNU/Linux 10 (buster)" ]; then - echo "Mail-in-a-Box only supports being installed on Debian 10, sorry. You are running:" +OS=`lsb_release -d | sed 's/.*:\s*//' ` +if [ "$OS" != "Debian GNU/Linux 10 (buster)" -a "$OS" != "Ubuntu 20.04 LTS" ]; then + echo "Mail-in-a-Box only supports being installed on Debian 10 or Ubuntu 20.04 LTS, sorry. You are running:" echo lsb_release -d | sed 's/.*:\s*//' echo From 98b50ce333eb15342ac771e128b5c2f4ff256500 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 17 May 2020 02:38:00 +0100 Subject: [PATCH 099/165] Syntax function fix --- setup/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index c3729112..028398ac 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -9,7 +9,7 @@ if [ -z "$TAG" ]; then # Make s OS=`lsb_release -d | sed 's/.*:\s*//'` - if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS"]; then + if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS" ]; then # This machine is running Ubuntu 18.04. TAG=v0.44.POWER.5 else From 959281c635e71f3432d3f4373e5bb3c073eeb164 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 17 May 2020 02:38:18 +0100 Subject: [PATCH 100/165] Version bump --- setup/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 028398ac..d974413d 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -11,7 +11,7 @@ if [ -z "$TAG" ]; then OS=`lsb_release -d | sed 's/.*:\s*//'` if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS" ]; then # This machine is running Ubuntu 18.04. - TAG=v0.44.POWER.5 + TAG=v0.44.POWER.6 else echo "This script must be run on a system running Debian 10 OR Ubuntu 20.04 LTS." exit 1 From 1513655bc47dcd5cb5bb6a5e83b9d72454e6209a Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 17 May 2020 02:45:35 +0100 Subject: [PATCH 101/165] Make sure that the OS in the admin panel matches the actual system OS --- management/templates/index.html | 4 ++-- setup/preflight.sh | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/management/templates/index.html b/management/templates/index.html index 1bbd0378..d88eb569 100644 --- a/management/templates/index.html +++ b/management/templates/index.html @@ -180,8 +180,8 @@
diff --git a/setup/preflight.sh b/setup/preflight.sh index 51952693..6a3101d1 100644 --- a/setup/preflight.sh +++ b/setup/preflight.sh @@ -18,6 +18,8 @@ if [ "$OS" != "Debian GNU/Linux 10 (buster)" -a "$OS" != "Ubuntu 20.04 LTS" ]; t exit 1 fi +sed -i "s/__OSTAG__/$OS/g" management/templates/index.html + # Check that we have enough memory. # # /proc/meminfo reports free memory in kibibytes. Our baseline will be 512 MB, From baa5d32dea6cc08964c40d7ef490b1f634a0eace Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 17 May 2020 02:58:19 +0100 Subject: [PATCH 102/165] Make sure /etc/default/bind9 exists --- setup/system.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/system.sh b/setup/system.sh index 4d1dd08e..cc8706b3 100755 --- a/setup/system.sh +++ b/setup/system.sh @@ -302,6 +302,7 @@ fi #NODOC # * The listen-on directive in named.conf.options restricts `bind9` to # binding to the loopback interface instead of all interfaces. apt_install bind9 +touch /etc/default/bind9 management/editconf.py /etc/default/bind9 \ "OPTIONS=\"-u bind -4\"" if ! grep -q "listen-on " /etc/bind/named.conf.options; then From 117bdb746441b5a0e45d67fc52b832572c743806 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 17 May 2020 15:04:17 +0100 Subject: [PATCH 103/165] Update Nextcloud to the latest version Nextcloud 17 doesn't support PHP 7.4 (and therefore Ubuntu 20.04 LTS) --- setup/nextcloud.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index 938cc70c..e7d02cfc 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -91,8 +91,8 @@ InstallNextcloud() { } # Nextcloud Version to install. Checks are done down below to step through intermediate versions. -nextcloud_ver=17.0.6 -nextcloud_hash=50b98d2c2f18510b9530e558ced9ab51eb4f11b0 +nextcloud_ver=18.0.4 +nextcloud_hash=6a1c671600d6a839d53cbcfac64eb3858936bbad # Current Nextcloud Version, #1623 # Checking /usr/local/lib/owncloud/version.php shows version of the Nextcloud application, not the DB From c95b91af5a0b50a2a2ede98abe72b9219e62b780 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 17 May 2020 15:14:43 +0100 Subject: [PATCH 104/165] Force python3-pip --- setup/management.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/management.sh b/setup/management.sh index c16e43d3..ac8e908c 100755 --- a/setup/management.sh +++ b/setup/management.sh @@ -29,7 +29,7 @@ done # # certbot installs EFF's certbot which we use to # provision free TLS certificates. -apt_install duplicity python-pip virtualenv certbot +apt_install duplicity python3-pip virtualenv certbot hide_output pip2 install --upgrade boto # Create a virtualenv for the installation of Python 3 packages From a51e968d31231f7206691ac5c3381f7cd9e1ade1 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 17 May 2020 15:20:14 +0100 Subject: [PATCH 105/165] Use pip3 --- setup/management.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/management.sh b/setup/management.sh index ac8e908c..1f8b1db2 100755 --- a/setup/management.sh +++ b/setup/management.sh @@ -30,7 +30,7 @@ done # certbot installs EFF's certbot which we use to # provision free TLS certificates. apt_install duplicity python3-pip virtualenv certbot -hide_output pip2 install --upgrade boto +hide_output pip3 install --upgrade boto # Create a virtualenv for the installation of Python 3 packages # used by the management daemon. From 211d3ff8a8e7448040565db7752365f1d40a966c Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 24 May 2020 23:22:30 +0100 Subject: [PATCH 106/165] Fix os tag issues --- setup/preflight.sh | 2 +- setup/questions.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/preflight.sh b/setup/preflight.sh index 6a3101d1..013eb038 100644 --- a/setup/preflight.sh +++ b/setup/preflight.sh @@ -18,7 +18,7 @@ if [ "$OS" != "Debian GNU/Linux 10 (buster)" -a "$OS" != "Ubuntu 20.04 LTS" ]; t exit 1 fi -sed -i "s/__OSTAG__/$OS/g" management/templates/index.html +sed -i "s|__OSTAG__|${OS}|g" management/templates/index.html # Check that we have enough memory. # diff --git a/setup/questions.sh b/setup/questions.sh index bd315fb5..0ed55154 100644 --- a/setup/questions.sh +++ b/setup/questions.sh @@ -21,7 +21,7 @@ if [ -z "${NONINTERACTIVE:-}" ]; then "Hello and thanks for deploying a (Power) Mail-in-a-Box! \n\nI'm going to ask you a few questions. \n\nTo change your answers later, just run 'sudo mailinabox' from the command line. - \n\nNOTE: You should only install this on a brand new Debian installation 100% dedicated to Mail-in-a-Box. Mail-in-a-Box will, for example, remove apache2." + \n\nNOTE: You should only install this on a brand new Debian/Ubuntu installation 100% dedicated to Mail-in-a-Box. Mail-in-a-Box will, for example, remove apache2." fi # The box needs a name. From 235ebe9a4abe79ea659b28841e3bc1f4d35b212e Mon Sep 17 00:00:00 2001 From: David Duque Date: Thu, 28 May 2020 15:47:02 +0100 Subject: [PATCH 107/165] Secondary nameservers: Allow IPv6 --- management/dns_update.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/management/dns_update.py b/management/dns_update.py index 7d053d5e..9f664172 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -905,6 +905,8 @@ def set_secondary_dns(hostnames, env): # Resolve hostname. try: response = resolver.query(item, "A") + except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): + response = resolver.query(item, "AAAA") except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): raise ValueError("Could not resolve the IP address of %s." % item) else: @@ -912,12 +914,14 @@ def set_secondary_dns(hostnames, env): try: if "/" in item[4:]: v = ipaddress.ip_network(item[4:]) # raises a ValueError if there's a problem - if not isinstance(v, ipaddress.IPv4Network): raise ValueError("That's an IPv6 subnet.") + if not isinstance(v, ipaddress.IPv4Network) and not isinstance(v, ipaddress.IPv6Network): + raise ValueError("That's neither an IPv4 or IPv6 subnet.") else: v = ipaddress.ip_address(item[4:]) # raises a ValueError if there's a problem - if not isinstance(v, ipaddress.IPv4Address): raise ValueError("That's an IPv6 address.") + if not isinstance(v, ipaddress.IPv4Network) and not isinstance(v, ipaddress.IPv6Network): + raise ValueError("That's neither an IPv4 or IPv6 address.") except ValueError: - raise ValueError("'%s' is not an IPv4 address or subnet." % item[4:]) + raise ValueError("'%s' is not an IPv4 or IPv6 address or subnet." % item[4:]) # Set. set_custom_dns_record("_secondary_nameserver", "A", " ".join(hostnames), "set", env) From 8ca58798e46b84b9f80ff3641ddf12c52d7d3145 Mon Sep 17 00:00:00 2001 From: David Duque Date: Thu, 28 May 2020 16:17:10 +0100 Subject: [PATCH 108/165] Typo fix --- management/dns_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/dns_update.py b/management/dns_update.py index 9f664172..6d2c957e 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -918,7 +918,7 @@ def set_secondary_dns(hostnames, env): raise ValueError("That's neither an IPv4 or IPv6 subnet.") else: v = ipaddress.ip_address(item[4:]) # raises a ValueError if there's a problem - if not isinstance(v, ipaddress.IPv4Network) and not isinstance(v, ipaddress.IPv6Network): + if not isinstance(v, ipaddress.IPv4Address) and not isinstance(v, ipaddress.IPv6Address): raise ValueError("That's neither an IPv4 or IPv6 address.") except ValueError: raise ValueError("'%s' is not an IPv4 or IPv6 address or subnet." % item[4:]) From d01069f7f2986523bbfb041917421a4c4f686985 Mon Sep 17 00:00:00 2001 From: David Duque Date: Fri, 12 Jun 2020 09:27:08 +0100 Subject: [PATCH 109/165] Automatically agree to ToS on SSL provision --- management/ssl_certificates.py | 1 + management/templates/ssl.html | 1 + 2 files changed, 2 insertions(+) diff --git a/management/ssl_certificates.py b/management/ssl_certificates.py index 76b0f8fa..ed6b58e9 100755 --- a/management/ssl_certificates.py +++ b/management/ssl_certificates.py @@ -320,6 +320,7 @@ def provision_certificates(env, limit_domains): "certonly", #"-v", # just enough to see ACME errors "--non-interactive", # will fail if user hasn't registered during Mail-in-a-Box setup + "--agree-tos", # Automatically agrees to Let's Encrypt TOS "-d", ",".join(domain_list), # first will be main domain diff --git a/management/templates/ssl.html b/management/templates/ssl.html index a6b913ee..92cce670 100644 --- a/management/templates/ssl.html +++ b/management/templates/ssl.html @@ -12,6 +12,7 @@ From 0ccbf1b809ece7f1753e7e6b11b722527cd192a5 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 21 Jun 2020 15:05:17 +0100 Subject: [PATCH 110/165] Only spawn a thread pool when strictly needed For --check-primary-hostname, the pool is not used. When exiting, the other processes are left alive and will hang. --- management/status_checks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/management/status_checks.py b/management/status_checks.py index 21aa58dc..64f28b7b 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -983,12 +983,13 @@ if __name__ == "__main__": from utils import load_environment env = load_environment() - pool = multiprocessing.pool.Pool(processes=10) if len(sys.argv) == 1: + pool = multiprocessing.pool.Pool(processes=10) run_checks(False, env, ConsoleOutput(), pool) elif sys.argv[1] == "--show-changes": + pool = multiprocessing.pool.Pool(processes=10) run_and_output_changes(env, pool) elif sys.argv[1] == "--check-primary-hostname": From 5d6c23cff9ed5ce2668f1fc0624bd76f7a0bf79b Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 21 Jun 2020 15:18:46 +0100 Subject: [PATCH 111/165] Finalize php configuration --- conf/nginx-custom.conf | 3 +++ conf/nginx-top.conf | 2 +- management/templates/index.html | 2 +- setup/functions.sh | 2 ++ setup/preflight.sh | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/conf/nginx-custom.conf b/conf/nginx-custom.conf index 83737884..fbb2dd15 100644 --- a/conf/nginx-custom.conf +++ b/conf/nginx-custom.conf @@ -2,6 +2,9 @@ root $ROOT; index index.html index.htm; + # If you want to use the PHP socket, use the "php-fpm" alias. + + # DON'T DELETE THE LINE BELOW # ADDITIONAL DIRECTIVES HERE # Disable viewing dotfiles (.htaccess, .svn, .git, etc.) diff --git a/conf/nginx-top.conf b/conf/nginx-top.conf index 435b5f7b..a4d09292 100644 --- a/conf/nginx-top.conf +++ b/conf/nginx-top.conf @@ -7,6 +7,6 @@ ## your own --- please do not ask for help from us. upstream php-fpm { - server unix:/var/run/php/php7.3-fpm.sock; + server unix:/var/run/php/php!!___PHPVER___!!-fpm.sock; } diff --git a/management/templates/index.html b/management/templates/index.html index d88eb569..f4fa9a52 100644 --- a/management/templates/index.html +++ b/management/templates/index.html @@ -180,7 +180,7 @@
diff --git a/setup/functions.sh b/setup/functions.sh index 509d3dc0..634f3332 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -223,3 +223,5 @@ if [ "$OS" == "Debian GNU/Linux 10 (buster)" ]; then elif [ "$OS" == "Ubuntu 20.04 LTS" ]; then export PHP_VERSION="7.4" fi + +sed -i "s|!!___PHPVER___!!|${PHP_VERSION}|g" conf/nginx-top.conf diff --git a/setup/preflight.sh b/setup/preflight.sh index 013eb038..785ec72d 100644 --- a/setup/preflight.sh +++ b/setup/preflight.sh @@ -18,7 +18,7 @@ if [ "$OS" != "Debian GNU/Linux 10 (buster)" -a "$OS" != "Ubuntu 20.04 LTS" ]; t exit 1 fi -sed -i "s|__OSTAG__|${OS}|g" management/templates/index.html +sed -i "s|!!___DIST_TAG___!!|${OS}|g" management/templates/index.html # Check that we have enough memory. # From 74554bcbf3758fbcf50dbfad285fa259283f9da0 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 21 Jun 2020 15:45:34 +0100 Subject: [PATCH 112/165] Version bump --- README.md | 8 +++----- setup/bootstrap.sh | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index beaeebba..67c1ee4e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Installation -- **PRE-REQUISITES:** Debian 10 (Buster) fresh installation +- **PRE-REQUISITES:** Debian 10 (Buster) or Ubuntu 20.04 LTS fresh installation Update packages: ```sh @@ -22,7 +22,7 @@ Install Power-Mail-in-a-Box (short link) curl -L https://dvn.pt/powermiab | sudo bash ``` -## Current Version: v0.44.POWER.5 (Tracking v0.44) +## Current Version: v0.44.POWER.7 (Tracking v0.44) This is a fork of MiaB (duh), hacked and tuned to my needs: @@ -32,9 +32,7 @@ This is a fork of MiaB (duh), hacked and tuned to my needs: πŸ’€ - **I did not begin this part yet!** -- βœ… Proper support for Debian (I recommend Debian Buster or later, but if it works on your machine, it works!); - -- - I changed the pre-flight checks to accept Debian and Debian only. If you think you can also make this fork Ubuntu-compatible, shoot a PR or something. +- βœ… Proper support for Debian (I recommend Debian Buster or later, but if it works on your machine, it works!) AND Ubuntu 20.04 LTS; - βœ… Native support for SMTP relays (For example: SendGrid); diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index d974413d..bc1830f8 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -10,8 +10,7 @@ if [ -z "$TAG" ]; then # Make s OS=`lsb_release -d | sed 's/.*:\s*//'` if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS" ]; then - # This machine is running Ubuntu 18.04. - TAG=v0.44.POWER.6 + TAG=v0.44.POWER.7 else echo "This script must be run on a system running Debian 10 OR Ubuntu 20.04 LTS." exit 1 From 9a4cf4d7afeee7a71aebf7755a9b38ea4173926c Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 21 Jun 2020 16:02:17 +0100 Subject: [PATCH 113/165] Update dependencies --- setup/management.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup/management.sh b/setup/management.sh index 362cb345..ab7eb21d 100755 --- a/setup/management.sh +++ b/setup/management.sh @@ -69,18 +69,18 @@ rm -rf $assets_dir mkdir -p $assets_dir # jQuery CDN URL -jquery_version=3.5.0 +jquery_version=3.5.1 jquery_url=https://code.jquery.com # Get jQuery -wget_verify $jquery_url/jquery-$jquery_version.min.js 1d6ae46f2ffa213dede37a521b011ec1cd8d1ad3 $assets_dir/jquery.min.js +wget_verify $jquery_url/jquery-$jquery_version.min.js c8e1c8b386dc5b7a9184c763c88d19a346eb3342 $assets_dir/jquery.min.js # Bootstrap CDN URL -bootstrap_version=4.4.1 +bootstrap_version=4.5.0 bootstrap_url=https://github.com/twbs/bootstrap/releases/download/v$bootstrap_version/bootstrap-$bootstrap_version-dist.zip # Get Bootstrap -wget_verify $bootstrap_url 52759c9d307308da862ac29e1c41bfcfe81313eb /tmp/bootstrap.zip +wget_verify $bootstrap_url 240002ac66f2f6579f266bd07277573d2ad2e63a /tmp/bootstrap.zip unzip -q /tmp/bootstrap.zip -d $assets_dir mv $assets_dir/bootstrap-$bootstrap_version-dist $assets_dir/bootstrap rm -f /tmp/bootstrap.zip From 7b357fa71bde3d9276dd89a3724803a27b48781d Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 21 Jun 2020 22:49:14 +0100 Subject: [PATCH 114/165] Version bump (v0.46 rc) --- setup/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index bc1830f8..20755773 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -10,7 +10,7 @@ if [ -z "$TAG" ]; then # Make s OS=`lsb_release -d | sed 's/.*:\s*//'` if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS" ]; then - TAG=v0.44.POWER.7 + TAG=v0.46.POWER.RC.1 else echo "This script must be run on a system running Debian 10 OR Ubuntu 20.04 LTS." exit 1 From 7864055490b16504a5da539d99a153ce55d84b92 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 27 Jun 2020 19:39:03 +0100 Subject: [PATCH 115/165] Upgrade Nextcloud --- setup/nextcloud.sh | 16 ++++++++-------- setup/questions.sh | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index e7d02cfc..d424737b 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -25,8 +25,8 @@ InstallNextcloud() { echo "Upgrading to Nextcloud version $version" echo - # Download and verify - wget_verify https://download.nextcloud.com/server/releases/nextcloud-$version.zip $hash /tmp/nextcloud.zip + # Download and verify + wget_verify https://download.nextcloud.com/server/releases/nextcloud-$version.zip $hash /tmp/nextcloud.zip # Remove the current owncloud/Nextcloud rm -rf /usr/local/lib/owncloud @@ -51,7 +51,7 @@ InstallNextcloud() { # Starting with Nextcloud 15, the app user_external is no longer included in Nextcloud core, # we will install from their github repository. if [[ $version =~ ^1[567] ]]; then - wget_verify https://github.com/nextcloud/user_external/releases/download/v0.7.0/user_external-0.7.0.tar.gz 555a94811daaf5bdd336c5e48a78aa8567b86437 /tmp/user_external.tgz + wget_verify https://github.com/nextcloud/user_external/releases/download/v0.10.0/user_external-0.10.0.tar.gz 133c0d65aba1b09c28b21d05477c122041a9abc2 /tmp/user_external.tgz tar -xf /tmp/user_external.tgz -C /usr/local/lib/owncloud/apps/ rm /tmp/user_external.tgz fi @@ -91,8 +91,8 @@ InstallNextcloud() { } # Nextcloud Version to install. Checks are done down below to step through intermediate versions. -nextcloud_ver=18.0.4 -nextcloud_hash=6a1c671600d6a839d53cbcfac64eb3858936bbad +nextcloud_ver=19.0.0 +nextcloud_hash=d2c631327873ce42ff6a90f9916396f1f7202ea1 # Current Nextcloud Version, #1623 # Checking /usr/local/lib/owncloud/version.php shows version of the Nextcloud application, not the DB @@ -152,9 +152,9 @@ if [ ! -d /usr/local/lib/owncloud/ ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextc CURRENT_NEXTCLOUD_VER="15.0.8" fi if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^15 ]]; then - InstallNextcloud 16.0.6 0bb3098455ec89f5af77a652aad553ad40a88819 - CURRENT_NEXTCLOUD_VER="16.0.6" - fi + InstallNextcloud 16.0.6 0bb3098455ec89f5af77a652aad553ad40a88819 + CURRENT_NEXTCLOUD_VER="16.0.6" + fi fi InstallNextcloud $nextcloud_ver $nextcloud_hash diff --git a/setup/questions.sh b/setup/questions.sh index 0ed55154..5e3da75e 100644 --- a/setup/questions.sh +++ b/setup/questions.sh @@ -9,7 +9,7 @@ if [ -z "${NONINTERACTIVE:-}" ]; then if [ ! -f /usr/bin/dialog ] || [ ! -f /usr/bin/python3 ] || [ ! -f /usr/bin/pip3 ]; then echo Installing packages needed for setup... apt-get -q -q update - apt_get_quiet install dialog python3 python3-pip || exit 1 + apt_get_quiet install dialog file python3 python3-pip || exit 1 fi # Installing email_validator is repeated in setup/management.sh, but in setup/management.sh From 7af4ab0f4fb0506de580f87adf17bdd7aea8ecb9 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 27 Jun 2020 20:27:49 +0100 Subject: [PATCH 116/165] Version bump --- setup/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 20755773..2e57e84b 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -10,7 +10,7 @@ if [ -z "$TAG" ]; then # Make s OS=`lsb_release -d | sed 's/.*:\s*//'` if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS" ]; then - TAG=v0.46.POWER.RC.1 + TAG=v0.46.POWER.0 else echo "This script must be run on a system running Debian 10 OR Ubuntu 20.04 LTS." exit 1 From fcb44dafa3a96e9f3061be13e35d3125683debea Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 27 Jun 2020 21:32:36 +0100 Subject: [PATCH 117/165] Let's encrypt certbot hotfix --- README.md | 4 +++- management/ssl_certificates.py | 5 +++-- setup/bootstrap.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c39a71f8..a7a1f360 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Install Power-Mail-in-a-Box (short link) curl -L https://dvn.pt/powermiab | sudo bash ``` -## Current Version: v0.44.POWER.7 (Tracking v0.44) +## Current Version: v0.46.POWER.1 (Tracking v0.46) This is a fork of MiaB (duh), hacked and tuned to my needs: @@ -44,6 +44,8 @@ This is a fork of MiaB (duh), hacked and tuned to my needs: - - Custom pages will no longer have their pages defaulting to the MiaB services (`/admin`, `/mail`, etc.); +- βœ… Updated NextCloud to the latest version available; + - πŸ’€ Possibility of disabling some services (\*cough\* NextCloud \*cough\*); - πŸ’€ Anything else I might need to use; diff --git a/management/ssl_certificates.py b/management/ssl_certificates.py index 857069ed..708ccc7d 100755 --- a/management/ssl_certificates.py +++ b/management/ssl_certificates.py @@ -216,12 +216,12 @@ def get_certificates_to_provision(env, limit_domains=None, show_valid_certs=True response = query_dns(domain, rtype) if response != normalize_ip(value): bad_dns.append("%s (%s)" % (response, rtype)) - + if bad_dns: domains_cant_provision[domain] = "The domain name does not resolve to this machine: " \ + (", ".join(bad_dns)) \ + "." - + else: # DNS is all good. @@ -347,6 +347,7 @@ def provision_certificates(env, limit_domains): #"-v", # just enough to see ACME errors "--non-interactive", # will fail if user hasn't registered during Mail-in-a-Box setup "--agree-tos", # Automatically agrees to Let's Encrypt TOS + "--register-unsafely-without-email", # The daemon takes care of renewals "-d", ",".join(domain_list), # first will be main domain diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 2e57e84b..90163a96 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -10,7 +10,7 @@ if [ -z "$TAG" ]; then # Make s OS=`lsb_release -d | sed 's/.*:\s*//'` if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS" ]; then - TAG=v0.46.POWER.0 + TAG=v0.46.POWER.1 else echo "This script must be run on a system running Debian 10 OR Ubuntu 20.04 LTS." exit 1 From 7f305ee02eb4678c81f55afe41941aef595a6f0e Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 28 Jun 2020 09:57:28 +0100 Subject: [PATCH 118/165] Add /.well-known/mta-sts.txt to all nginx dotfiles --- conf/nginx-custom.conf | 13 +++++++++++++ conf/nginx-primaryonly.conf | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/conf/nginx-custom.conf b/conf/nginx-custom.conf index fbb2dd15..d09c3b86 100644 --- a/conf/nginx-custom.conf +++ b/conf/nginx-custom.conf @@ -7,6 +7,19 @@ # DON'T DELETE THE LINE BELOW # ADDITIONAL DIRECTIVES HERE + location = /.well-known/mta-sts.txt { + alias /var/lib/mailinabox/mta-sts.txt; + } + location = /robots.txt { + log_not_found off; + access_log off; + } + + location = /favicon.ico { + log_not_found off; + access_log off; + } + # Disable viewing dotfiles (.htaccess, .svn, .git, etc.) # This block is placed at the end. Nginx's precedence rules means this block # takes precedence over all non-regex matches and only regex matches that diff --git a/conf/nginx-primaryonly.conf b/conf/nginx-primaryonly.conf index 288fce40..31bf0095 100644 --- a/conf/nginx-primaryonly.conf +++ b/conf/nginx-primaryonly.conf @@ -22,20 +22,20 @@ rewrite ^(/cloud/oc[sm]-provider)/$ $1/index.php redirect; location /cloud/ { alias /usr/local/lib/owncloud/; - location ~ ^/cloud/(build|tests|config|lib|3rdparty|templates|data|README)/ { - deny all; - } - location ~ ^/cloud/(?:\.|autotest|occ|issue|indie|db_|console) { - deny all; - } + location ~ ^/cloud/(build|tests|config|lib|3rdparty|templates|data|README)/ { + deny all; + } + location ~ ^/cloud/(?:\.|autotest|occ|issue|indie|db_|console) { + deny all; + } # Enable paths for service and cloud federation discovery # Resolves warning in Nextcloud Settings panel - location ~ ^/cloud/(oc[sm]-provider)?/([^/]+\.php)$ { - index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME /usr/local/lib/owncloud/$1/$2; - fastcgi_pass php-fpm; - } + location ~ ^/cloud/(oc[sm]-provider)?/([^/]+\.php)$ { + index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/local/lib/owncloud/$1/$2; + fastcgi_pass php-fpm; + } } location ~ ^(/cloud)((?:/ocs)?/[^/]+\.php)(/.*)?$ { # note: ~ has precendence over a regular location block From ffc7e8d77e02887935aedd217628d9dd9b2dd584 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 28 Jun 2020 10:05:25 +0100 Subject: [PATCH 119/165] Add comments explaining --- conf/nginx-custom.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/nginx-custom.conf b/conf/nginx-custom.conf index d09c3b86..addb8155 100644 --- a/conf/nginx-custom.conf +++ b/conf/nginx-custom.conf @@ -7,14 +7,16 @@ # DON'T DELETE THE LINE BELOW # ADDITIONAL DIRECTIVES HERE + # Ensure we have the MTA-STS policy enabled location = /.well-known/mta-sts.txt { alias /var/lib/mailinabox/mta-sts.txt; } + + # Disable error logs for these location = /robots.txt { log_not_found off; access_log off; } - location = /favicon.ico { log_not_found off; access_log off; From 3876cbac8a65e20f2420fe9025d1de1e78f65d25 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 28 Jun 2020 10:06:50 +0100 Subject: [PATCH 120/165] Version bump --- README.md | 2 +- setup/bootstrap.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7a1f360..0e0644df 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Install Power-Mail-in-a-Box (short link) curl -L https://dvn.pt/powermiab | sudo bash ``` -## Current Version: v0.46.POWER.1 (Tracking v0.46) +## Current Version: v0.46.POWER.2 (Tracking v0.46) This is a fork of MiaB (duh), hacked and tuned to my needs: diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index 90163a96..cbe5a33a 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -10,7 +10,7 @@ if [ -z "$TAG" ]; then # Make s OS=`lsb_release -d | sed 's/.*:\s*//'` if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS" ]; then - TAG=v0.46.POWER.1 + TAG=v0.46.POWER.2 else echo "This script must be run on a system running Debian 10 OR Ubuntu 20.04 LTS." exit 1 From b98111b4e1511146276727c69f86bae881a9c6ec Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 29 Jun 2020 09:13:50 +0100 Subject: [PATCH 121/165] Fix unassigned php version --- management/backup.py | 4 ++-- management/daily_tasks.sh | 6 +++--- setup/functions.sh | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/management/backup.py b/management/backup.py index 1bec8638..90a64588 100755 --- a/management/backup.py +++ b/management/backup.py @@ -247,7 +247,7 @@ def perform_backup(full_backup): if quit: sys.exit(code) - service_command("php7.3-fpm", "stop", quit=True) + service_command("php!!___PHPVER___!!-fpm", "stop", quit=True) service_command("postfix", "stop", quit=True) service_command("dovecot", "stop", quit=True) @@ -281,7 +281,7 @@ def perform_backup(full_backup): # Start services again. service_command("dovecot", "start", quit=False) service_command("postfix", "start", quit=False) - service_command("php7.3-fpm", "start", quit=False) + service_command("php!!___PHPVER___!!-fpm", "start", quit=False) # Remove old backups. This deletes all backup data no longer needed # from more than 3 days ago. diff --git a/management/daily_tasks.sh b/management/daily_tasks.sh index db496399..dee8b602 100755 --- a/management/daily_tasks.sh +++ b/management/daily_tasks.sh @@ -12,14 +12,14 @@ export LC_TYPE=en_US.UTF-8 # On Mondays, i.e. once a week, send the administrator a report of total emails # sent and received so the admin might notice server abuse. if [ `date "+%u"` -eq 1 ]; then - management/mail_log.py -t week | management/email_administrator.py "Mail-in-a-Box Usage Report" + management/mail_log.py -t week | management/email_administrator.py "Mail-in-a-Box Usage Report" fi # Take a backup. management/backup.py 2>&1 | management/email_administrator.py "Backup Status" # Provision any new certificates for new domains or domains with expiring certificates. -management/ssl_certificates.py -q 2>&1 | management/email_administrator.py "TLS Certificate Provisioning Result" +management/ssl_certificates.py -q 2>&1 | management/email_administrator.py "TLS Certificate Provisioning Result" # Run status checks and email the administrator if anything changed. -management/status_checks.py --show-changes 2>&1 | management/email_administrator.py "Status Checks Change Notice" +management/status_checks.py --show-changes 2>&1 | management/email_administrator.py "Status Checks Change Notice" diff --git a/setup/functions.sh b/setup/functions.sh index 3cfe9e1e..7097ad64 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -232,3 +232,4 @@ elif [ "$OS" == "Ubuntu 20.04 LTS" ]; then fi sed -i "s|!!___PHPVER___!!|${PHP_VERSION}|g" conf/nginx-top.conf +sed -i "s|!!___PHPVER___!!|${PHP_VERSION}|g" management/backup.py From 1d4d03637f2cba4da6a5c59544d92699b8ca5f55 Mon Sep 17 00:00:00 2001 From: David Duque Date: Mon, 29 Jun 2020 09:47:38 +0100 Subject: [PATCH 122/165] Version bump --- README.md | 19 +++++++++++++++++-- setup/bootstrap.sh | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0e0644df..76415ca0 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ sudo apt update sudo apt full-upgrade ``` -Make sure that the `en_US.UTF-8` locale exists and is set as primary +Make sure that the `en_US.UTF-8` locale exists and is set as primary (this depends on the image you use) ```sh sudo apt install locales sudo dpkg-reconfigure locales @@ -22,7 +22,12 @@ Install Power-Mail-in-a-Box (short link) curl -L https://dvn.pt/powermiab | sudo bash ``` -## Current Version: v0.46.POWER.2 (Tracking v0.46) +If that doesn't work: +```sh +curl https://raw.githubusercontent.com/ddavness/power-mailinabox/master/setup/bootstrap.sh | sudo bash +``` + +## Current Version: v0.46.POWER.3 (Tracking v0.46) This is a fork of MiaB (duh), hacked and tuned to my needs: @@ -48,6 +53,16 @@ This is a fork of MiaB (duh), hacked and tuned to my needs: - πŸ’€ Possibility of disabling some services (\*cough\* NextCloud \*cough\*); +### Ideas section: + +- πŸ’€ AXFR Transfers using TSIG? + +- πŸ’€ Expand DNS options? + +- πŸ’€ More complete webmail configuration via the admin panel? + +- πŸ’€ Encrypting backups using user-provided PGP keys? + - πŸ’€ Anything else I might need to use; All in all, I think I should rename this to something like "Central [Clown Computing](https://www.urbandictionary.com/define.php?term=clown%20computing)", since I'm trying to cram as many services as possible into that poor machine (Spending 5$ is better than spending 10$) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index cbe5a33a..1f76258c 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -10,7 +10,7 @@ if [ -z "$TAG" ]; then # Make s OS=`lsb_release -d | sed 's/.*:\s*//'` if [ "$OS" == "Debian GNU/Linux 10 (buster)" -o "$OS" == "Ubuntu 20.04 LTS" ]; then - TAG=v0.46.POWER.2 + TAG=v0.46.POWER.3 else echo "This script must be run on a system running Debian 10 OR Ubuntu 20.04 LTS." exit 1 From 3dfdb9a30981ef98005018812858cc7ccbde5339 Mon Sep 17 00:00:00 2001 From: David Duque Date: Fri, 3 Jul 2020 19:01:16 +0100 Subject: [PATCH 123/165] Update Vagrantfile to pull from development branch --- Vagrantfile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 5f9d780f..2d6d3a0d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -26,8 +26,22 @@ Vagrant.configure("2") do |config| export PRIMARY_HOSTNAME=auto #export SKIP_NETWORK_CHECKS=1 + if [ ! git ] + then + apt update + apt install git + fi + + if [ ! -d /mailinabox ]; + then + git clone https://github.com/ddavness/power-mailinabox.git /mailinabox + fi + # Start the setup script. - cd /vagrant + cd /mailinabox + git checkout development + git pull + setup/start.sh SH end From dd017c44c76fabee28799dd5450ab3f3bebf396c Mon Sep 17 00:00:00 2001 From: David Duque Date: Wed, 8 Jul 2020 15:00:04 +0100 Subject: [PATCH 124/165] Update ideas section and roadmap --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 76415ca0..77f276a1 100644 --- a/README.md +++ b/README.md @@ -51,17 +51,25 @@ This is a fork of MiaB (duh), hacked and tuned to my needs: - βœ… Updated NextCloud to the latest version available; -- πŸ’€ Possibility of disabling some services (\*cough\* NextCloud \*cough\*); +- πŸ’€ Encrypting backups using user-provided PGP keys; + +- πŸ’€ Ability to download the backups from the admin panel; ### Ideas section: -- πŸ’€ AXFR Transfers using TSIG? +- πŸ’€ Possibility of making some services optional (if they require more software to be installed) on setup? -- πŸ’€ Expand DNS options? +- - For example, one might simply not use NextCloud/Munin at all, and they're there... just wasting resources. -- πŸ’€ More complete webmail configuration via the admin panel? +- πŸ’€ Restricting access to the admin panel to certain IP's? -- πŸ’€ Encrypting backups using user-provided PGP keys? +- πŸ’€ Customizing MTA names? (because privacy) + +- πŸ’€ AXFR Transfers (for secondary DNS) using TSIG? + +- πŸ’€ Expand DNS record options? + +- πŸ’€ More complete webmail configuration via the admin panel/plugin management? - πŸ’€ Anything else I might need to use; From 4a85250242569ecddd31b0647798f96290d77f6d Mon Sep 17 00:00:00 2001 From: David Duque Date: Wed, 8 Jul 2020 19:31:35 +0100 Subject: [PATCH 125/165] Revert vagrantfile to upstream config --- Vagrantfile | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 2d6d3a0d..9e7ac462 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,12 +1,11 @@ + # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| - # Recreate our conditions - config.vm.box = "generic/debian10" - config.vm.provider "hyperv" do |v| - v.memory = 1024 - v.cpus = 1 + config.vm.box = "debian/buster64" + config.vm.provider :virtualbox do |vb| + vb.customize ["modifyvm", :id, "--cpus", 1, "--memory", 1024] end # Network config: Since it's a mail server, the machine must be connected @@ -24,24 +23,9 @@ Vagrant.configure("2") do |config| export PUBLIC_IP=auto export PUBLIC_IPV6=auto export PRIMARY_HOSTNAME=auto - #export SKIP_NETWORK_CHECKS=1 - - if [ ! git ] - then - apt update - apt install git - fi - - if [ ! -d /mailinabox ]; - then - git clone https://github.com/ddavness/power-mailinabox.git /mailinabox - fi - + export SKIP_NETWORK_CHECKS=1 # Start the setup script. - cd /mailinabox - git checkout development - git pull - + cd /vagrant setup/start.sh SH -end +end \ No newline at end of file From 199c2c50babd0b0822a86bee6f2ad06020fe185f Mon Sep 17 00:00:00 2001 From: David Duque Date: Wed, 8 Jul 2020 19:32:24 +0100 Subject: [PATCH 126/165] Backups: Fix backup target selector width --- management/templates/system-backup.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/templates/system-backup.html b/management/templates/system-backup.html index 3860edb7..81915fdc 100644 --- a/management/templates/system-backup.html +++ b/management/templates/system-backup.html @@ -12,7 +12,7 @@
-
+

+ + + + From 79e2398d71762cbec404d8686e53fa4268853bad Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 11 Jul 2020 08:30:05 +0100 Subject: [PATCH 128/165] Fix comment --- management/backup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/management/backup.py b/management/backup.py index cbc2ff5f..c9f7d80a 100755 --- a/management/backup.py +++ b/management/backup.py @@ -339,7 +339,8 @@ def perform_backup(full_backup, user_initiated=False): # before the status checks might catch them down. See #381. if user_initiated: # God forgive me for what I'm about to do - lock._release() # We don't need to restart the services + lock._release() + # We don't need to wait for the services to be up in this case else: wait_for_service(25, True, env, 10) wait_for_service(993, True, env, 10) From e224b6b3b2cb4b9fed7ec852749c3d0e0e4ce54b Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 11 Jul 2020 08:43:46 +0100 Subject: [PATCH 129/165] Update project status --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 77f276a1..a61c8113 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ This is a fork of MiaB (duh), hacked and tuned to my needs: - βœ… Updated NextCloud to the latest version available; +- πŸ‘¨β€πŸ’» Performing backups immediately from the admin panel (independently from the daily schedule); + - πŸ’€ Encrypting backups using user-provided PGP keys; - πŸ’€ Ability to download the backups from the admin panel; @@ -71,6 +73,10 @@ This is a fork of MiaB (duh), hacked and tuned to my needs: - πŸ’€ More complete webmail configuration via the admin panel/plugin management? +- πŸ’€ Optional TOTP Two-Factor-Authentication for the admin panel/webmail? + +- - Maybe U2F one day, too, but I don't have a capable device for this just yet... + - πŸ’€ Anything else I might need to use; All in all, I think I should rename this to something like "Central [Clown Computing](https://www.urbandictionary.com/define.php?term=clown%20computing)", since I'm trying to cram as many services as possible into that poor machine (Spending 5$ is better than spending 10$) From ccf60c7017b738d94b15b8d74b8808b77e7d5f35 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 11 Jul 2020 09:16:32 +0100 Subject: [PATCH 130/165] Backups: User-initiated and cron-initiated jobs will have the same lockname So that some poor timing (initiating a backup when there's a cron-initiated backup) doesn't screw everything up. --- management/backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/backup.py b/management/backup.py index c9f7d80a..bfae23b3 100755 --- a/management/backup.py +++ b/management/backup.py @@ -215,7 +215,7 @@ def perform_backup(full_backup, user_initiated=False): # Create an global exclusive lock so that the backup script # cannot be run more than one. - lock = Lock(die=(not user_initiated)) + lock = Lock(name="mailinabox_backup_daemon", die=(not user_initiated)) if user_initiated: # God forgive me for what I'm about to do try: From b562e7eefac7994d00b3fbc00f57c4f23c981717 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sat, 11 Jul 2020 15:45:50 +0100 Subject: [PATCH 131/165] Hide the 'Create Backup' buttons when backups are turned off --- management/templates/system-backup.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/management/templates/system-backup.html b/management/templates/system-backup.html index f24f48cd..5d0e3487 100644 --- a/management/templates/system-backup.html +++ b/management/templates/system-backup.html @@ -141,8 +141,9 @@ - - + + +