mirror of
https://github.com/Zeckmathederg/glfs.git
synced 2025-02-01 04:52:12 +08:00
2f473b244e
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1880 af4574ff-66df-0310-9fd7-8a98e5e911e0
293 lines
11 KiB
XML
293 lines
11 KiB
XML
<sect2>
|
|
<title>Configuring <application>Courier</application></title>
|
|
|
|
<sect3><title>Config files</title>
|
|
<para><filename>/etc/courier/authmysqlrc</filename></para>
|
|
</sect3>
|
|
|
|
<sect3><title>Configuration Information</title>
|
|
|
|
<para>Make the following changes in this file if you are utilizing
|
|
<application>My<acronym>SQL</acronym></application>:</para>
|
|
<screen><userinput>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</userinput></screen>
|
|
|
|
|
|
<para>If you utilize <application>PAM</application>:</para>
|
|
<screen><userinput><command>cat > /etc/pam.d/esmtp << "EOF</command>
|
|
# 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
|
|
<command>EOF
|
|
cat > /etc/pam.d/pop3 << "EOF</command>
|
|
# 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
|
|
<command>EOF
|
|
cat > /etc/pam.d/imap << "EOF</command>
|
|
# 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
|
|
<command>EOF
|
|
cat > /etc/pam.d/webmail << "EOF</command>
|
|
# 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
|
|
<command>EOF</command></userinput></screen>
|
|
|
|
<para>This command will create the mysql database for authentication:</para>
|
|
|
|
<screen><userinput><command>mysqladmin -uroot -p<replaceable>[password]</replaceable> create courier-mail</command></userinput></screen>
|
|
|
|
<para>This command will setup the table users for the courier-mail
|
|
database:</para>
|
|
|
|
<screen><userinput><command>mysql -uroot -p<replaceable>[password]</replaceable> 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))
|
|
);</command></userinput></screen>
|
|
|
|
<para>This will add the courier user that we specified earlier in the
|
|
authmysql file:</para>
|
|
|
|
<screen><userinput><command>mysql -uroot -p<replaceable>[password]</replaceable> mysql
|
|
|
|
grant all privileges on *.* to courier@localhost identified by '<replaceable>[password]</replaceable>' with grant option;</command></userinput></screen>
|
|
|
|
|
|
<para><emphasis>General Settings for Mail</emphasis></para>
|
|
|
|
<para>You will need to create the following files with the contents
|
|
specified.</para>
|
|
|
|
<para><filename>/etc/courier/defaultdomain</filename></para>
|
|
|
|
<screen><userinput><command>cat > /etc/courier/defaultdomain << "EOF"</command>
|
|
<replaceable>[yourdomain]</replaceable>
|
|
<command>EOF</command></userinput></screen>
|
|
|
|
<para><filename>/etc/courier/me</filename></para>
|
|
|
|
<screen><userinput><command>cat > /etc/courier/me << "EOF"</command>
|
|
<replaceable>[servername.yourdomain]</replaceable>
|
|
<command>EOF</command></userinput></screen>
|
|
|
|
<para><filename>/etc/courier/locals</filename></para>
|
|
|
|
<screen><userinput><command>cat > /etc/courier/locals << "EOF"</command>
|
|
localhost
|
|
<replaceable>[yourdomain]</replaceable>
|
|
<command>EOF</command></userinput></screen>
|
|
|
|
<para><filename>/etc/courier/esmtpacceptmailfor.dir/system</filename></para>
|
|
|
|
<screen><userinput><command>cat >/etc/courier/esmtpacceptmailfor.dir/system << "EOF"</command>
|
|
localhost
|
|
<replaceable>[yourdomain]</replaceable>
|
|
<command>EOF</command></userinput></screen>
|
|
|
|
<para>You will also need to edit the aliases file and change the
|
|
following entry.</para>
|
|
|
|
<para><filename>/etc/courier/aliases/system</filename></para>
|
|
|
|
<screen><userinput>postmaster: <replaceable>[your administrator email]</replaceable></userinput></screen>
|
|
|
|
<para>If you want to deny access from some hosts from sending mail you
|
|
will need to edit the <filename>/etc/courier/smtpaccess/default</filename>.</para>
|
|
|
|
<para>After the above steps are completed you will need to run the
|
|
following commands:</para>
|
|
|
|
<screen><userinput><command>makesmtpaccess
|
|
makehosteddomains
|
|
makealiases</command></userinput></screen>
|
|
|
|
<para><emphasis><acronym>SMTP</acronym>/<acronym>SMTMP</acronym>-<acronym>SSL
|
|
</acronym> Configuration</emphasis></para>
|
|
|
|
<para>This section will enable the <acronym>SMTP</acronym> Server from Courier</para>
|
|
|
|
<para><filename>/etc/courier/esmtpd</filename></para>
|
|
|
|
<screen><userinput>ESMTPDSTART=YES</userinput></screen>
|
|
|
|
<para><filename>/etc/courier/esmtpd-ssl</filename></para>
|
|
|
|
<screen><userinput>ESMTPDSSLSTART=YES</userinput></screen>
|
|
|
|
<para><emphasis><acronym>POP</acronym>3/<acronym>POP</acronym>3-<acronym>SSL
|
|
</acronym> Configuration</emphasis></para>
|
|
|
|
<para>This section will enable the <acronym>POP</acronym>3 Server from
|
|
Courier</para>
|
|
|
|
|
|
<para><filename>/etc/courier/pop3d</filename></para>
|
|
|
|
<screen><userinput>POP3DSTART=YES</userinput></screen>
|
|
|
|
<para><filename>/etc/courier/pop3d-ssl</filename></para>
|
|
|
|
<screen><userinput>POP3DSLLSTART=YES</userinput></screen>
|
|
|
|
<para><emphasis><acronym>IMAP</acronym>/<acronym>IMAP</acronym>-<acronym>SSL
|
|
</acronym> Configuration</emphasis></para>
|
|
|
|
<para>This section will enable the <acronym>IMAP</acronym> Server from
|
|
Courier</para>
|
|
|
|
<para><filename>/etc/courier/imapd</filename></para>
|
|
|
|
|
|
<screen><userinput>IMAPDSTART=YES</userinput></screen>
|
|
|
|
<para><filename>/etc/courierd/imapd-ssl</filename></para>
|
|
|
|
<screen><userinput>IMAPDSSLSTART=YES</userinput></screen>
|
|
|
|
<para><emphasis>Creating Mail directories for System Users</emphasis></para>
|
|
|
|
|
|
<para>This section will explain on how to create MailDirs for
|
|
your system users.</para>
|
|
|
|
<screen><userinput><command>cd /home/<replaceable>[username]</replaceable>
|
|
maildirmake Maildir
|
|
chown <replaceable>[username]</replaceable>.<replaceable>[username]</replaceable> Maildir -R</command></userinput></screen>
|
|
|
|
<para><emphasis>Setup for Virtual users</emphasis></para>
|
|
|
|
<para>This section will explain how to setup Maildir for your virtual
|
|
users.</para>
|
|
|
|
<screen><userinput><command>echo "vmailman:x:9000:9000:Virtual Mailman:/home/vmailman:/bin/bash" >> /etc/passwd
|
|
echo "vmailman:x:9000:" >> /etc/group</command></userinput></screen>
|
|
|
|
<para>Now to setup the maildir for these virtual users.</para>
|
|
|
|
<screen><userinput><command>cd /home/vmailman
|
|
mkdir <replaceable>[virtual_user]</replaceable>
|
|
cd <replaceable>[virtual_user]</replaceable>
|
|
maildirmake Maildir
|
|
chown vmailman.vmailman Maildir -R</command></userinput></screen>
|
|
|
|
<para>Add the virtual user to the <application>My<acronym>SQL</acronym></application> database. You need to enter at
|
|
least on version of the password either clear text or encrypted.</para>
|
|
|
|
<screen><userinput><command>mysql -ucourier -p<replaceable>[password]</replaceable> courier-mail
|
|
|
|
insert into users values('<replaceable>[virtual_users]</replaceable>@<replaceable>[domain.com]</replaceable>,
|
|
'<replaceable>[encrypted password or blank]</replaceable>','<replaceable>[clear text password or blank]</replaceable>',
|
|
'<replaceable>[User's Name]</replaceable>',9000,9000,'<replaceable>[location of Maildir]</replaceable>','<replaceable>[Quota in Bytes']</replaceable>);</command></userinput></screen>
|
|
|
|
<para>example</para>
|
|
|
|
<screen><userinput>insert into users values ('blfsuser@linuxfromscratch.org','
|
|
','password','BLFS User',9000,9000,'/home/vmailman/blfsuser','');</userinput></screen>
|
|
|
|
<para><emphasis>Setup for Web-based Email</emphasis></para>
|
|
|
|
<para>This section will explain how to setup Courier Web-based email
|
|
system.</para>
|
|
|
|
<para>You will need to copy the file webmail from
|
|
<filename>/usr/lib/courier/courier/webmail/webmail</filename> to your <filename>cgi-bin
|
|
</filename> directory of your <application>Apache</application>
|
|
server.</para>
|
|
|
|
<screen><userinput><command>cp -a /usr/lib/courier/courier/webmail/webmail /var/www/cgi-bin</command></userinput></screen>
|
|
|
|
<para>You will then need to copy the images to a directory under your
|
|
<filename>htdocs</filename> directory of your
|
|
<application>Apache</application> server. The directory needs to be named
|
|
<filename>webmail</filename> or you need to specify it during the configure
|
|
phase with <command>--enable-imageurl=/url</command>.</para>
|
|
|
|
<screen><userinput><command>cp -a /usr/share/courier/sqwebmail/images /var/www/htdocs/webmail</command></userinput></screen>
|
|
<para><emphasis>Setup for Web-based Email</emphasis></para>
|
|
|
|
<para>This section will explain how to setup Courier Web-based administration
|
|
system.</para>
|
|
|
|
<para>You will need to copy the file <filename>webadmin</filename> from
|
|
<filename class="directory">/usr/lib/courier/webmail/webadmin</filename>
|
|
to your <filename class="directory">cgi-bin </filename> directory of your
|
|
<application>Apache</application> server.</para>
|
|
|
|
<screen><userinput><command>cp -a /usr/lib/courier/courier/webmail/webadmin /var/www/cgi-bin</command></userinput></screen>
|
|
|
|
<para><filename>/etc/courier/webadmin/password</filename></para>
|
|
|
|
<screen><userinput><command>cat > /etc/courier/webadmin/password << "EOF"</command>
|
|
<replaceable>[password]</replaceable>
|
|
<command>EOF</command></userinput></screen>
|
|
|
|
<para>If you are not using <acronym>SSL</acronym> on your <application>Apache
|
|
</application> server, you will need to add
|
|
<filename>/etc/courier/webadmin/unsecureok</filename>, so you will be able
|
|
to use your web based administration tool.</para>
|
|
|
|
<screen><userinput><command>touch /etc/courier/webadmin/unsecureok</command></userinput></screen>
|
|
</sect3>
|
|
|
|
<sect3><title>Courier init.d script</title>
|
|
|
|
<para>The startup script from the <application>Courier</application> package is
|
|
the easiest to use. It will automatically create missing data files, and
|
|
<acronym>SSL</acronym> certificates if they are missing. To install the
|
|
init.d file for <application>Courier</application> you will need to use the
|
|
follow commands:</para>
|
|
|
|
<screen><userinput><command>cp /usr/src/courier-&courier-version;/courier.sysvinit /etc/rc.d/init.d/courier &&
|
|
chmod 755 /etc/rc.d/init.d/courier</command></userinput></screen>
|
|
|
|
<para>Create the symbolic links to this file in the relevant
|
|
<filename>rc.d</filename> directory with the following commands:</para>
|
|
|
|
<screen><userinput><command>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</command></userinput></screen>
|
|
|
|
</sect3>
|
|
</sect2>
|
|
|