![]() |
Now serving 108 guides. |
|
Installing and Configuring Postfix General Information Postfix is an attempt to provide an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and (hopefully) secure, while at the same time being sendmail-compatible enough to not upset your users.Installation Installation Is simple and easy.. So let's get started.
Configuration main.cf Now lets configure this puppy. Thanks to elmore at screamingelectron.org for providing the configuration we will be using here. Let's start off by going into your postfix directory and editing main.cf with your favorite editor.
The next line to modify is:
The next line to look at is the following line:
The next line to modify is the following:
Moving on, the next line I modify is the following:
Moving right along the next line I modify is the:
Now, modify the following:
This brings us to the next lines to modify:
I actually insert the next lines into the file. They are for the canonical maps, you'll need these if the following are true:
The following lines I also add, you may or may not want to add these. It depends on how true you want to be to to the rfc and how strict you want to be on other hosts trying to send mail to you. These lines will lay down the framework for cutting down on your spam!
The first section specifies rejection if a client is not in an access list. An access list is a list I use which details the exact usernames on the box. This list is a necessity if you are running virtual domains, if you don't use it userid1@virtualdomain1 can receive an e-mail to userid1@virtualdomain2 and so on and so forth. This is the most efficient way I know to block this! It is also a good practice to do even if you aren't running virtual domains (opinion). It also specifies a lookup to the rbl list (a real time black hole list for open-relay mail servers). It also does not allow unauthorized pipelining, not exactly sure why that's needed but it is. If you know, let me know! The second section does much of the same but is it for outside connections -- people trying to send mail in. It specifies a regular expression file which sorts through the headers and looks for junk, the access list, it rejects mail from computers that don't have a fqdn it also reject is it can't get the computer hostname through nslookup, it also rejects via the rbl list and the pipelining again. The next section is a lot more of the same. Nothing really new to explain here. The next line I add is my rbl line, defining what list to use. I personally use the ordb list that can be found at http://ordb.org.
The Access file This file is the definitive list as that decides who to accept incoming mail from the Internet for. If you defined it earlier in the main.cf file it must be defined here. Basic syntax is one user per line followed by an OK so edit/etc/postfix/access now
etc. etc. Now for a little postfix sorcery, don't specify an account if you don't want them to have the ability to receive Internet mail. For instance, if you only want the ability for someone to mail local accounts (accounts only contained on your box), leave them out of here. Also, if you are running lots of Virtual domains, you may want to specify system account for each domain, like:
CANONICAL FILES The next files we'll look at are,/usr/local/etc/postfix/canonical and /usr/local/etc/postfix/canonical-receive. Again, if you're not using canonical tables specified in your main.cf file, you don't need to worry about it here.canonical The canonical file as defined in this how-to will remap a users e-mail from the default domain to the appropriate virtual domain, if this is the case you need to specify all users except those in the default domain of the box here! Also, if you are mapping a local account to use another name likeuserid1 -> full.name then you need to specify that here. Syntax is: userid@domain userid@virtualdomain, or, userid@domain full.name@domain this file handles mail outgoing only! Edit /etc/postfix/canonical now
canonical-receive This file is used for incoming mail to clean up so that the virtual addresses don't get remapped to the default domain. All users should have an entry here including system accounts unless they are on the default domain of the box alone, and not using virtual usernames. With that let's edit/usr/local/etc/postfix/canonical-receive now.
CLIENT_ACCESS The next file we'll be looking at is the/usr/local/etc/postfix client_access file. This file will specify a list of exceptions and specific denials of mail servers. For instance, your friend, God bless him, has a mail server but is pretty clueless when it comes to dns. He hasn't configured his dns to reverse lookup properly. Well, you could bypass that here. Also, you have some evil spammer that keeps sending you mail and the rbl list isn't blocking him, you could add a specific block here. Syntax of this file is xxx.xxx.xxx.xxx function where x is an ip address and function is either OK or REJECT.
SENDER_ACCESS This file/usr/local/etc/postfix/sender_access is where you can specify specific e-mail addresses or domain to block -- usually bogus spam addresses. Syntax is fakeemail@bogusdomain.com function where the function is a reject code.
BODY_CHECKS The next file we'll be looking at is/usr/local/etc/postfix/body_checks. This file is either a regex file or a pcre file (if you compiled postfix with pcre support). I mainly use this file to block troublesome attachments I have no use for anyways. The following blocks certain types of attachments. Self-explanatory.
HEADER_CHECKS The next file we'll take a look at is/usr/local/etc/postfix/header_checks. This file does exactly as it says -- it checks mail headers. Again, either regex or pcre. I will give a couple of examples here that I use:
REGEXP_ACCESS The next file to look at is/usr/local/etc/postfix/regexp_access. This file pretty much does some more of the same -- kicking spammers where it hurts! Here is an example I have in mine.
ALIASES Lets edit/etc/aliases
The aliases file is very limited with the configuration we have specified here. It does need some things filled in. Standard system aliases should be placed here: aliases for root, postmaster, abuse, etc. etc. Also if you are running majordomo you'll specify your outgoing secrets here. If you're forwarding mail to another domain and not using a .forward file in your home, specify that here as well. Other than that you should be good to go. After editing the aliases file you should run the command newaliases to tell the system there's new content in that file.
Starting Postfix Ok now our configuration is complete, let's start up postfix! Run the following:
References And Source Of Article: ScreamingElectron Author: Leigh Renfrow 2 Comments Posted by as2sb3100 on July 25, 2005 at 9:26:41 pm EEST
I think you need to disable sendmail. I don't know if you have to, or even if you need to, but I did. just add sendmail_enable="NONE" to rc.conf and there ya go. Also, make sure that /usr/local/etc/rc.d/postfix.sh doesnt have .sample on the end. Otherwise youl have to manualy start postfix everytime the system is booted.
Also, it'd be nice to see pop3 and/or imap included in this guide. Qpopper isnt very hard to install. Qmailrocks.org has an awsome guide for installing qmail and every other feature for it, however it's long and you don't learn much because they have created a bunch of scripts that do it all for you. Posted by soup4you2 on July 25, 2005 at 9:26:41 pm EEST
Once you install postfix it updates the /etc/mail/mailer.conf so you do retain the SENDMAIL="YES" values in the /etc/rc.conf, the rc.d script will read that and execute the applications stated inside the mailer.conf. But thats all on how you install it, it gives you the option to use the mailer.conf or a rc script.
|
Copyright 2003 - 2010 BSD Guides. All rights reserved. |
About | Terms of Use | Privacy | Contact |

