Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can anyone explain how I can place a filter or block list of email accounts I do not wish to be able to communicate with my email server? For example, I do not want anyone to be able to send and or receive email from *@aol.com using my MTA. Is there a way in Postfix I can block all SMTP traffic (in/out) to any or all AOL email accounts?
So w/o SA, there is no way to filter emails from any specific domain? I am testing this now now on my server to see if I can receive from Gmail and just not send and or both...
For inbound email, add a check_sender_access to your smtpd_recipient_restrictions to create a blacklists for senders from domains or addresses you wish to block:
Code:
main.cf:
smtpd_recipient_restrictions =
...
check_sender_access hash:/etc/postfix/sender_checks
permit_mynetworks
reject_unauth_destination
...
permit
sender_checks:
#
# WARNING - DO NOT PUT OKs IN HERE!! Creates Open Relay
#
aol\.com REJECT We don't allow mail from AOL
.aol\.com REJECT We don't allow mail from AOL
Chose the map type and syntax that suits you (hash, regexp, pcre, etc.)
For outbound email, you can create an AOL-specific transport that sends to error:
Code:
main.cf:
transport_maps = hash:/etc/postfix/transport
transport:
aol.com error:We do not allow sending to AOL
Now my question is when I create the file /etc/postfix/sender_checks, what do I need to do to make this a hash file? I don't think I need to postmap it, correct? I am still confused about the different types of files.
Postmap translates ASCII text files into a database format. This is required for hash, db, and dbm files, and any other file which is a "database" format. If you specify the files as regexp or pcre, you don't need to postmap, because the files are not database files, but are read directly.
If you are unsure of a table type, do a man on the table type, as in:
OK - Thanks for clearing that up for me. I was not sure when to use Postmap and when it is not needed...
So if I have a file called foo and foo.db and in my main.cf it is being called as regexp or pcre - then I don't need foo.db, correct? Is there a benefit to using one of the mentioned above? Seems like regexp would be preferred so you don't have to postmap anything when you make a change, right?
Right, with pcre/regexp, you just use the text file - no .db file required or used.
The choice of file types you use depends on what you are trying to do, and concerns about performance. Pcre is faster than regexp, so use pcre if you have pcre built in. Use hash's for longer lists, since db lookups are faster than long pcre or regexp lists. If you only have a few entires, the table choice doesn't matter much. Pick one that suits your needs.
For outbound email, you can create an AOL-specific transport that sends to error:
Code:
main.cf:
transport_maps = hash:/etc/postfix/transport
transport:
aol.com error:We do not allow sending to AOL
From above, does it matter where in the main.cf file I place the following?
Code:
transport_maps = hash:/etc/postfix/transport
I don't know if it matters but I sent it to the very last line on my main.cf file. Is that incorrect and does that need to go in a specific section like smtpd_sender_restrictions?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.