| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| computing:mailserver-trixie [2026/05/31 05:16] – oemb1905 | computing:mailserver-trixie [2026/07/28 19:52] (current) – oemb1905 |
|---|
| ------------------------------------------- | ------------------------------------------- |
| |
| * [[https://nextcloud.haacksnetworking.org/index.php/s/s6wAL5p7jKHc9Db|Slides]] | * [[https://cloud.haacksnetworking.org/index.php/s/P255xsGX37We4BS|Slides]] |
| * [[https://content.haacksnetworking.org/w/nsMwnJhLnfMrs17W5cAdWg|SeaGL Presentation]] | * [[https://content.haacksnetworking.org/w/erLgeVDEdeUf84FXq2Xk4f|SeaGL Presentation]] |
| * [[https://tech.haacksnetworking.org/2025/06/10/your-email-your-rules-self-hosting-simplified/|Blog Post]] | * [[https://tech.haacksnetworking.org/2025/06/10/your-email-your-rules-self-hosting-simplified/|Blog Post]] |
| |
| </code> | </code> |
| |
| Similarly, for large IMAP folders, you also want to adjust IMAP's logic to provide 256k (vs. 64k) to each single IMAP command. Additionally, make sure that you raise simultaneous connections from a single IP to 25, 50, or more, so your client can handle more in parallel. Lastly, adjust the idle time notification as well for less latency and snappier results. The default is 2mins, but if this is your server only, you can safely go as low as 15s or 30s. This lowering not only helps Roundcube, but helps Delta Chat and other email clients as well. | Similarly, for large IMAP folders, you also want to adjust IMAP's logic to provide 256k (vs. 64k) to each single IMAP command. Additionally, make sure that you raise simultaneous connections from a single IP to 25, 50, or more, so your client can handle more in parallel. Lastly, adjust the idle time notification as well for less latency and snappier results. The default is 2mins, but if this is your server only, you can safely go as low as 15s or 30s. This lowering not only helps Roundcube, but helps Delta Chat and other email clients as well. Open up ''/etc/dovecot/conf.d/20-imap.conf'' and add the following towards the bottom: |
| |
| <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 = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_policy_service unix:private/policyd-spf | smtpd_recipient_restrictions = |
| | permit_mynetworks, |
| | permit_sasl_authenticated, |
| | reject_unauth_destination, |
| | reject_non_fqdn_recipient, |
| | reject_unknown_recipient_domain, |
| | check_policy_service unix:private/policyd-spf |
| </code> | </code> |
| |
| reject_unauthenticated_sender_login_mismatch, | reject_unauthenticated_sender_login_mismatch, |
| reject_sender_login_mismatch, | reject_sender_login_mismatch, |
| | check_sender_access hash:/etc/postfix/sender_access, |
| permit | permit |
| </code> | </code> |
| | |
| | The sender_access file is super helpful for repeat offenders. Sure, you can also just blacklist those in sieve rules, but that means that they still arrive and fill up your Junk folder. In some cases, spammers will send 100s of the same message per day. In those cases, it is helpful to stop them at the gates with postfix's sender_access: |
| | |
| | nano /etc/postfix/sender_access |
| | <spam@domain.com REJECT> #block exact email |
| | <domain.com REJECT> #block all users @domain.com |
| | <.domain.com REJECT> #block all users @sub.domain.com |
| | sudo postmap /etc/postfix/sender_access |
| | sudo postfix reload |
| | sudo systemctl restart postfix |
| |
| Now that the SPF/recipient and PTRI am now going to set up the DKIM policy for incoming email but/and, I will also use the same package to cut a DKIM keypair for use with the server's outgoing email. First, I install the policy and add opendkim to the postfix group. | Now that the SPF/recipient and PTRI am now going to set up the DKIM policy for incoming email but/and, I will also use the same package to cut a DKIM keypair for use with the server's outgoing email. First, I install the policy and add opendkim to the postfix group. |
| } | } |
| # rule:[spamcheck] | # rule:[spamcheck] |
| if anyof (header :contains "x-spam-status" "Yes", header :contains "x-spam-flag" "YES", header :contains "x-spam-level" "*****") | if anyof (header :matches "x-spam-status" "Yes", header :contains "x-spam-flag" "YES", header :contains "x-spam-level" "*****") |
| { | { |
| fileinto "Junk"; | fileinto "Junk"; |
| To test sieve's logic and/or to test spamassassin's scoring, download email (.eml) from Roundcube that did not behave as planned. Once you have the email, ''ssh'' into your mail server's simple unix user's mail directory and do the following: | To test sieve's logic and/or to test spamassassin's scoring, download email (.eml) from Roundcube that did not behave as planned. Once you have the email, ''ssh'' into your mail server's simple unix user's mail directory and do the following: |
| |
| | su - username |
| cd ~/sieve | cd ~/sieve |
| spamassassin -t -D < Amazon1.eml | spamassassin -t -D < Amazon1.eml |
| 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/05/31 05:13// | --- //[[alerts@haacksnetworking.org|oemb1905]] 2026/07/28 19:51// |