cvs commit: hints courier.txt

timothy at linuxfromscratch.org timothy at linuxfromscratch.org
Wed Jul 16 06:59:35 PDT 2003


timothy     03/07/16 07:59:35

  Added:       .        courier.txt
  Log:
  Initial commit.
  
  Revision  Changes    Path
  1.1                  hints/courier.txt
  
  Index: courier.txt
  ===================================================================
  TITLE:          Courier Mail Server for LFS
  LFS VERSION:    any
  AUTHOR:         Jim Gifford <giffordj at linkline.com>
  
  SYNOPSIS:
          How to setup Courier Mail Server for LFS.
  
  HINT:
  $Id: courier.txt,v 1.1 2003/07/16 13:59:35 timothy Exp $
  
  courier-0.42.2
  Introduction to courier
  Download location (HTTP):       
  http://osdn.dl.sourceforge.net/sourceforge/courier/courier-0.42.2.tar.bz2
  Download location (FTP):        
  ftp://courier.sourceforge.net/courier/courier-0.42.2.tar.bz2
  Version used:                   0.42.2
  Package size:                   3.1 MB
  Estimated Disk space required:  55 MB
   
  
  The courier package contains a Mail Transport Agent (MTA). This is useful
  for sending email to other users of your host machine. It can also be 
  configured to be a central mail server for your domain or a mail relay agent.
  The courier packages also includes a web-based email interface, IMAP, IMAP-SSL,
  POP3, and POP3-SSL. The configuration listed below will allow users with PAM
  and virtual-users in a Mysql Database access to email.
  
  courier depends on:
  	db-4.0.14 expect-5.38(see below for installation information) 
  	Linux_PAM-0.77 apache openssl-0.97
  
  courier can utilize:
  	mysql-3.23.55 mysql-4.0.13 aspell-0.50.3
  
  Installation of courier
  
  	Before you compile the program, you need to create users and groups that
  	will be expected to be in place when the install script executes. Add
  	the users and groups with the following commands:
  
  	echo "courier:x:103:103:Courier Mail Server:/dev/null:/bin/false" >> /etc/passwd	
  	echo "courier:x:103:" >> /etc/group
  
  	You may change the 103 to your particular needs.
  
  Install courier by running the following commands:
  
  	./configure --prefix=/usr --sysconfdir=/etc/courier --with-piddir=/var/run \
  			--libexecdir=/usr/libexec --datadir=/usr/share/courier \
  			--localstatedir=/var/lib/courier --disable-root-check --with-db=db \
  	            --with-mailuser=courier --withmailgroup=courier \
  			--enable-workarounds-for-imap-client-bugs \
  			--with-ispell=/usr/bin/aspell
  	make &&
  	make install &&
  	make install-configure
  	
  	# Note - You may receive an error saying that the mime.types file could
  		   not be found. This can easily be corrected by adding
  		   --enable-mimetypes=(location of mime.types file)
  
  Configure authentication 
  
  	/etc/courier/authmysqlrc
  	
  	You will need edit the following entries
  	
  	MYSQL_SERVER		mysql.example.com
  	MYSQL_SERVER		localhost
  	
  	MYSQL_USERNAME		admin
  	MYSQL_USERNAME		courier
  	
  	MYSQL_PASSWORD		admin
  	MYSQL_PASSWORD		(your choice) (Remember this for the database config)
  
  	# MYSQL_SOCKET		/var/mysql/mysql.sock
  	MYSQL_SOCKET		/tmp/mysql.sock
  
  	MYSQL_PORT			0
  	MYSQL_PORT			3306
  
  	MYSQL_DATABASE		mysql
  	MYSQL_DATABASE		courier-mail
  
  	MYSQL_USER_TABLE		passwd
  	MYSQL_USER_TABLE		users
  
  	#MYSQL_CLEAR_PWFIELD	clear
  	MYSQL_CLEAR_PWFIELD	clear
  
  	#DEFAULT DOMAIN		example.com
  	DEFAULT DOMAIN		(your domain)
  
  	#MYSQL_QUOTA_FIELD	quota
  	MYSQL_QUOTA_FIELD		quota
  
  	PAM Configuration
  
  	/etc/courier/esmtp
  	
  	# Begin /etc/pam.d/esmtp
  
  	auth			required		pam_unix.so		try_first_pass
  	account		required		pam_unix.so
  	session		required		pam_unix.so
  
  	# End /etc/pam.d/esmtp
  
  	/etc/courier/pop3
  	
  	# Begin /etc/pam.d/pop3
  
  	auth			required		pam_unix.so		try_first_pass
  	account		required		pam_unix.so
  	session		required		pam_unix.so
  
  	# End /etc/pam.d/pop3
  
  	/etc/courier/imap
  	
  	# Begin /etc/pam.d/imap
  
  	auth			required		pam_unix.so		try_first_pass
  	account		required		pam_unix.so
  	session		required		pam_unix.so
  
  	# End /etc/pam.d/imap
  
  	/etc/courier/webmail
  	
  	# Begin /etc/pam.d/webmail
  
  	auth			required		pam_unix.so		try_first_pass
  	account		required		pam_unix.so
  	session		required		pam_unix.so
  
  	# End /etc/pam.d/webmail
  
  MySQL Configuration
  
  	This section will create the mysql database for authentication. 
  
  	mysqladmin -uroot -p{password} create courier-mail
  
  	This section will setup the table users for the courier-mail database.
  
  	mysql -uroot -p{password} courier-mail
  
  	CREATE TABLE users (
          id                    char(128) DEFAULT '' NOT NULL,
          crypt                 char(128) DEFAULT '' NOT NULL,
          clear                 char(128) DEFAULT '' NOT NULL,
          name                  char(128) DEFAULT '' NOT NULL,
          uid                   int(10) unsigned DEFAULT '65534' NOT NULL,
          gid                   int(10) unsigned DEFAULT '65534' NOT NULL,
          home                  char(255) DEFAULT '' NOT NULL,
          quota                 char(255) DEFAULT '' NOT NULL,
          KEY id (id(128))
  	);
  
  	This will add the courier user that we specified earlier in the authmysql file.
  
  	mysql -uroot -p{password} mysql
  
  	grant all privileges on *.* to courier at localhost identified by '{password}' 
  	with grant option;
  
  General Settings for Mail
  
  	You will need to create the following files with the contents specified.
  
  	/etc/courier/defaultdomain
  
  	cat > /etc/courier/defaultdomain << "EOF"
  	{yourdomain}
  	EOF
  
  	/etc/courier/locals
  
  	cat > /etc/courier/locals << "EOF"
  	localhost
  	{yourdomain}
  	.{yourdomain}
  	EOF
  
  	/etc/courier/esmtpacceptmailfor
  
  	cat > /etc/courier/esmtpacceptmailfor << "EOF"
  	localhost
  	{yourdomain}
  	.{yourdomain}
  	EOF
  
  	/etc/courier/hosteddomains
  	
  	cat > /etc/courier/hosteddomains << "EOF"
  	{yourdomain}
  	.{yourdomain}
  	EOF
  
  	You will also need to edit the aliases file and change the following entry.
  
  	/etc/courier/aliases/system
  
  	postmaster:
  	postmaster: {your adminstrator email}
  
  	If you want to deny access from some hosts from sending mail you will need
  	to edit the /etc/courier/smtpaccess/default.
  
  	After the above steps are completed you will need to run the following commands
  
  	makesmtpaccess
  	makehosteddomains
  	makealiases
  	
  SMTP/SMTMP-SSL Configuration
  
  	This section will enable the SMTP Server from Courier
  
  	/etc/courier/esmtpd
  
  	You will need edit the follow entries
  
  	ESMTPDSTART=NO
  	ESMTPDSTART=YES
  
  	/etc/courier/esmtpd-ssl
  
  	ESMTPDSSLSTART=NO
  	ESMTPDSSLSTART=YES
  
  POP3/POP3-SSL Configuration
  
  	This section will enable the POP3 Server from Courier
  
  	/etc/courier/pop3d
  
  	You will need edit the follow entries
  
  	POP3DSTART=NO
  	POP3DSTART=YES
  
  	/etc/courier/pop3d-ssl
  
  	POP3DSSLSTART=NO
  	POP3DSLLSTART=YES
  
  IMAP/IMAP-SSL Configruation
  
  	This seciton will enable the IMAP Server from Courierd
  
  	/etc/courier/imapd
  
  	You will need to edit the following entries
  
  	IMAPDSTART=NO
  	IMAPDSTART=YES
  
  	/etc/courierd/imapd-ssl
  
  	IMAPDSSLSTART=NO
  	IMAPDSSLSTART=YES
  
  Creating Maildirectories for System Users
  
  	This section will explain on how to create MailDirs for your system users.
  
  	cd /home/{username}
  	maildirmake Maildir
  	chown {username}.{username} Maildir -R
  
  Setup for Virtual users
  
  	This section will explain how to setup Maildir for your virtual users.
  
  	echo "vmailman:x:9000:9000:Virtual Mailman:/home/vmailman:/bin/bash" >> /etc/passwd
  	echo "vmailman:x:9000:" >> /etc/group
  
  	You may change the 9000 to your particular needs.
  
  	Now to setup the maildir for these virutal users.
  
  	cd /home/vmailman
  	mkdir {virtual_user}
  	cd {virtual_user}
  	maildirmake Maildir
  	chown vmailman.vmailman Maildir -R
  
  	Add the virtual user to the MySQL database. You need to enter at least on version of the 
  	password either clear text or encrypted.
  
  	mysql -ucourier -p{password} courier-mail
  
  	insert into users values('{virtual_users}@{domain.com},'{encrypted password or blank}',
                                 '{clear text password or blank}','{User's Name}',9000,9000,
  				       '{location of Maildir}','{Quota in Bytes'});
  
  	example
  
  	insert into users values ('blfsuser at linuxfromscratch.org','','password','BLFS User',9000
  					  ,9000,'/home/vmailman/blfsuser','');	
  
  Setup for Mail Drop Procedures
  
  	This section will give examples on how to setup Maildrop with Courier.
  
  	If you use this feature, you will need to edit your /etc/courier/courierd file and
  	change the line DEFAULTDELIVERY=./Maildir to DEFAULTDELIVERY="| /usr/bin/maildrop".
  	
  	Remember if you are using folders, you will need to create them using the command
  	maildirmake .(Foldername) the . is required. For example if you need to create a folder
  	named ISP1 for the user jeff, you would follow this procedure.
  
  	cd /home/jeff/Maildir
  	maildirmake .ISP1
  	chown jeff.jeff .ISP1 -R
  
  	For Global MailDrop procedures, you will need to create the file
  	/etc/courier/maildroprc.
  
  	Here is an example of a maildroprc file. These rules will work globally.
  
  	# Global maildrop filter
  
  	# Global Variables
  	#
  	DEFAULT="$HOME/Maildir"
  	LOGDIR="$HOME/log"
  
  	# Log File
  	#
  	logfile "$LOGDIR/maildroprc.log"
  
  	# Drop anything listed as a Virus into .Virus
  	#
  	if (/^Subject:.*VIRUS FROM*/)
  	        to "$DEFAULT/.Virus/"
  
  	# Drop anything listed as Spam into .Spam
  	#
  	if (/^X-Spam-Flag: *YES/)
        	  to "$DEFAULT/.Spam/"
  
  
  	For Individual Maildrop procedures, you will need to create the file ~/.mailfilter.
  	You can use Global and Individual Maildrop procedures. 
  
  	Here is an example of a .mailfilter file. These rules will work on a individual basis.
  
  	# Begin /~/.mailfilter
  
  	# Local maildrop filter
  
  	# Global Variables
  	#
  	DEFAULT="$HOME/Maildir"
  	LOGDIR="$HOME/log"
  
  	# Log File
  	#
  	logfile "$LOGDIR/maildroprc.log"
  
  	# ISP1 Email into File ISP1
  	#
  	if (/^(To|[Cc][Cc][Mail-Followup-to]):.*userfrom at isp1.com*/)
        	  to "$DEFAULT/.ISP1/"
  
  	# Courier Maillist into Folder Courier
  	#
  	if (/^List-Post:.*courier-users at lists.sourceforge.net*/)
        	  to "$DEFAULT/.Courier/"
  
  
  
  # End /~/.mailfilter
  
  
  Setup for Web-based Email
  
  	This section will explain how to setup Courier Web-based email system.
  
  	You will need to copy the file webmail from /usr/libexec/courier/webmail to your cgi-bin
  	directory of you Apache server.
  
  	cp -a /usr/libexec/courier/webmail /var/www/cgi-bin
  
  	You will then need to copy the images to a folder under your htdocs directory of your
  	Apache server. The directory needs to be named webmail or you need to specify it during
  	the configure phase with --enable-imageurl=/url.
  
  	cp -a /usr/share/courier/sqwebmail/images /var/www/htdocs/webmail
  
  
  -----Expect 5.38-----
  
  	This section will explain how to setup expect for Webadmin and Webmail.
  
  Download location (FTP):        ftp://expect.nist.gov/expect.tar.gz
  Version used:                   5.38
  Package size:                   505 KB
  Estimated Disk space required:  5 MB
  
  Introduction to expect
  
  Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck,
  rlogin, tip, etc. Expect really makes this stuff trivial. Expect is also useful for testing 
  these same applications. And by adding Tk, you can also wrap interactive applications in 
  X11 GUIs. 
  
  Install expect by running the following commands:
  
  	./configure --prefix=/usr --with-tcl=/usr/lib --with-tclinclude=/usr/include/tcl
  	make &&
  	make install &&
  	
  	# Note - If you also have tk installed, you can add --with-tk=/usr/lib\
  		   --with-tkinclude=/usr/include/tk
  
  ----Amavis 0.312----
  
  	To use amavis with Courier you will need to download the patch at
  	http://www.jg555.com/projects/patches/amavis.php	
  
  
  
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe hints' in the subject header of the message



More information about the hints mailing list