Configuring <application>Courier</application> Config files /etc/courier/authmysqlrc Configuration Information Make the following changes in this file if you are utilizing MySQL: MYSQL_SERVER localhost MYSQL_USERNAME courier MYSQL_PASSWORD (your choice) MYSQL_SOCKET /tmp/mysql.sock MYSQL_PORT 3306 MYSQL_DATABASE courier-mail MYSQL_USER_TABLE users MYSQL_CLEAR_PWFIELD clear DEFAULT DOMAIN (your domain) MYSQL_QUOTA_FIELD quota If you utilize PAM: cat > /etc/pam.d/esmtp << "EOF # 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 EOF cat > /etc/pam.d/pop3 << "EOF # 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 EOF cat > /etc/pam.d/imap << "EOF # 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 EOF cat > /etc/pam.d/webmail << "EOF # 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 EOF This command will create the mysql database for authentication: mysqladmin -uroot -p[password] create courier-mail This command 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 earilier in the authmysql file: mysql -uroot -p[password] mysql grant all privileges on *.* to courier@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/me cat > /etc/courier/me << "EOF" [servername.yourdomain] EOF /etc/courier/locals cat > /etc/courier/locals << "EOF" localhost [yourdomain] EOF /etc/courier/esmtpacceptmailfor.dir/system cat >/etc/courier/esmtpacceptmailfor.dir/system << "EOF" localhost [yourdomain] EOF You will also need to edit the aliases file and change the following entry. /etc/courier/aliases/system 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 ESMTPDSTART=YES /etc/courier/esmtpd-ssl ESMTPDSSLSTART=YES POP3/POP3-SSL Configuration This section will enable the POP3 Server from Courier /etc/courier/pop3d POP3DSTART=YES /etc/courier/pop3d-ssl POP3DSLLSTART=YES IMAP/IMAP-SSL Configuration This section will enable the IMAP Server from Courier /etc/courier/imapd IMAPDSTART=YES /etc/courierd/imapd-ssl 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 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@linuxfromscratch.org',' ','password','BLFS User',9000,9000,'/home/vmailman/blfsuser',''); 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/webmail to your cgi-bin directory of your Apache server. cp -a /usr/libexec/courier/webmail/webmail /var/www/cgi-bin You will then need to copy the images to a directory 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 Setup for Web-based Email This section will explain how to setup Courier Web-based administration system. You will need to copy the file webadmin from /usr/libexec/courier/webmail/webmin to your cgi-bin directory of your Apache server. cp -a /usr/libexec/courier/webmail/webadmin /var/www/cgi-bin /etc/courier/webadmin/password cat > /etc/courier/webadmin/password << "EOF" [password] EOF If you are not using SSL on your Apache server, you will need to add /etc/courier/webadmin/unsecureok, so you will be able to use your web based administration tool. touch /etc/courier/webadmin/unsecureok Courier init.d script The startup script from the Courier package is the easiest to use. It will automatically create missing data files, and SSL certificates if they are missing. To install the init.d file for Courier you will need to use the follow commands: cp /usr/src/courier-&courier-version;/courier.sysvinit /etc/rc.d/init.d/courier && chmod 755 /etc/rc.d/init.d/courier Create the symbolic links to this file in the relevant rc.d directory with the following commands: cd /etc/rc.d/init.d && ln -sf ../init.d/courier ../rc0.d/K25courier && ln -sf ../init.d/courier ../rc1.d/K25courier && ln -sf ../init.d/courier ../rc2.d/K25courier && ln -sf ../init.d/courier ../rc3.d/S35courier && ln -sf ../init.d/courier ../rc4.d/S35courier && ln -sf ../init.d/courier ../rc5.d/S35courier && ln -sf ../init.d/courier ../rc6.d/K25courier