From 98ca932a3f078a56a4dd91c8f94039ccbc3f65dd Mon Sep 17 00:00:00 2001 From: "Michael S. Scaramella, Esq." <36650381+MSSEsq@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:37:13 -0400 Subject: [PATCH] Update maintenance.html The instructions in the Mail-in-a-Box Maintenance Guide for restoring from S3 compatible backups did not work, so I updated and enhanced the instructions in a forked copy of the maintenance.html file. The instructions now work, and are clearer and more complete. Since I was editing the maintenance.html file, I decided to update it more comprehensively. This included updating the body to use UTF-8 character encoding, as specified in the header. I also updated the instructions for maintaining Ubuntu Linux to be easier for newer users who are still learning and becoming more comfortable with system maintenance. --- maintenance.html | 91 +++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/maintenance.html b/maintenance.html index 5e808f0..ddc6eee 100644 --- a/maintenance.html +++ b/maintenance.html @@ -9,11 +9,6 @@ - - - - - @@ -31,7 +26,7 @@
@@ -68,12 +63,12 @@sudo reboot
. Once the box has started up, check the System Status Checks page again.Please do these steps first. If you’ve done these steps, then head to the discussion forum to ask your question. In your post:
+Please do these steps first. If you’ve done these steps, then head to the discussion forum to ask your question. In your post:
If you figure out the problem on your own, you are also welcome to write up your experience on the discussion forum so that it might help others.
@@ -84,9 +79,9 @@Your box can host email and serve static websites for more than one domain name. To set up additional domain names, just follow three steps:
You should periodically update the system software on your box. The box will automatically install security updates as they are made available by Ubuntu, but your control panel will let you know if a reboot is needed or if non-security updates are available for you to install.
-When indicated to do so, log into your machine with SSH (using the same ssh
command that you used during setup) and then type:
When indicated to do so, log into your machine with SSH (using the same ssh
command that you used during setup) and then run:
sudo apt-get update && sudo apt-get upgrade+
sudo apt-get update && sudo apt-get dist-upgrade-
If prompted to reboot, type:
+If prompted to reboot, then run:
sudo reboot-
We will post security advisories to our twitter account @mailinabox, the announcements section of the discussion forum, and our Slack chat (see the homepage).
+If apt-get dist-upgrade reports that “packages have been kept back” then those packages are being released in Phased Updates. If you want your system to be updated with held back packages without waiting for the Phased Update process to complete, for example because an update is expected to fix a problem, then copy the listed names of the held back packages that should be updated and run:
+ +sudo apt-get install pasted-names-of-the-held-back-packages+ +
Occasionally, after updating Ubuntu, run:
+ +sudo apt-get autoremove && sudo apt-get autoclean --yes && sudo apt-get check+ +
We will post security advisories to our Fosstodon account @MailInABox, the announcements section of the discussion forum, and our Slack chat (see the homepage).
You should move to the latest Mail-in-a-Box release as releases are posted, especially if an update addresses any security issues, although you do not necessarily need to do so. We will post release announcements to our twitter account @mailinabox, the announcements section of the discussion forum, and our Slack chat (see the homepage).
+You should move to the latest Mail-in-a-Box release as releases are posted, especially if an update addresses any security issues, although you do not necessarily need to do so. We will post release announcements to our Fosstodon account @MailInABox, the announcements section of the discussion forum, and our Slack chat (see the homepage).
-Check the release notes prior to updating to see what’s been changed in the latest version.
+Check the release notes prior to updating to see what’s been changed in the latest version.
If you are upgrading from Mail-in-a-Box version 5x or earlier on Ubuntu 18.04 to version 60 or later on Ubuntu 22.04:
@@ -135,11 +138,11 @@If you want to move your Mail-in-a-Box installation to a new machine (e.g. you’re getting more memory, getting a new IP address, etc.), or if something is horribly wrong with your box, you can easily move all of your data to a new machine. This is also the process for upgrading a Mail-in-a-Box box from version 5x or earlier on Ubuntu 18.04 to version 60 or later on Ubuntu 22.04 (see the release announcement for details).
+If you want to move your Mail-in-a-Box installation to a new machine (e.g. you’re getting more memory, getting a new IP address, etc.), or if something is horribly wrong with your box, you can easily move all of your data to a new machine. This is also the process for upgrading a Mail-in-a-Box box from version 5x or earlier on Ubuntu 18.04 to version 60 or later on Ubuntu 22.04 (see the release announcement for details).
Even if your box is working fine, it’s a good idea to test out this procedure from time to time so that you can verify that your backups are working and that you haven’t lost the backup secret key.
+Even if your box is working fine, it’s a good idea to test out this procedure from time to time so that you can verify that your backups are working and that you haven’t lost the backup secret key.
Start by creating a new Mail-in-a-Box machine: Spin up a new machine following the setup guide’s section The Machine. Use as many of the same settings as on your original box as makes sense. On Digital Ocean you will need to use the exact same name for your box as you did previously or reverse DNS won’t work.
+Start by creating a new Mail-in-a-Box machine: Spin up a new machine following the setup guide’s section The Machine. Use as many of the same settings as on your original box as makes sense. On Digital Ocean you will need to use the exact same name for your box as you did previously or reverse DNS won’t work.
-Then follow the steps in the setup guide’s section Setting Up The Box. When you are prompted for the box’s hostname, you will need to use the hostname that you are currently using.
+Then follow the steps in the setup guide’s section Setting Up The Box. When you are prompted for the box’s hostname, you will need to use the hostname that you are currently using.
Next you’ll restore your mail data and other files to the new machine.
+Next you’ll restore your mail data and other files to the new machine.
Your backups are encrypted, and you will need your backup secret key to restore from the backup.
-You should have already stored the backup secret key in a safe place — like in your home — per the backup instructions in the control panel. If you haven’t done that yet... now is the time! The file is located on your old box at /home/user-data/backup/secret_key.txt
. Copy that file to a safe place now.
You should have already stored the backup secret key in a safe place—like in your home—per the backup instructions in the control panel. If you haven’t done that yet... now is the time! The file is located on your old box at /home/user-data/backup/secret_key.txt
. Copy that file to a safe place now.
Copy that file onto your new box. Any SFTP program like FileZilla can help you with that. (SFTP is like SSH, so you will use the same login credentials as you use with SSH.)
+Copy that file onto your new box. Any SFTP program like Cyberduck or FileZilla can help you with that. (SFTP is like SSH, so you will use the same login credentials as you use with SSH.)
If you are using the default backup method, which stores backups on the box itself, then hopefully you have figured out how to periodically copy those files somewhere else safe — otherwise what’s the point!
+If you are using the default backup method, which stores backups on the box itself, then hopefully you have figured out how to periodically copy those files somewhere else safe—otherwise what’s the point!
-Using any SFTP program like FileZilla (or scp
if you know how) copy your backups from wherever you stored them to somewhere on your new machine. If your old box is still running, then just copy them from /home/user-data/backup/encrypted
on your old box.
Using any SFTP program like Cyberduck or FileZilla (or scp
if you know how) copy your backups from wherever you stored them to somewhere on your new machine. If your old box is still running, then just copy them from /home/user-data/backup/encrypted
on your old box.
Then restore the files:
@@ -203,23 +206,33 @@If your backups are stored in Amazon S3, get your account credentials handy and then run a duplicity restore:
+If backups are stored in Amazon S3, have account credentials handy and then run a Duplicity restore. Replace the sample keys, URLs, and paths in the example commands below with the actual keys, URLs, and paths from your instance of Mail-in-a-Box, and then run the commands:
-export AWS_ACCESS_KEY_ID=paste your AWS access key ID here -export AWS_SECRET_ACCESS_KEY=paste your AWS secret access key here +-export AWS_ACCESS_KEY_ID=paste_your_AWS_access_key_ID_here +export AWS_SECRET_ACCESS_KEY=paste_your_AWS_secret_access_key_here export PASSPHRASE=$(cat your_backup_secret_key_file.txt) -sudo -E duplicity restore --force s3://s3.amazonaws.com/your-bucket-name/your-backup-path /home/user-data/+sudo -E duplicity restore --force s3://s3.amazonaws.com/bucket-name/backup-path /home/user-data/
You may have to adjust the S3 URL depending on what AWS region you use. You can find the AWS Regions and Endpoints here
+You may have to adjust the S3 URL depending on what AWS region you use. You can find the AWS Regions and Endpoints here.
If your backups are stored in an S3 compatible storage which is not amazon, you have to set the s3 endpoint url:
+If backups are stored in S3 compatible storage (not Amazon), then the S3 endpoint URL and the storage path relative to that endpoint must be set as environment variables to run a Duplicity restore. Replace the sample keys, URLs, and paths in the example commands below with the actual keys, URLs, and paths from your instance of Mail-in-a-Box, and then run the commands:
-export AWS_ACCESS_KEY_ID=paste your AWS access key ID here -export AWS_SECRET_ACCESS_KEY=paste your AWS secret access key here ++ +export AWS_ACCESS_KEY_ID=paste_your_AWS_access_key_ID_here +export AWS_SECRET_ACCESS_KEY=paste_your_AWS_secret_access_key_here export PASSPHRASE=$(cat your_backup_secret_key_file.txt) -sudo -E duplicity restore --force s3://your-bucket-name/your-backup-path /home/user-data/ --s3-endpoint-url=https://host+sudo -E duplicity restore --force s3:///bucket-name/backup-path \ +--s3-endpoint-url=https://subdomain.domain.tld /home/user-data/
If you want to check the status of backups stored in S3 compatible storage (not Amazon) before restoring files, then the S3 endpoint URL and the storage path relative to that endpoint must be set as environment variables to run a Duplicity status check. Checking the status of Duplicity backup collections is a good way to test access before running a Duplicity restore. Replace the sample keys, URLs, and paths in the example commands below with the actual keys, URLs, and paths from your instance of Mail-in-a-Box, and then run the commands:
+ +export AWS_ACCESS_KEY_ID=paste_your_AWS_access_key_ID_here +export AWS_SECRET_ACCESS_KEY=paste_your_AWS_secret_access_key_here +sudo -E duplicity collection-status s3:///bucket-name/backup-path \ +--s3-endpoint-url=https://subdomain.domain.tld+ +
Consult the Duplicity Reference Manual if you want more information about using Duplicity.
Finally, update your domain name’s glue records to the new machine’s IP address (see the setup guide’s section on glue records.
+Finally, update your domain name’s glue records to the new machine’s IP address (see the setup guide’s section on glue records.
-DNS can take a few hours to update, so wait a while, and then see if the control panel’s status checks report any problems and that your devices are picking up mail on your new box.
+DNS can take a few hours to update, so wait a while, and then see if the control panel’s status checks report any problems and that your devices are picking up mail on your new box.
(Skip this if you are just testing your backups.)