Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Help about MediaWiki
FUTO
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Introduction to a Self Managed Life: a 13 hour & 28 minute presentation by FUTO software
(section)
Main Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Step 1: Setting Up Postfix Email System on Ubuntu Server 24.04 == <span id="install-required-packages"></span> ==== 1.1 Install Required Packages ==== <pre>sudo apt update sudo apt install postfix libsasl2-modules mailutils -y</pre> When prompted during install: * Choose '''“Internet Site”''' for configuration type * Enter your system’s fully qualified domain name when asked of where we are sending emails from, in our case it is <code>home.arpa</code> * Recipient for root & postmaster mail will be the email you want to receive that at, for me I set it as the same email as ZFS alerts which is <code>l.a.rossmann@gmail.com</code> for me * Set '''“Force synchronous updates on mail queue?”''' to no <gallery mode="packed-hover" heights=250 widths=400 perrow=2> File:lu67917r1ezu_tmp_ff734222.png File:lu67917r1ezu_tmp_667e9c06.png File:lu67917r1ezu_tmp_f9f6cd56.png File:lu67917r1ezu_tmp_5c8e2e53.png File:lu67917r1ezu_tmp_b07ae624.png </gallery> <span id="configure-main-postfix-configuration---this-is-similar-to-what-we-did-for-freepbx-voicemail-alerts-in-the-previous-section"></span> ==== 1.2 Configure Main Postfix Configuration - this is similar to what we did for FreePBX voicemail alerts in the previous section ==== <ol style="list-style-type: decimal;"> <li><p>Backup existing configuration:</p> <pre>sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.backup</pre></li> <li><p>Create new <code>main.cf</code>:</p> <pre>sudo nano /etc/postfix/main.cf</pre></li> <li><p>Copy and paste the provided configuration template if you need, and edit the <code>yourdriveisdead@stevesavers.com</code> email in the configuration file with the email you wish to have Postfix use to send you an email.</p></li></ol> <pre> # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # See http://www.postfix.org/COMPATIBILITY_README.html -- default to 3.6 on # fresh installs. compatibility_level = 3.6 # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_security_level=may smtp_tls_CApath=/etc/ssl/certs smtp_tls_security_level=may smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = debian.home.arpa alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = $myhostname, debian, localhost.localdomain, localhost relayhost = [smtp.postmarkapp.com]:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_sasl_mechanism_filter = plain sender_canonical_maps = static:yourdriveisdead@stevesavers.com mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + # WARNING: Changing the inet_interfaces to an IP other than 127.0.0.1 may expose Postfix to external network connections. # Only modify this setting if you understand the implications and have specific network requirements. inet_interfaces = 127.0.0.1 inet_protocols = all message_size_limit = 102400000</pre> <span id="set-up-smtp-authentication-and-use-your-usernamespasswordsemails-to-replace-mine"></span> ==== 1.3 Set Up SMTP Authentication, and use your usernames/passwords/emails to replace mine ==== <ol style="list-style-type: decimal;"> <li><p>Create the SASL password file:</p> <pre>sudo nano /etc/postfix/sasl_passwd</pre></li> <li><p>Add this line to the file, replacing the username & password with your credentials from postmark:</p></li></ol> <pre>[smtp.postmarkapp.com]:587 1788dd83-9917-46e1-b90a-3b9a89c10bd7:1788dd83-9917-46e1-b90a-3b9a89c10bd7</pre> <ol start="3" style="list-style-type: decimal;"> <li><p>Set proper permissions for security:</p> <pre>sudo chmod 600 /etc/postfix/sasl_passwd</pre></li> <li><p>Create the hash database file:</p> <pre>sudo postmap /etc/postfix/sasl_passwd</pre></li></ol> <span id="restart-and-test"></span> ==== 1.4 Restart and Test ==== <ol style="list-style-type: decimal;"> <li><p>Restart Postfix:</p> <pre>sudo systemctl restart postfix</pre></li> <li><p>Verify Postfix is running:</p> <pre>sudo systemctl status postfix</pre></li> <li><p>Test the email setup:</p> <pre>echo "Test email from $(hostname)" | mail -s "Test Email" l.a.rossmann@gmail.com</pre></li></ol> <gallery mode="packed-hover" heights=250 widths=400 perrow=2> File:lu67917r1ezu_tmp_db123f98.png File:lu67917r1ezu_tmp_cf91d8ae.png </gallery> '''Verification Steps:''' <ol style="list-style-type: decimal;"> <li><p>Check mail logs for errors:</p> <pre>sudo tail -f /var/log/mail.log</pre></li> <li><p>Verify permissions:</p> <pre>ls -l /etc/postfix/sasl_passwd*</pre> <p>Should show:</p> <ul> <li><code>-rw------- 1 root root</code> for sasl_passwd</li> <li><code>-rw------- 1 root root</code> for sasl_passwd.db</li></ul> </li></ol> <span id="troubleshooting-1"></span> === Troubleshooting: === If emails aren’t being sent: <ol style="list-style-type: decimal;"> <li><p>Check Postfix status:</p> <pre>sudo systemctl status postfix</pre></li> <li><p>View detailed mail logs:</p> <pre>sudo journalctl -u postfix</pre></li></ol> Check mail logs for errors: <pre>sudo tail -f /var/log/mail.log</pre> # Check <code>/var/log/mail.log</code> for errors # Check that Postmark credentials are correct (e.g., if you typed <code>postmark.com</code> instead of <code>postmarkapp.com</code> for server, etc.) # Verify sender domain (<code>stevesavers.com</code>) is properly configured in Postmark # Check the '''Activity''' tab on the transactional stream in Postmark # Mail log will tell you what you fkd up 99% of the time. '''This setup does as follows:''' * Send FROM: ''[mailto:yourdriveisdead@stevesavers.com yourdriveisdead@stevesavers.com]'' * Send TO: ''[mailto:l.a.rossmann@gmail.com l.a.rossmann@gmail.com]'' * Use the configured SMTP relay * Include proper authentication The system is now ready for the next step in the ZFS monitoring setup. <span id="step-2-creating-complete-zfs-monitoring-script-with-logging"></span>
Summary:
Please note that all contributions to FUTO may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
FUTO:Copyrights
for details).
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:
Cancel
Editing help
(opens in new window)