[91c2c77d] | 1 | <sect2>
|
---|
[1a1da48] | 2 | <title>Configuring <application>Courier</application></title>
|
---|
[91c2c77d] | 3 |
|
---|
| 4 | <sect3><title>Config files</title>
|
---|
| 5 | <para><filename>/etc/courier/authmysqlrc</filename></para>
|
---|
| 6 | </sect3>
|
---|
| 7 |
|
---|
| 8 | <sect3><title>Configuration Information</title>
|
---|
| 9 |
|
---|
| 10 | <para>Make the following changes in this file if you are utilizing
|
---|
[f0334b2] | 11 | <application>My<acronym>SQL</acronym></application>:</para>
|
---|
[70b838f] | 12 | <screen><userinput>MYSQL_SERVER localhost
|
---|
[91c2c77d] | 13 | MYSQL_USERNAME courier
|
---|
| 14 | MYSQL_PASSWORD (your choice)
|
---|
| 15 | MYSQL_SOCKET /tmp/mysql.sock
|
---|
| 16 | MYSQL_PORT 3306
|
---|
| 17 | MYSQL_DATABASE courier-mail
|
---|
| 18 | MYSQL_USER_TABLE users
|
---|
| 19 | MYSQL_CLEAR_PWFIELD clear
|
---|
| 20 | DEFAULT DOMAIN (your domain)
|
---|
[c442d19] | 21 | MYSQL_QUOTA_FIELD quota</userinput></screen>
|
---|
[91c2c77d] | 22 |
|
---|
| 23 |
|
---|
[c442d19] | 24 | <para>If you utilize <application>PAM</application>:</para>
|
---|
[91c2c77d] | 25 | <screen><userinput><command>cat > /etc/pam.d/esmtp << "EOF</command>
|
---|
| 26 | # Begin /etc/pam.d/esmtp
|
---|
| 27 |
|
---|
| 28 | auth required pam_unix.so try_first_pass
|
---|
| 29 | account required pam_unix.so
|
---|
| 30 | session required pam_unix.so
|
---|
| 31 |
|
---|
| 32 | # End /etc/pam.d/esmtp
|
---|
| 33 | <command>EOF
|
---|
| 34 | cat > /etc/pam.d/pop3 << "EOF</command>
|
---|
| 35 | # Begin /etc/pam.d/pop3
|
---|
| 36 |
|
---|
| 37 | auth required pam_unix.so try_first_pass
|
---|
| 38 | account required pam_unix.so
|
---|
| 39 | session required pam_unix.so
|
---|
| 40 |
|
---|
| 41 | # End /etc/pam.d/pop3
|
---|
| 42 | <command>EOF
|
---|
| 43 | cat > /etc/pam.d/imap << "EOF</command>
|
---|
| 44 | # Begin /etc/pam.d/imap
|
---|
| 45 |
|
---|
| 46 | auth required pam_unix.so try_first_pass
|
---|
| 47 | account required pam_unix.so
|
---|
| 48 | session required pam_unix.so
|
---|
| 49 |
|
---|
| 50 | # End /etc/pam.d/imap
|
---|
| 51 | <command>EOF
|
---|
| 52 | cat > /etc/pam.d/webmail << "EOF</command>
|
---|
| 53 | # Begin /etc/pam.d/webmail
|
---|
| 54 |
|
---|
| 55 | auth required pam_unix.so try_first_pass
|
---|
| 56 | account required pam_unix.so
|
---|
| 57 | session required pam_unix.so
|
---|
| 58 |
|
---|
| 59 | # End /etc/pam.d/webmail
|
---|
[c442d19] | 60 | <command>EOF</command></userinput></screen>
|
---|
| 61 |
|
---|
| 62 | <para>This command will create the mysql database for authentication:</para>
|
---|
| 63 |
|
---|
[971ca3d] | 64 | <screen><userinput><command>mysqladmin -uroot -p<replaceable>[password]</replaceable> create courier-mail</command></userinput></screen>
|
---|
[c442d19] | 65 |
|
---|
| 66 | <para>This command will setup the table users for the courier-mail
|
---|
| 67 | database:</para>
|
---|
| 68 |
|
---|
[971ca3d] | 69 | <screen><userinput><command>mysql -uroot -p<replaceable>[password]</replaceable> courier-mail
|
---|
[c442d19] | 70 |
|
---|
| 71 | CREATE TABLE users (
|
---|
| 72 | id char(128) DEFAULT '' NOT NULL,
|
---|
| 73 | crypt char(128) DEFAULT '' NOT NULL,
|
---|
| 74 | clear char(128) DEFAULT '' NOT NULL,
|
---|
| 75 | name char(128) DEFAULT '' NOT NULL,
|
---|
| 76 | uid int(10) unsigned DEFAULT '65534' NOT NULL,
|
---|
| 77 | gid int(10) unsigned DEFAULT '65534' NOT NULL,
|
---|
| 78 | home char(255) DEFAULT '' NOT NULL,
|
---|
| 79 | quota char(255) DEFAULT '' NOT NULL,
|
---|
| 80 | KEY id (id(128))
|
---|
| 81 | );</command></userinput></screen>
|
---|
| 82 |
|
---|
[9491ec6b] | 83 | <para>This will add the courier user that we specified earlier in the
|
---|
[c442d19] | 84 | authmysql file:</para>
|
---|
| 85 |
|
---|
[971ca3d] | 86 | <screen><userinput><command>mysql -uroot -p<replaceable>[password]</replaceable> mysql
|
---|
[c442d19] | 87 |
|
---|
[971ca3d] | 88 | grant all privileges on *.* to courier@localhost identified by '<replaceable>[password]</replaceable>' with grant option;</command></userinput></screen>
|
---|
[c442d19] | 89 |
|
---|
| 90 |
|
---|
| 91 | <para><emphasis>General Settings for Mail</emphasis></para>
|
---|
| 92 |
|
---|
| 93 | <para>You will need to create the following files with the contents
|
---|
| 94 | specified.</para>
|
---|
| 95 |
|
---|
| 96 | <para><filename>/etc/courier/defaultdomain</filename></para>
|
---|
| 97 |
|
---|
| 98 | <screen><userinput><command>cat > /etc/courier/defaultdomain << "EOF"</command>
|
---|
[971ca3d] | 99 | <replaceable>[yourdomain]</replaceable>
|
---|
[c442d19] | 100 | <command>EOF</command></userinput></screen>
|
---|
| 101 |
|
---|
[1a1da48] | 102 | <para><filename>/etc/courier/me</filename></para>
|
---|
[c442d19] | 103 |
|
---|
[1a1da48] | 104 | <screen><userinput><command>cat > /etc/courier/me << "EOF"</command>
|
---|
[a75063d4] | 105 | <replaceable>[servername.yourdomain]</replaceable>
|
---|
[c442d19] | 106 | <command>EOF</command></userinput></screen>
|
---|
| 107 |
|
---|
[1a1da48] | 108 | <para><filename>/etc/courier/locals</filename></para>
|
---|
[c442d19] | 109 |
|
---|
[1a1da48] | 110 | <screen><userinput><command>cat > /etc/courier/locals << "EOF"</command>
|
---|
[c442d19] | 111 | localhost
|
---|
[a75063d4] | 112 | <replaceable>[yourdomain]</replaceable>
|
---|
[c442d19] | 113 | <command>EOF</command></userinput></screen>
|
---|
| 114 |
|
---|
[1a1da48] | 115 | <para><filename>/etc/courier/esmtpacceptmailfor.dir/system</filename></para>
|
---|
[c442d19] | 116 |
|
---|
[1a1da48] | 117 | <screen><userinput><command>cat >/etc/courier/esmtpacceptmailfor.dir/system << "EOF"</command>
|
---|
| 118 | localhost
|
---|
[a75063d4] | 119 | <replaceable>[yourdomain]</replaceable>
|
---|
[c442d19] | 120 | <command>EOF</command></userinput></screen>
|
---|
| 121 |
|
---|
| 122 | <para>You will also need to edit the aliases file and change the
|
---|
| 123 | following entry.</para>
|
---|
| 124 |
|
---|
| 125 | <para><filename>/etc/courier/aliases/system</filename></para>
|
---|
| 126 |
|
---|
[9491ec6b] | 127 | <screen><userinput>postmaster: <replaceable>[your administrator email]</replaceable></userinput></screen>
|
---|
[c442d19] | 128 |
|
---|
| 129 | <para>If you want to deny access from some hosts from sending mail you
|
---|
| 130 | will need to edit the <filename>/etc/courier/smtpaccess/default</filename>.</para>
|
---|
| 131 |
|
---|
| 132 | <para>After the above steps are completed you will need to run the
|
---|
| 133 | following commands:</para>
|
---|
| 134 |
|
---|
| 135 | <screen><userinput><command>makesmtpaccess
|
---|
| 136 | makehosteddomains
|
---|
| 137 | makealiases</command></userinput></screen>
|
---|
| 138 |
|
---|
| 139 | <para><emphasis><acronym>SMTP</acronym>/<acronym>SMTMP</acronym>-<acronym>SSL
|
---|
| 140 | </acronym> Configuration</emphasis></para>
|
---|
| 141 |
|
---|
| 142 | <para>This section will enable the <acronym>SMTP</acronym> Server from Courier</para>
|
---|
| 143 |
|
---|
| 144 | <para><filename>/etc/courier/esmtpd</filename></para>
|
---|
| 145 |
|
---|
| 146 | <screen><userinput>ESMTPDSTART=YES</userinput></screen>
|
---|
| 147 |
|
---|
| 148 | <para><filename>/etc/courier/esmtpd-ssl</filename></para>
|
---|
| 149 |
|
---|
| 150 | <screen><userinput>ESMTPDSSLSTART=YES</userinput></screen>
|
---|
[91c2c77d] | 151 |
|
---|
[c442d19] | 152 | <para><emphasis><acronym>POP</acronym>3/<acronym>POP</acronym>3-<acronym>SSL
|
---|
| 153 | </acronym> Configuration</emphasis></para>
|
---|
| 154 |
|
---|
[f0334b2] | 155 | <para>This section will enable the <acronym>POP</acronym>3 Server from
|
---|
[c442d19] | 156 | Courier</para>
|
---|
| 157 |
|
---|
| 158 |
|
---|
| 159 | <para><filename>/etc/courier/pop3d</filename></para>
|
---|
| 160 |
|
---|
| 161 | <screen><userinput>POP3DSTART=YES</userinput></screen>
|
---|
| 162 |
|
---|
| 163 | <para><filename>/etc/courier/pop3d-ssl</filename></para>
|
---|
| 164 |
|
---|
| 165 | <screen><userinput>POP3DSLLSTART=YES</userinput></screen>
|
---|
| 166 |
|
---|
| 167 | <para><emphasis><acronym>IMAP</acronym>/<acronym>IMAP</acronym>-<acronym>SSL
|
---|
| 168 | </acronym> Configuration</emphasis></para>
|
---|
| 169 |
|
---|
| 170 | <para>This section will enable the <acronym>IMAP</acronym> Server from
|
---|
| 171 | Courier</para>
|
---|
| 172 |
|
---|
| 173 | <para><filename>/etc/courier/imapd</filename></para>
|
---|
| 174 |
|
---|
[971ca3d] | 175 |
|
---|
[c442d19] | 176 | <screen><userinput>IMAPDSTART=YES</userinput></screen>
|
---|
| 177 |
|
---|
| 178 | <para><filename>/etc/courierd/imapd-ssl</filename></para>
|
---|
| 179 |
|
---|
| 180 | <screen><userinput>IMAPDSSLSTART=YES</userinput></screen>
|
---|
| 181 |
|
---|
[9491ec6b] | 182 | <para><emphasis>Creating Mail directories for System Users</emphasis></para>
|
---|
[c442d19] | 183 |
|
---|
| 184 |
|
---|
| 185 | <para>This section will explain on how to create MailDirs for
|
---|
| 186 | your system users.</para>
|
---|
| 187 |
|
---|
[971ca3d] | 188 | <screen><userinput><command>cd /home/<replaceable>[username]</replaceable>
|
---|
[c442d19] | 189 | maildirmake Maildir
|
---|
[971ca3d] | 190 | chown <replaceable>[username]</replaceable>.<replaceable>[username]</replaceable> Maildir -R</command></userinput></screen>
|
---|
[c442d19] | 191 |
|
---|
| 192 | <para><emphasis>Setup for Virtual users</emphasis></para>
|
---|
| 193 |
|
---|
| 194 | <para>This section will explain how to setup Maildir for your virtual
|
---|
| 195 | users.</para>
|
---|
| 196 |
|
---|
| 197 | <screen><userinput><command>echo "vmailman:x:9000:9000:Virtual Mailman:/home/vmailman:/bin/bash" >> /etc/passwd
|
---|
| 198 | echo "vmailman:x:9000:" >> /etc/group</command></userinput></screen>
|
---|
| 199 |
|
---|
[a4be499] | 200 | <para>Now to setup the maildir for these virtual users.</para>
|
---|
[c442d19] | 201 |
|
---|
| 202 | <screen><userinput><command>cd /home/vmailman
|
---|
[971ca3d] | 203 | mkdir <replaceable>[virtual_user]</replaceable>
|
---|
| 204 | cd <replaceable>[virtual_user]</replaceable>
|
---|
[c442d19] | 205 | maildirmake Maildir
|
---|
| 206 | chown vmailman.vmailman Maildir -R</command></userinput></screen>
|
---|
| 207 |
|
---|
[f0334b2] | 208 | <para>Add the virtual user to the <application>My<acronym>SQL</acronym></application> database. You need to enter at
|
---|
[c442d19] | 209 | least on version of the password either clear text or encrypted.</para>
|
---|
| 210 |
|
---|
[971ca3d] | 211 | <screen><userinput><command>mysql -ucourier -p<replaceable>[password]</replaceable> courier-mail
|
---|
[c442d19] | 212 |
|
---|
[971ca3d] | 213 | insert into users values('<replaceable>[virtual_users]</replaceable>@<replaceable>[domain.com]</replaceable>,
|
---|
| 214 | '<replaceable>[encrypted password or blank]</replaceable>','<replaceable>[clear text password or blank]</replaceable>',
|
---|
| 215 | '<replaceable>[User's Name]</replaceable>',9000,9000,'<replaceable>[location of Maildir]</replaceable>','<replaceable>[Quota in Bytes']</replaceable>);</command></userinput></screen>
|
---|
[c442d19] | 216 |
|
---|
| 217 | <para>example</para>
|
---|
| 218 |
|
---|
| 219 | <screen><userinput>insert into users values ('blfsuser@linuxfromscratch.org','
|
---|
| 220 | ','password','BLFS User',9000,9000,'/home/vmailman/blfsuser','');</userinput></screen>
|
---|
| 221 |
|
---|
| 222 | <para><emphasis>Setup for Web-based Email</emphasis></para>
|
---|
| 223 |
|
---|
| 224 | <para>This section will explain how to setup Courier Web-based email
|
---|
| 225 | system.</para>
|
---|
| 226 |
|
---|
[1a1da48] | 227 | <para>You will need to copy the file webmail from
|
---|
[a4be499] | 228 | <filename>/usr/sbin/courier/webmail/webmail</filename> to your <filename>cgi-bin
|
---|
[c442d19] | 229 | </filename> directory of your <application>Apache</application>
|
---|
| 230 | server.</para>
|
---|
| 231 |
|
---|
[a4be499] | 232 | <screen><userinput><command>cp -a /usr/sbin/courier/webmail/webmail /var/www/cgi-bin</command></userinput></screen>
|
---|
[c442d19] | 233 |
|
---|
[9c081fa] | 234 | <para>You will then need to copy the images to a directory under your
|
---|
[c442d19] | 235 | <filename>htdocs</filename> directory of your
|
---|
| 236 | <application>Apache</application> server. The directory needs to be named
|
---|
| 237 | <filename>webmail</filename> or you need to specify it during the configure
|
---|
| 238 | phase with <command>--enable-imageurl=/url</command>.</para>
|
---|
| 239 |
|
---|
| 240 | <screen><userinput><command>cp -a /usr/share/courier/sqwebmail/images /var/www/htdocs/webmail</command></userinput></screen>
|
---|
[1a1da48] | 241 | <para><emphasis>Setup for Web-based Email</emphasis></para>
|
---|
| 242 |
|
---|
| 243 | <para>This section will explain how to setup Courier Web-based administration
|
---|
| 244 | system.</para>
|
---|
| 245 |
|
---|
[a4be499] | 246 | <para>You will need to copy the file <filename>webadmin</filename> from
|
---|
| 247 | <filename class="directory">/usr/sbin/courier/webmail/webmin</filename>
|
---|
| 248 | to your <filename class="directory">cgi-bin </filename> directory of your
|
---|
| 249 | <application>Apache</application> server.</para>
|
---|
[1a1da48] | 250 |
|
---|
[a4be499] | 251 | <screen><userinput><command>cp -a /usr/sbin/courier/webmail/webadmin /var/www/cgi-bin</command></userinput></screen>
|
---|
[1a1da48] | 252 |
|
---|
| 253 | <para><filename>/etc/courier/webadmin/password</filename></para>
|
---|
| 254 |
|
---|
| 255 | <screen><userinput><command>cat > /etc/courier/webadmin/password << "EOF"</command>
|
---|
[971ca3d] | 256 | <replaceable>[password]</replaceable>
|
---|
[1a1da48] | 257 | <command>EOF</command></userinput></screen>
|
---|
| 258 |
|
---|
| 259 | <para>If you are not using <acronym>SSL</acronym> on your <application>Apache
|
---|
| 260 | </application> server, you will need to add
|
---|
| 261 | <filename>/etc/courier/webadmin/unsecureok</filename>, so you will be able
|
---|
[a75063d4] | 262 | to use your web based administration tool.</para>
|
---|
[1a1da48] | 263 |
|
---|
[a75063d4] | 264 | <screen><userinput><command>touch /etc/courier/webadmin/unsecureok</command></userinput></screen>
|
---|
[1a1da48] | 265 | </sect3>
|
---|
| 266 |
|
---|
| 267 | <sect3><title>Courier init.d script</title>
|
---|
| 268 |
|
---|
| 269 | <para>The startup script from the <application>Courier</application> package is
|
---|
| 270 | the easiest to use. It will automatically create missing data files, and
|
---|
| 271 | <acronym>SSL</acronym> certificates if they are missing. To install the
|
---|
| 272 | init.d file for <application>Courier</application> you will need to use the
|
---|
| 273 | follow commands:</para>
|
---|
| 274 |
|
---|
| 275 | <screen><userinput><command>cp /usr/src/courier-&courier-version;/courier.sysvinit /etc/rc.d/init.d/courier &&
|
---|
| 276 | chmod 755 /etc/rc.d/init.d/courier</command></userinput></screen>
|
---|
| 277 |
|
---|
| 278 | <para>Create the symbolic links to this file in the relevant
|
---|
[a75063d4] | 279 | <filename>rc.d</filename> directory with the following commands:</para>
|
---|
[c442d19] | 280 |
|
---|
[1a1da48] | 281 | <screen><userinput><command>cd /etc/rc.d/init.d &&
|
---|
| 282 | ln -sf ../init.d/courier ../rc0.d/K25courier &&
|
---|
| 283 | ln -sf ../init.d/courier ../rc1.d/K25courier &&
|
---|
| 284 | ln -sf ../init.d/courier ../rc2.d/K25courier &&
|
---|
| 285 | ln -sf ../init.d/courier ../rc3.d/S35courier &&
|
---|
| 286 | ln -sf ../init.d/courier ../rc4.d/S35courier &&
|
---|
| 287 | ln -sf ../init.d/courier ../rc5.d/S35courier &&
|
---|
[a75063d4] | 288 | ln -sf ../init.d/courier ../rc6.d/K25courier</command></userinput></screen>
|
---|
[c442d19] | 289 |
|
---|
| 290 | </sect3>
|
---|
[91c2c77d] | 291 | </sect2>
|
---|
| 292 |
|
---|