postfix_smtp
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
postfix_smtp [2022/07/19 19:52] – created 85.134.209.200 | postfix_smtp [2022/07/21 18:50] (current) – admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Postfix_SMTP | + | ===== Postfix_SMTP ===== |
- | ====== Install as per normal ====== | + | ==== Install as per normal ==== |
+ | < | ||
| | ||
| | ||
- | After Install - Main folder = / | + | </ |
+ | |||
+ | After Install - Main folder = / | ||
Main file = main.cf | Main file = main.cf | ||
- | ======Basic Changes: | + | ====Basic Changes: |
+ | < | ||
Just the name used to identify server | Just the name used to identify server | ||
- | | + | |
- | < | + | # disable lookup of usernames |
| | ||
| | ||
+ | </ | ||
- | ====== Advanced Changes: | + | ==== Advanced Changes: ==== |
<del> | <del> | ||
- | =====To prevent cross over emails between multiple domains,===== | + | ===To prevent cross over emails between multiple domains,=== |
e.g. where root@mydomain1.net and root@mydomain2.net are on the same server. | e.g. where root@mydomain1.net and root@mydomain2.net are on the same server. | ||
Add the following line into / | Add the following line into / | ||
Line 32: | Line 37: | ||
===== Handle email from Multiple Domains ===== | ===== Handle email from Multiple Domains ===== | ||
+ | < | ||
vi / | vi / | ||
- | < | + | #add in the following: |
| | ||
| | ||
Line 39: | Line 45: | ||
mkdir / | mkdir / | ||
vi / | vi / | ||
- | < | + | #add in: |
# Kartbuilding.net mail | # Kartbuilding.net mail | ||
/ | / | ||
Line 47: | Line 53: | ||
| | ||
/ | / | ||
+ | |||
+ | </ | ||
Save and restart postfix. Now the server will handle mail for this domain. No other config required in main.cf. It will deliver it to the localusername or forward it. If an email is sent and isn't matched a 550 will be sent back. This is miles better that the previous postfix/ | Save and restart postfix. Now the server will handle mail for this domain. No other config required in main.cf. It will deliver it to the localusername or forward it. If an email is sent and isn't matched a 550 will be sent back. This is miles better that the previous postfix/ | ||
Line 54: | Line 62: | ||
===== Restrict Mail delivery to Local users ===== | ===== Restrict Mail delivery to Local users ===== | ||
On a lists (mailman) server I run - I want to disable mail delivery to local users, however I still want Postfix to deliver mail to / | On a lists (mailman) server I run - I want to disable mail delivery to local users, however I still want Postfix to deliver mail to / | ||
+ | < | ||
| | ||
+ | </ | ||
===== Blocking Spam with spamhaus and Postfix ===== | ===== Blocking Spam with spamhaus and Postfix ===== | ||
This is commonly referred to as a " | This is commonly referred to as a " | ||
+ | < | ||
| | ||
- | < | + | #If there are entries already - thats fine, just comment delimit them. |
- | < | + | #Note: sbl-xbl.spamhaus.org has now changed to zen.spamhaus.org as per http:// |
- | The sender is then bounced back an email saying " | + | </ |
+ | |||
+ | The sender is then bounced back an email saying " | ||
**Note:** "ping sbl-xbl.spamhaus.org" | **Note:** "ping sbl-xbl.spamhaus.org" | ||
- | **Note:** Make sure ICMP packets are allowed through the firewall. Otherwise postfix will get a " | + | **Note:** Make sure ICMP packets are allowed through the firewall. Otherwise postfix will get a " |
See more details at: http:// | See more details at: http:// | ||
- | Further Info on UCE and Postfix:< | + | Further Info on UCE and Postfix: |
+ | <code> | ||
| | ||
| | ||
| | ||
+ | </ | ||
I have found that blocking mails via DNSBL at " | I have found that blocking mails via DNSBL at " | ||
==== Testing zen.spamhaus.org ==== | ==== Testing zen.spamhaus.org ==== | ||
+ | < | ||
Link: http:// | Link: http:// | ||
+ | </ | ||
Simply send an email to the appropriate address on the above website, and it will reply an automated email with the status of whether your email server is blocking correctly using zen.spamhaus.org | Simply send an email to the appropriate address on the above website, and it will reply an automated email with the status of whether your email server is blocking correctly using zen.spamhaus.org | ||
Line 81: | Line 100: | ||
====== Debugging and Testing via Telnet ====== | ====== Debugging and Testing via Telnet ====== | ||
SENDING AN EMAIL VIA TELNET 25 & Testing forwarding | SENDING AN EMAIL VIA TELNET 25 & Testing forwarding | ||
+ | < | ||
mail from: sri@mara.net | mail from: sri@mara.net | ||
rcpt to: user@lastre.com | rcpt to: user@lastre.com | ||
Line 86: | Line 106: | ||
. | . | ||
quit | quit | ||
+ | </ | ||
If you get "503 5.5.2 Send hello first", | If you get "503 5.5.2 Send hello first", | ||
Line 92: | Line 113: | ||
Had to adjust /etc/hosts with domain name (this allowed sending emails ok): | Had to adjust /etc/hosts with domain name (this allowed sending emails ok): | ||
+ | < | ||
| | ||
| | ||
+ | </ | ||
Good URLS | Good URLS | ||
Line 105: | Line 128: | ||
====== Managing Postfix ====== | ====== Managing Postfix ====== | ||
===== Delete an Email from the Queue ===== | ===== Delete an Email from the Queue ===== | ||
- | For Example - sending an email to someone and it bounces. | + | For Example - sending an email to someone and it bounces. |
+ | < | ||
| | ||
+ | </ | ||
Tons more info at: http:// | Tons more info at: http:// | ||
Line 112: | Line 137: | ||
===== Delete all Deferred Emails from the Queue ===== | ===== Delete all Deferred Emails from the Queue ===== | ||
If spam emails are been sent and/or your mail queue fills up, you can delete all deferred emails with the following: | If spam emails are been sent and/or your mail queue fills up, you can delete all deferred emails with the following: | ||
+ | < | ||
| | ||
+ | </ | ||
===== Checking Mail logs with pflogsumm ===== | ===== Checking Mail logs with pflogsumm ===== | ||
Line 130: | Line 157: | ||
* smtp delivery failures | * smtp delivery failures | ||
* Warnings | * Warnings | ||
+ | < | ||
| | ||
| | ||
+ | </ | ||
It is a very useful tool and shows an excellent insight into mail delivery and sending on your server. | It is a very useful tool and shows an excellent insight into mail delivery and sending on your server. | ||
===== Show Mail Queue ===== | ===== Show Mail Queue ===== | ||
If mails are deferred etc. and you want to see a list of them: | If mails are deferred etc. and you want to see a list of them: | ||
+ | < | ||
| | ||
+ | </ | ||
- | ====== Install Postfix for sending mail via relayhost | + | ===== Install Postfix for sending mail via relayhost ===== |
On one server, I want it to be only able to send emails only. Therefore the following config will bind it to 127.0.0.1 on port 25. It will also be sending emails using a "smart host". Below are the uncommented lines only in main.cf: | On one server, I want it to be only able to send emails only. Therefore the following config will bind it to 127.0.0.1 on port 25. It will also be sending emails using a "smart host". Below are the uncommented lines only in main.cf: | ||
+ | < | ||
vi / | vi / | ||
| | ||
Line 154: | Line 186: | ||
| | ||
| | ||
+ | </ | ||
It must also be checked on mail.burkesys.com that thunder is allowed to relay emails. | It must also be checked on mail.burkesys.com that thunder is allowed to relay emails. | ||
+ | |||
+ | ===== Debian Bullseye Config ===== | ||
+ | After a new install of debian bullseye, and after setup or [[courier_imaps_server_-_maildir|courier]] and procmail, the following is the config lines added to main.cf (Note: there were minor mods added further for sasl [[setup-config-debian-bullseye# | ||
+ | < | ||
+ | disable_vrfy_command = yes | ||
+ | message_size_limit = 30720000 | ||
+ | smtpd_recipient_restrictions = permit_mynetworks, | ||
+ | permit_sasl_authenticated, | ||
+ | reject_unauth_destination, | ||
+ | reject_rbl_client bl.spamcop.net, | ||
+ | reject_rbl_client zen.spamhaus.org | ||
+ | |||
+ | virtual_maps = regexp:/ | ||
+ | regexp:/ | ||
+ | virtual_alias_domains = kartbuilding.net, | ||
+ | home_mailbox = Maildir/ | ||
+ | mailbox_command = / | ||
+ | </ |
postfix_smtp.1658260370.txt.gz · Last modified: 2022/07/19 20:13 (external edit)