This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| computing:mailserver-trixie [2026/05/31 03:31] – oemb1905 | computing:mailserver-trixie [2026/07/28 19:52] (current) – oemb1905 | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| ------------------------------------------- | ------------------------------------------- | ||
| - | * [[https://nextcloud.haacksnetworking.org/ | + | * [[https://cloud.haacksnetworking.org/ |
| - | * [[https:// | + | * [[https:// |
| * [[https:// | * [[https:// | ||
| Line 287: | Line 287: | ||
| </ | </ | ||
| - | Similarly, for large IMAP folders, you also want to adjust IMAP's logic to provide 256k (vs. 64k) to each single IMAP command. Additionally, | + | Similarly, for large IMAP folders, you also want to adjust IMAP's logic to provide 256k (vs. 64k) to each single IMAP command. Additionally, |
| < | < | ||
| Line 293: | Line 293: | ||
| imap_max_line_length = 256k | imap_max_line_length = 256k | ||
| mail_max_userip_connections = 50 | mail_max_userip_connections = 50 | ||
| - | imap_idle_notify_interval = 30s | + | imap_idle_notify_interval = 15s |
| } | } | ||
| </ | </ | ||
| Line 334: | Line 334: | ||
| #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, | + | smtpd_recipient_restrictions = |
| + | | ||
| + | | ||
| + | | ||
| + | reject_non_fqdn_recipient, | ||
| + | reject_unknown_recipient_domain, | ||
| + | | ||
| </ | </ | ||
| Line 353: | Line 359: | ||
| reject_unauthenticated_sender_login_mismatch, | reject_unauthenticated_sender_login_mismatch, | ||
| reject_sender_login_mismatch, | reject_sender_login_mismatch, | ||
| + | check_sender_access hash:/ | ||
| permit | permit | ||
| </ | </ | ||
| + | |||
| + | 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' | ||
| + | |||
| + | nano / | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | sudo postmap / | ||
| + | sudo postfix reload | ||
| + | sudo systemctl restart postfix | ||
| Now that the SPF/ | Now that the SPF/ | ||
| Line 714: | Line 731: | ||
| } | } | ||
| # rule: | # rule: | ||
| - | if anyof (header :contains | + | if anyof (header :matches |
| { | { | ||
| fileinto " | fileinto " | ||
| Line 739: | Line 756: | ||
| active_path = ~/ | active_path = ~/ | ||
| } | } | ||
| + | </ | ||
| + | |||
| + | Lastly, Roundcube is a web gui. So, it is also important that your php handler is optimized and configured with more memory and extra fpm servers. I make the following php adjustments for snappier response time. In ''/ | ||
| + | |||
| + | < | ||
| + | memory_limit = 1G | ||
| + | max_execution_time = 300 | ||
| + | max_input_time = 300 | ||
| + | </ | ||
| + | |||
| + | And, finally, in ''/ | ||
| + | |||
| + | < | ||
| + | pm = dynamic | ||
| + | pm.max_children = 200 | ||
| + | pm.start_servers = 20 | ||
| + | pm.min_spare_servers = 10 | ||
| + | pm.max_spare_servers = 20 | ||
| + | pm.max_requests = 500 | ||
| + | request_terminate_timeout = 0 | ||
| </ | </ | ||
| Line 1022: | Line 1059: | ||
| -- -- -- -- Miscellaneous Issues -- -- -- -- | -- -- -- -- Miscellaneous Issues -- -- -- -- | ||
| - | To test sieve logic and rules, do the following: | + | To test sieve' |
| + | su - username | ||
| + | cd ~/sieve | ||
| + | spamassassin -t -D < Amazon1.eml | ||
| + | # this ^^ gives you the headers / spamassassin scores in stdout | ||
| + | sieve-test -D -e roundcube.sieve Amazon3.eml | ||
| + | # this ^^ tests your sieve logic to see if the email goes in ham or spam | ||
| + | In the output that follows, look for something like the below. I put example output for each command above, respectively: | ||
| + | < | ||
| + | Content analysis details: | ||
| + | |||
| + | pts rule name description | ||
| + | ---- ---------------------- -------------------------------------------------- | ||
| + | 0.8 DKIM_ADSP_ALL | ||
| + | 0.0 SPF_HELO_NONE | ||
| + | -0.0 SPF_PASS | ||
| + | 0.2 BAYES_999 | ||
| + | [score: 1.0000] | ||
| + | 3.5 BAYES_99 | ||
| + | [score: 1.0000] | ||
| + | 2.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail | ||
| + | domains are different | ||
| + | 2.1 HTML_IMAGE_ONLY_12 | ||
| + | 0.0 HTML_EXTRA_CLOSE | ||
| + | 0.1 MIME_HTML_ONLY | ||
| + | 0.0 HTML_MESSAGE | ||
| + | 2.0 RDNS_DYNAMIC | ||
| + | dynamic-looking rDNS | ||
| + | 0.0 HTML_SHORT_LINK_IMG_2 | ||
| + | 3.6 HTML_TAG_BALANCE_CENTER Malformatted HTML | ||
| + | 0.4 HTML_MIME_NO_HTML_TAG | ||
| + | 1.0 GOOG_STO_IMG_HTML | ||
| + | URIBL | ||
| + | 1.2 DMARC_QUAR | ||
| + | 0.0 T_REMOTE_IMAGE | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | sieve-test: Debug: sieve: Commit fileinto action | ||
| + | sieve-test: Debug: sieve: fileinto action: Commit storing into mailbox ' | ||
| + | sieve-test: Info: sieve: msgid=< | ||
| + | info: msgid=< | ||
| + | sieve-test: Debug: sieve: Finished finalizing actions (status=ok, keep=none, committed=yes) | ||
| + | </ | ||
| ====== Part IX - What's next? ====== | ====== Part IX - What's next? ====== | ||
| Line 1039: | Line 1119: | ||
| I rewrote the mail server tutorial for the presentation [[https:// | I rewrote the mail server tutorial for the presentation [[https:// | ||
| - | --- // | + | --- // |