Front | News | Features | Tutorials | Security | Resources | Contribute | Write for us
BSD Today
Your Daily Source for BSD News and Information


Internet News
Internet Stocks/VC
Internet Technology
Windows Internet Tech.
Linux/Open Source
Web Developer
ECommerce/Marketing
ISP Resources
ASP Resources
Wireless Internet
Downloads
Internet Resources
Internet Lists
International

Search internet.com
Advertising Info
Corporate Info


Be a Commerce Partner
Software Store
Computer Help
Register Domains
Internet Jobs
Map Your Website
Rent E-mail Lists
Bookstore
Press Release dist.
Internet Research
Venture Capital
Web Publishing
Build Your Intranet
Ask an Expert
Get e-Biz Intell.
Content for Websites
Build Sticky eStores
Advertise a Coupon
Promotional Products
Accept Credit Cards
Download Solutions
Shopping Cart
fax & vmail for free
Hardware Store
PDA Time Tracking
News to Your Desktop
Small Biz Purchasing
B2B Directory/Search
Freelancers
Site Search Solutions
Hosting Services
Get Calls Online
Business Banking
Free Disk Space
Search for a Web Host
Continuing Education
IT Products and Svcs
Offer Free Email
Survey Your Web Users

   

Using Postfix
(Page 2)

By Alan P. Laudicina

Previous Page: Introduction, Configuration and Compilation.

Installation

After the configuration and compilation of Postfix, installation is the last step. To install Postfix on a BSD machine, you must first move the sendmail binaries so that you can replace the files without overwriting them. To do this you can su to root and execute the following commands:

# mv /usr/sbin/sendmail /usr/sbin/sendmail.old
# mv /usr/bin/mailq /usr/bin/mailq.old
# mv /usr/bin/newaliases /usr/bin/newaliases.old
# chmod 755 /usr/sbin/sendmail.old /usr/bin/mailq.old /usr/bin/newaliases.old

Note: After a make world to your BSD system, the Postfix binaries will be replaced with sendmail libraries. This makes it a very good idea to not delete the Postfix source tree after compilation, so in the future after a make world you can always come back and repeat the steps for the installation of the Postfix binaries listed above.

Mail Wrappers

Some BSD machines may pack with a mail wrapper. It is used so that you can easily have several MTAs installed at the same time. The mail wrapper is not required, but if you plan to use it, you should definitely read the mailwrapper(8) and mailer.conf(5) man pages. Instead of replacing the sendmail binaries, you could simply setup the /etc/mailer.conf (or /etc/mail/mailer.conf) with something like:

     # Emulate sendmail using postfix
     sendmail        /usr/libexec/postfix/sendmail
     send-mail       /usr/libexec/postfix/sendmail
     mailq           /usr/libexec/postfix/sendmail
     newaliases      /usr/libexec/postfix/sendmail

After the installation of the Postfix binaries you must create the user that postfix will run as. This user is to be named 'postfix' and have a unique user and group id, with a non-existent shell (so that nobody can login to the account for security reasons), the account does not require to have an existing home directory either. To add the account to my machine, I executed the following commands:

# echo "postfix:*:33333:33333:Postfix Mail Daemon:/nonexistant:/sbin/nologin" >> \
  /etc/passwd
# echo "maildrop:*:33335:" >> /etc/group

(Before you add the 'postfix' user and the 'maildrop' group, you may want to make sure the uid and gid I use are available. To do this look through the /etc/passwd and /etc/group files with a command like more /etc/passwd or more /etc/group You may also use the adduser(8) command.)

After you add the user that the mail daemon will run as, it is a good idea to forward all that user's email to root. We do this because nobody can login as the user postfix, so it is a good idea to forward any email it gets to root. Here is how you add the alias:

# echo "postfix: root" >> /etc/aliases
Now comes a decision for the person who is installing postfix from the directions I am giving. If a world-writable maildrop is okay with you, you can skip the next section and go to the "sh INSTALL.sh" section. If you want to protect the maildrop directory, read the following section.

Protecting your Maildrop directory

By default, postfix installs with a world-writable, mode 1733, sticky maildrop so that local users can submit mail. Well this method avoids using set-[gu]id software, it is usually a bad idea if you have some annoying lusers. The world-writable maildrop would allow those users to fill the maildrop directory with masses of garbage and possibly crash the mail system. So to avoid this, we will add another group that is unique suck as the 'postfix' group. You can do this with the following command:

# echo "maildrop:*:33335:" >> /etc/group
After you add the maildrop group, you can proceed to the next section.

sh INSTALL.sh

If you have made it this far, you are ready to start the "real" installation program. You can do this by going to the top level directory of the postfix source and executing the following command:

# sh INSTALL.sh
This will run you through a script that will ask for input. The defaults are fine here until you get the the "setgid: [no]" option. When you get here if you followed section 5, then you want to replace the no by typing "maildrop" and then pressing enter. If you skipped section 5 and are installing with a non-protected maildrop directory, then you can just leave this with the default "no" option. After this step the "manpages" option should also be left with the default selection.

Replacing sendmail forever

This document teaches how to replace sendmail forever on the BSD system. To do this we are going to need to kill the sendmail daemon and restart it so that it only sends out the messages it may have queued. To do this you want to execute the following commands:
# kill -9 `ps ax | grep '[s]endmail' | awk '{ print $1 }'`
# /usr/sbin/sendmail.old -q
# postfix start
Postfix can be started using the same syntax as sendmail, so it is not required to change the /etc/rc.conf file. When first run you should watch the syslog for complaints from Postfix. Since we changed the main.cf file previously, you should now have a completely running mail daemon. You can find all the configuration files in /etc/postfix. When you modify any of these files you must reload the daemon using postfix reload as root.

Alan P. Laudicina attends Assumption College School in Windsor, Ontario, Canada. He runs a website called "UnixPower", located at http://www.unixpower.org/ and is the founder of the Windsor Unix Users Group. He can be contacted by email at alanp@unixpower.org

More Info
Postfix website

  Talkbacks
Please share your comments.

Name:

Email:

Subject:

Message:

Not overwriting sendmail when doing a make world - Alan P. Laudicina
FreeBSD port - make replace - Andrew J. Caines

Not overwriting sendmail when doing a make world
Alan P. Laudicina - September 07, 2000 20:49:13
There are other ways of not overwriting sendmail when doing a 'make world'. One such way would be to put "NO_SENDMAIL=true" in the /etc/make.conf file.

FreeBSD port - make replace
Andrew J. Caines - September 12, 2000 20:59:34
As well as adding "NO_SENDMAIL=true" in the /etc/make.conf to prevent a future world build from nuking anything, the port build includes the "replace" target to change a system running sendmail to one running postfix. After "make install", just type "make replace".

A small point of order: "kill -9" really should be a last resort and almost never a first. Since I'm quibbling, don't "grep re | awk {...}", instead use "awk /re/{...}".

-Andrew-

Weekly BSD News

The Linux Channel at internet.com
Linux Planet
Linux Central
Linuxnewbie.org
PHPBuilder
Just Linux
Linux Programming
Linux Start
LinuxApps.com
Linux Today
Enterprise Linux Today
AllLinuxDevices
Apache Today
Linux/Open Source Jobs
SITE DESCRIPTIONS

  Back to top updated: September 06, 2000 22:42:25   

Copyright © 2000 Internet.com Corp. All rights reserved.
Legal Info | Privacy Policy