Recently, I showed you how to allow automatic security updates for Ubuntu Server, which would automatically download and apply security updates to your open source servers. This is a wonderful setup for those who are too busy to search for and apply updates.
But when something is happening with an update, you may need to be alerted about this error. The most productive address for this is via email.
I’ll show you how to set up email notifications for update errors. It’s not very difficult, so you’ll be able to take care of it on all Ubuntu servers in your knowledge center in no time.
Note: If you are using Gmail SMTP servers, you want to configure an application password for Postfix (see: Skip two-step authentication with application passwords).
SEE: Recruitment Kit: Network Manager (TechRepublic Premium)
For the server to send email alerts, you must install Postfix. To do this, open a terminal window and run the command:
When you install Postfix, you want to configure it as an online page (Figure A).
Figure A
Configure Postfix as a website.
Be sure to visit the website and click OK. In the window that appears, enter the full domain call of your server and OK (Figure B).
Figure B
Configuring the FQDN of your server for Postfix.
Once the Postfix installation is complete, you want to configure the email server. How you do this depends on what you use for an SMTP server. For example, if you have an internal email server, you will use the data from that server (including authentication data). If you’re using Gmail SMTP servers, you first want to set up an application password in your Google account.
Once you know the details of your SMTP server, open the configuration log with the command:
Find the line:
You will need to replace this line to reflect your SMTP server. For example, if you use Gmail SMTP servers, this line would be:
If you use Gmail as an SMTP server, you need to configure Postfix to use another location for authentication data (to prevent you from seeing your unnecessary credentials). To do this, paste the following at the end of the hand.conf file:
Save and file.
Then we will create the sasl_passwd record with the command:
In this file, paste the following:
Where USERNAME is your Gmail username and PASSWORD is your Gmail app password.
Save and file.
Create the hash database for Postfix with the command:
Restart Postfix with the command:
With Postfix up and running, we can now set up alert email. In order to do this, open the configuration log with the command:
In this file, locate the line:
Replace this line with:
Where email-reach is the email with which you must send the email.
If you need to receive notifications in case of error, look for the line:
Replace the previous line with:
Save and file.
At this point, the formula is ready. The next time an automatic security update is applied, get a notification. However, if you have configured this to report only errors, let’s hope you never hear about Postfix.
Otherwise, you’ll feel a little better now that your Ubuntu servers not only automatically apply security updates, but will also notify you when this happens or when an update fails.
How a Network Administrator: A Cheat Sheet (TechRepublic)
Quickly resolve YOUR PC with those 10 PowerShell command applets (TechRepublic download)
How to install Ubuntu Server 20.04 with the new setup (TechRepublic)
What is NDS? How To Network Defined by Software All (ZDNet)
The most productive VPN for 2020 (CNET)
5G: more mandatory reading (TechRepublic on Flipboard)
Jack Wallen is an award for TechRepublic and Linux.com. He is an avid promoter of open source and voice of the Android expert. To learn more about Jack Wallen, visit his online page jackwallen.com.