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 <filename>/etc/courier/smtpaccess/default</filename>.</para>
|
---|
135 |
|
---|
136 | <para>After the above steps are completed you will need to run the
|
---|
137 | following commands:</para>
|
---|
138 |
|
---|
139 | <screen><userinput><command>makesmtpaccess &&
|
---|
140 | makehosteddomains &&
|
---|
141 | makealiases</command></userinput></screen>
|
---|
142 |
|
---|
143 | <para><emphasis><acronym>SMTP</acronym>/<acronym>SMTMP</acronym>-<acronym>SSL
|
---|
144 | </acronym> Configuration</emphasis></para>
|
---|
145 |
|
---|
146 | <para>This section will enable the <acronym>SMTP</acronym> Server from Courier</para>
|
---|
147 |
|
---|
148 | <para><filename>/etc/courier/esmtpd</filename></para>
|
---|
149 |
|
---|
150 | <screen><userinput>ESMTPDSTART=YES</userinput></screen>
|
---|
151 |
|
---|
152 | <para><filename>/etc/courier/esmtpd-ssl</filename></para>
|
---|
153 |
|
---|
154 | <screen><userinput>ESMTPDSSLSTART=YES</userinput></screen>
|
---|
155 |
|
---|
156 | <para><emphasis><acronym>POP</acronym>3/<acronym>POP</acronym>3-<acronym>SSL
|
---|
157 | </acronym> Configuration</emphasis></para>
|
---|
158 |
|
---|
159 | <para>This section will enable the <acronym>POP</acronym>3 Server from
|
---|
160 | Courier</para>
|
---|
161 |
|
---|
162 |
|
---|
163 | <para><filename>/etc/courier/pop3d</filename></para>
|
---|
164 |
|
---|
165 | <screen><userinput>POP3DSTART=YES</userinput></screen>
|
---|
166 |
|
---|
167 | <para><filename>/etc/courier/pop3d-ssl</filename></para>
|
---|
168 |
|
---|
169 | <screen><userinput>POP3DSLLSTART=YES</userinput></screen>
|
---|
170 |
|
---|
171 | <para><emphasis><acronym>IMAP</acronym>/<acronym>IMAP</acronym>-<acronym>SSL
|
---|
172 | </acronym> Configuration</emphasis></para>
|
---|
173 |
|
---|
174 | <para>This section will enable the <acronym>IMAP</acronym> Server from
|
---|
175 | Courier</para>
|
---|
176 |
|
---|
177 | <para><filename>/etc/courier/imapd</filename></para>
|
---|
178 |
|
---|
179 |
|
---|
180 | <screen><userinput>IMAPDSTART=YES</userinput></screen>
|
---|
181 |
|
---|
182 | <para><filename>/etc/courierd/imapd-ssl</filename></para>
|
---|
183 |
|
---|
184 | <screen><userinput>IMAPDSSLSTART=YES</userinput></screen>
|
---|
185 |
|
---|
186 | <para><emphasis>Creating Mail directories for System Users</emphasis></para>
|
---|
187 |
|
---|
188 |
|
---|
189 | <para>This section will explain on how to create MailDirs for
|
---|
190 | your system users.</para>
|
---|
191 |
|
---|
192 | <screen><userinput><command>cd /home/<replaceable>[username]</replaceable> &&
|
---|
193 | maildirmake Maildir &&
|
---|
194 | chown <replaceable>[username]</replaceable>.<replaceable>[username]</replaceable> Maildir -R</command></userinput></screen>
|
---|
195 |
|
---|
196 | <para><emphasis>Setup for Virtual users</emphasis></para>
|
---|
197 |
|
---|
198 | <para>This section will explain how to setup Maildir for your virtual
|
---|
199 | users.</para>
|
---|
200 |
|
---|
201 | <screen><userinput><command>groupadd -g 9000 vmailman &&
|
---|
202 | useradd -c 'Virtual Mailman' -g vmailman -m -k /dev/null -u 9000 vmailman</command></userinput></screen>
|
---|
203 |
|
---|
204 | <para>Now to setup the Maildir for these virtual users.</para>
|
---|
205 |
|
---|
206 | <screen><userinput><command>cd /home/vmailman &&
|
---|
207 | mkdir <replaceable>[virtual_user]</replaceable> &&
|
---|
208 | cd <replaceable>[virtual_user]</replaceable> &&
|
---|
209 | maildirmake Maildir &&
|
---|
210 | chown vmailman.vmailman Maildir -R</command></userinput></screen>
|
---|
211 |
|
---|
212 | <para>Connect to the <application>My<acronym>SQL</acronym></application>
|
---|
213 | database.</para>
|
---|
214 |
|
---|
215 | <screen><userinput><command>mysql -u courier -p</command></userinput></screen>
|
---|
216 |
|
---|
217 | <para>To add the virtual user you need to enter at
|
---|
218 | least one version of the password either clear text or encrypted.</para>
|
---|
219 |
|
---|
220 | <screen><userinput><command>USE courier_mail
|
---|
221 | INSERT INTO users VALUES (
|
---|
222 | '<replaceable>[virtual_users]</replaceable>@<replaceable>[domain.com]</replaceable>,
|
---|
223 | '<replaceable>[encrypted password or blank]</replaceable>',
|
---|
224 | '<replaceable>[clear text password or blank]</replaceable>',
|
---|
225 | '<replaceable>[User's Name]</replaceable>',
|
---|
226 | 9000,
|
---|
227 | 9000,
|
---|
228 | '<replaceable>[location of Maildir]</replaceable>',
|
---|
229 | '<replaceable>[Quota in Bytes']</replaceable>
|
---|
230 | );
|
---|
231 | QUIT</command></userinput></screen>
|
---|
232 |
|
---|
233 | <para>For example:</para>
|
---|
234 |
|
---|
235 | <screen><userinput><command>INSERT INTO users VALUES (
|
---|
236 | 'blfsuser@linuxfromscratch.org',
|
---|
237 | '',
|
---|
238 | 'password',
|
---|
239 | 'BLFS User',
|
---|
240 | 9000,
|
---|
241 | 9000,
|
---|
242 | '/home/vmailman/blfsuser',
|
---|
243 | ''
|
---|
244 | );</command></userinput></screen>
|
---|
245 |
|
---|
246 | <para><emphasis>Setup for Web-based Email</emphasis></para>
|
---|
247 |
|
---|
248 | <para>This section will explain how to setup Courier Web-based email
|
---|
249 | system.</para>
|
---|
250 |
|
---|
251 | <para>You will need to copy the <filename>webmail</filename> file from
|
---|
252 | <filename>/usr/lib/courier/courier/webmail</filename> to your <filename>cgi-bin
|
---|
253 | </filename> directory of your <application>Apache</application>
|
---|
254 | server.</para>
|
---|
255 |
|
---|
256 | <screen><userinput><command>cp -a /usr/lib/courier/courier/webmail/webmail /var/www/cgi-bin</command></userinput></screen>
|
---|
257 |
|
---|
258 | <para>You will then need to copy the images to a directory under your
|
---|
259 | <filename>htdocs</filename> directory of your
|
---|
260 | <application>Apache</application> server. The directory needs to be named
|
---|
261 | <filename>webmail</filename> or you need to specify it during the configure
|
---|
262 | phase with <parameter>--enable-imageurl=<replaceable>[URL]</replaceable></parameter>.</para>
|
---|
263 |
|
---|
264 | <screen><userinput><command>cp -a /usr/share/courier/sqwebmail/images /var/www/htdocs/webmail</command></userinput></screen>
|
---|
265 | <para><emphasis>Setup for Web-based Email</emphasis></para>
|
---|
266 |
|
---|
267 | <para>This section will explain how to setup Courier Web-based administration
|
---|
268 | system.</para>
|
---|
269 |
|
---|
270 | <para>You will need to copy the <filename>webadmin</filename> file from
|
---|
271 | <filename class="directory">/usr/lib/courier/courier/webmail</filename>
|
---|
272 | to your <filename class="directory">cgi-bin</filename> directory of your
|
---|
273 | <application>Apache</application> server.</para>
|
---|
274 |
|
---|
275 | <screen><userinput><command>cp -a /usr/lib/courier/courier/webmail/webadmin /var/www/cgi-bin</command></userinput></screen>
|
---|
276 |
|
---|
277 | <para><filename>/etc/courier/webadmin/password</filename></para>
|
---|
278 |
|
---|
279 | <screen><userinput><command>cat > /etc/courier/webadmin/password << "EOF"</command>
|
---|
280 | <replaceable>[password]</replaceable>
|
---|
281 | <command>EOF</command></userinput></screen>
|
---|
282 |
|
---|
283 | <para>If you are not using <acronym>SSL</acronym> on your <application>Apache
|
---|
284 | </application> server, you will need to add
|
---|
285 | <filename>/etc/courier/webadmin/unsecureok</filename>, so you will be able
|
---|
286 | to use your web based administration tool.</para>
|
---|
287 |
|
---|
288 | <screen><userinput><command>touch /etc/courier/webadmin/unsecureok</command></userinput></screen>
|
---|
289 | </sect3>
|
---|
290 |
|
---|
291 | <sect3><title>Courier init.d script</title>
|
---|
292 |
|
---|
293 | <para>The startup script from the <application>Courier</application> package is
|
---|
294 | the easiest to use. It will automatically create missing data files, and
|
---|
295 | <acronym>SSL</acronym> certificates if they are missing. To install the
|
---|
296 | init.d file for <application>Courier</application> you will need to use the
|
---|
297 | follow commands:</para>
|
---|
298 |
|
---|
299 | <screen><userinput><command>cp /usr/src/courier-&courier-version;/courier.sysvinit /etc/rc.d/init.d/courier &&
|
---|
300 | chmod 755 /etc/rc.d/init.d/courier</command></userinput></screen>
|
---|
301 |
|
---|
302 | <para>Create the symbolic links to this file in the relevant
|
---|
303 | <filename>rc.d</filename> directory with the following commands:</para>
|
---|
304 |
|
---|
305 | <screen><userinput><command>cd /etc/rc.d/init.d &&
|
---|
306 | ln -sf ../init.d/courier ../rc0.d/K25courier &&
|
---|
307 | ln -sf ../init.d/courier ../rc1.d/K25courier &&
|
---|
308 | ln -sf ../init.d/courier ../rc2.d/K25courier &&
|
---|
309 | ln -sf ../init.d/courier ../rc3.d/S35courier &&
|
---|
310 | ln -sf ../init.d/courier ../rc4.d/S35courier &&
|
---|
311 | ln -sf ../init.d/courier ../rc5.d/S35courier &&
|
---|
312 | ln -sf ../init.d/courier ../rc6.d/K25courier</command></userinput></screen>
|
---|
313 |
|
---|
314 | </sect3>
|
---|
315 | </sect2>
|
---|