User Tools

Site Tools


computing:mailserver-trixie

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
computing:mailserver-trixie [2026/07/31 17:05] oemb1905computing:mailserver-trixie [2026/08/31 00:07] (current) oemb1905
Line 70: Line 70:
  
   sudo apt update && sudo apt upgrade -y   sudo apt update && sudo apt upgrade -y
-  sudo apt install mailutils postfix ufw fail2ban nginx apache2 php8.4-fpm php8.4-mysql php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip dovecot-core dovecot-imapd dovecot-lmtpd+  sudo apt install mailutils postfix ufw fail2ban apache2 php8.4-fpm php8.4-mysql php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip dovecot-core dovecot-imapd dovecot-lmtpd
  
 It's also important that that the host knows how to identify itself properly. Let's open it up ''/etc/hosts'' and make it is setup correctly. It's also important that that the host knows how to identify itself properly. Let's open it up ''/etc/hosts'' and make it is setup correctly.
Line 202: Line 202:
 inet_protocols = all inet_protocols = all
 message_size_limit = 52428800 message_size_limit = 52428800
 +cyrus_sasl_config_path = /etc/postfix/sasl #now default since early 2026
 </code> </code>
  
Line 303: Line 304:
 </code> </code>
    
-Lastly, before testing, make sure that you only authorize your mynetworks and properly authenticated users. Failing to do this will mean your server could potentially be used for public relay. This block rejects any unauthenticated senders (besides localhost) and requires senders to be authenticated (or to be localhost) while only permitting incoming email directed to ''@haacksnetworking.org'' or ''@domain.com''Please note that if you continue with the optional configurations later in this tutorial, you will integrate these stanzas into other blocks.+Lastly, before testing, make sure that you only authorize your mynetworks and properly authenticated users. Failing to do this will mean your server could potentially be used for public relay. This block rejects any unauthenticated senders (besides localhost) and requires senders to be authenticated (or to be localhost) while only permitting incoming email directed to ''@haacksnetworking.org'' or ''@domain.com''These blocks will be added later in the tutorial, but/and I bring them up now to emphasize that you should close off the public relay.
  
 <code> <code>
Line 343: Line 344:
  
 <code> <code>
-#spf incoming policy and recipient restrictions\ +#spf incoming policy and recipient restrictions 
-policyd-spf_time_limit = 3600\+policyd-spf_time_limit = 3600
 smtpd_recipient_restrictions =  smtpd_recipient_restrictions = 
     permit_mynetworks,      permit_mynetworks, 
Line 415: Line 416:
  
 <code> <code>
-'*@yourdomain.com default._domainkey.yourdomain.com' +*@yourdomain.com default._domainkey.yourdomain.com 
-'*@*.yourdomain.com default._domainkey.yourdomain.com'+*@*.yourdomain.com default._domainkey.yourdomain.com
 </code> </code>
  
Line 468: Line 469:
 </code> </code>
  
-The most important line is the uppermost line, which specifies that email should not be rejected as a result of leveraging the policy. Again, this ensures that spam assassin has what it needs to help users sort and organize email, without the possibility of phantom rejections, prohibiting email from having ever arrived in your inbox. After your DKIM keypair and DKIM policy are setup, you can setup a DMARC policy as well. Install the policy with sudo apt install opendmarc. After it installs, open up ''/etc/opendmarc.conf'' and enter the following:+The most important line is the uppermost line, which specifies that email should not be rejected as a result of leveraging the policy. Again, this ensures that spam assassin has what it needs to help users sort and organize email, without the possibility of phantom rejections, prohibiting email from having ever arrived in your inbox. After your DKIM keypair and DKIM policy are setup, you can setup a DMARC policy as well. Install the policy with ''sudo apt install opendmarc''. After it installs, open up ''/etc/opendmarc.conf'' and enter the following:
  
 <code> <code>
Line 546: Line 547:
 Sieve is already enabled in dovecot and postfix. That was done up above. Now, the tutorial is discussing how to leverage the sieve syntax or language to get desired user results for incoming email. The most basic way to do this is by setting up a global, or server-wide rule, that filters emails before dovecot, via lmtp, delivers the emails to their final destination. This is done by spam assassin adding custom fields and scoring to incoming email headers. The sieve plugin assesses these headers and then makes the correct determination for the final destination, which dovecot, via lmtp, carries out. In summary, spam assassin does the ranking and header-adding, sieve assesses the spam assassin scores and uses the global sieve rule to make determinations for all users, and finally dovecot+limtp handles the mail delivery. To create a global config for all users in this way, head over to ''/etc/dovecot/conf.d/90-sieve.conf'' and then add/uncomment this line: Sieve is already enabled in dovecot and postfix. That was done up above. Now, the tutorial is discussing how to leverage the sieve syntax or language to get desired user results for incoming email. The most basic way to do this is by setting up a global, or server-wide rule, that filters emails before dovecot, via lmtp, delivers the emails to their final destination. This is done by spam assassin adding custom fields and scoring to incoming email headers. The sieve plugin assesses these headers and then makes the correct determination for the final destination, which dovecot, via lmtp, carries out. In summary, spam assassin does the ranking and header-adding, sieve assesses the spam assassin scores and uses the global sieve rule to make determinations for all users, and finally dovecot+limtp handles the mail delivery. To create a global config for all users in this way, head over to ''/etc/dovecot/conf.d/90-sieve.conf'' and then add/uncomment this line:
  
-  sieve_before = /var/mail/SpamToJunk.sieve+<code> 
 +#sieve_before = /var/mail/SpamToJunk.sieve #old bookworm way and early Trixie 
 + 
 +#modern trixie way 
 +sieve_script SpamToJunk { 
 +  type = before 
 +  path = /var/mail/SpamToJunk.sieve 
 +
 +</code>
  
-Now, create the file that you just referenced above in ''/var/mail/SpamToJunk.sieve'' and enter the following:+Now, create the file that you just referenced above in ''/var/mail/SpamToJunk.sieve'' and enter the following and/or any sieve rules you would like.
  
 <code> <code>
Line 625: Line 634:
       ServerName mail.domain.com       ServerName mail.domain.com
       ServerAdmin email@email.com       ServerAdmin email@email.com
-      DocumentRoot /var/www/roundcube/+      DocumentRoot /var/www/roundcube/ #add public_html for latest RC
       ErrorLog ${APACHE_LOG_DIR}/roundcube_error.log       ErrorLog ${APACHE_LOG_DIR}/roundcube_error.log
       CustomLog ${APACHE_LOG_DIR}/roundcube_access.log combined       CustomLog ${APACHE_LOG_DIR}/roundcube_access.log combined
Line 654: Line 663:
       ServerName mail.domain.com       ServerName mail.domain.com
       ServerAdmin email@email.com       ServerAdmin email@email.com
-      DocumentRoot /var/www/roundcube/+      DocumentRoot /var/www/roundcube/  #add public_html for latest RC
       ErrorLog ${APACHE_LOG_DIR}/roundcube_error.log       ErrorLog ${APACHE_LOG_DIR}/roundcube_error.log
       CustomLog ${APACHE_LOG_DIR}/roundcube_access.log combined       CustomLog ${APACHE_LOG_DIR}/roundcube_access.log combined
Line 702: Line 711:
   'debug_logger',   'debug_logger',
   'emoticons',   'emoticons',
-  'enigma',+  // 'enigma', //
   'filesystem_attachments',   'filesystem_attachments',
   'help',   'help',
Line 795: Line 804:
 ====== Part V - Setting up pflogsumm ====== ====== Part V - Setting up pflogsumm ======
  
-It's important to be able to monitor how your setup is performing and what is or is not working correctly. No better way to do that than to get some analytics emailed to you each day. To do that, let's install pflogsumm and use rsyslog for logging. Install the packages sudo apt install pflogsumm rsyslog and then create the log rotation rule over in ''/etc/logrotate.d/postfix-log'' and enter the following:+It's important to be able to monitor how your setup is performing and what is or is not working correctly. No better way to do that than to get some analytics emailed to you each day. To do that, let's install pflogsumm and use rsyslog for logging. Install the packages ''sudo apt install pflogsumm'' rsyslog and then create the log rotation rule over in ''/etc/logrotate.d/postfix-log'' and enter the following:
  
 <code> <code>
Line 1054: Line 1063:
  
 Once you edited the file, load the changes with sudo postmap /etc/postfix/virtual_alias. Once you edited the file, load the changes with sudo postmap /etc/postfix/virtual_alias.
-Another thing I researched when reviewing Linux Babe's tutorial, but ultimately rejected doing was body and header inspection. To do that, install postfix's regular expression tooling with sudo apt install postfix-pcre and then edit the main configuration ''/etc/postfix/main.cf'' and enter the following stanzas:+Another thing I researched when reviewing Linux Babe's tutorial, but ultimately rejected doing was body and header inspection. To do that, install postfix's regular expression tooling with ''sudo apt install postfix-pcre'' and then edit the main configuration ''/etc/postfix/main.cf'' and enter the following stanzas:
  
   header_checks = pcre:/etc/postfix/header_checks   header_checks = pcre:/etc/postfix/header_checks
Line 1134: Line 1143:
 I rewrote the mail server tutorial for the presentation [[https://tech.haacksnetworking.org/2025/06/10/your-email-your-rules-self-hosting-simplified/|Your Email, Your Rules: Self-Hosting Simplified]]. The SeaGL presentation can be found [[https://pretalx.seagl.org/2025/talk/VLM7AS/|on their calendar]]. I rewrote the mail server tutorial for the presentation [[https://tech.haacksnetworking.org/2025/06/10/your-email-your-rules-self-hosting-simplified/|Your Email, Your Rules: Self-Hosting Simplified]]. The SeaGL presentation can be found [[https://pretalx.seagl.org/2025/talk/VLM7AS/|on their calendar]].
  
- --- //[[alerts@haacksnetworking.org|oemb1905]] 2026/07/28 19:51//+ --- //[[alerts@haacksnetworking.org|oemb1905]] 2026/08/31 00:07//
computing/mailserver-trixie.1785517522.txt.gz · Last modified: by oemb1905