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