Lines 6-40
Link Here
|
6 |
|
6 |
|
7 |
2. If you didn't activate spamd (the SpamAssassin daemon), do so now: |
7 |
2. If you didn't activate spamd (the SpamAssassin daemon), do so now: |
8 |
|
8 |
|
9 |
/usr/local/etc/rc.d/spamd.sh start |
9 |
%%PREFIX%%/etc/rc.d/sa-spamd.sh start |
10 |
|
10 |
|
11 |
3. Activate spamass-milter: |
11 |
3. Activate spamass-milter: |
12 |
|
12 |
|
13 |
/usr/local/etc/rc.d/spamass-milter.sh start |
13 |
%%PREFIX%%/etc/rc.d/spamass-milter.sh start |
14 |
|
14 |
|
15 |
4. Backup your sendmail.cf (in /etc/mail). |
15 |
4. Backup your sendmail.cf (in /etc/mail). |
16 |
|
16 |
|
17 |
5. If you didn't create your own customized version of Sendmail .mc |
17 |
5. If you didn't create your own customized version of Sendmail .mc |
18 |
file, create one from the default template (replace YOURNAME with a |
18 |
file, create one from the default template (hostname.mc): |
19 |
suitable name; a good candidate is the output of `hostname -s'): |
|
|
20 |
|
19 |
|
21 |
cd /etc/mail |
20 |
cd /etc/mail |
22 |
cp -p freebsd.mc YOURNAME.mc |
21 |
make |
23 |
echo "SENDMAIL_MC = /etc/mail/YOURNAME.mc" >> /etc/make.conf |
|
|
24 |
|
25 |
The last line tells the system to use your customized version instead |
26 |
of the default freebsd.mc when you run mergemaster(8) later on. |
27 |
|
22 |
|
28 |
6. Add the spamass-milter hook to your Sendmail .mc file. The magic |
23 |
6. Add the spamass-milter hook to your hostname.mc file. The magic |
29 |
line to add is: |
24 |
line to add is: |
30 |
|
25 |
|
31 |
INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m') |
26 |
INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m') |
|
|
27 |
define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl |
32 |
|
28 |
|
33 |
Everything should go on a single line, no line break/continuation is |
29 |
Everything should go on a single line, no line break/continuation is |
34 |
allowed! |
30 |
allowed! The best place to add this is right after the dnsbl-related |
35 |
|
31 |
comments. (Hint: Every comment in an .mc file starts with `dnl'.) |
36 |
The best place to add this is right after the dnsbl-related comments. |
|
|
37 |
(Hint: Every comment in an .mc file starts with `dnl'.) |
38 |
|
32 |
|
39 |
7. Rebuild the sendmail.cf from your .mc file: |
33 |
7. Rebuild the sendmail.cf from your .mc file: |
40 |
|
34 |
|
Lines 42-80
Link Here
|
42 |
make |
36 |
make |
43 |
make install |
37 |
make install |
44 |
|
38 |
|
45 |
Or you can run mergemaster(8) instead if you want, although it's an |
|
|
46 |
overkill. |
47 |
|
48 |
8. Restart Sendmail: |
39 |
8. Restart Sendmail: |
49 |
|
40 |
|
50 |
kill -HUP `head -1 /var/run/sendmail.pid` |
41 |
cd /etc/mail |
|
|
42 |
make stop |
43 |
make start |
51 |
|
44 |
|
52 |
9. Test the whole piece: |
45 |
9. Test the whole piece: |
53 |
|
46 |
|
54 |
/usr/sbin/sendmail root < /usr/local/share/doc/p5-Mail-SpamAssassin/sample-nonspam.txt |
47 |
echo "Testing spamass-milter..." | mail -s"Spam test" root |
55 |
/usr/sbin/sendmail root < /usr/local/share/doc/p5-Mail-SpamAssassin/sample-spam.txt |
|
|
56 |
|
48 |
|
57 |
Each of these commands might take a long time to finish (up to about |
49 |
This might take a long time to finish (up to about 10-20 seconds), |
58 |
10-20 seconds), so please be patient. |
50 |
since spamd has just started, so please be patient. |
59 |
|
51 |
|
60 |
You should receive two messages, one from `Keith Dawson' and the |
52 |
You (root) should receive a message from root@hostname, bearing this |
61 |
other from xl6Ety00V@fismat1.fcfm.buap.mx. The one from Keith Dawson |
53 |
header line: |
62 |
shouldn't be tagged as a spam, bearing this header line: |
|
|
63 |
|
54 |
|
64 |
X-Spam-Status: No, ... |
55 |
X-Spam-Status: No, ... |
65 |
|
56 |
|
66 |
On the other hand, the one from xl6Ety00V@fismat1.fcfm.buap.mx should |
57 |
If things don't work as expected, promptly restore the stock FreeBSD |
67 |
be tagged as a spam, bearing these two header lines: |
58 |
sendmail.cf (/etc/mail/freebsd.cf) as your default sendmail config, |
68 |
|
59 |
or restore your own backup (if you keep one), as shown in step 8; |
69 |
X-Spam-Status: Yes, ... |
60 |
you may lose incoming mail otherwise! |
70 |
X-Spam-Flag: YES |
|
|
71 |
|
72 |
If things don't work as expected, promptly restore your sendmail.cf |
73 |
from the backup copy then restart sendmail as shown on step 8; you |
74 |
may lose incoming mail otherwise! |
75 |
|
61 |
|
76 |
|
62 |
|
77 |
Now all messages received by Sendmail are filtered through |
63 |
Now all messages received by Sendmail are filtered through |
78 |
SpamAssassin, and probable spam messages are tagged with the header |
64 |
SpamAssassin, and probable spam messages are tagged with the header |
79 |
`X-Spam-Flag: YES'. Tell your users about this so they can set up |
65 |
`X-Spam-Flag: YES'. Tell your users about this so they can set up |
80 |
appropriate filters on their mail reader. |
66 |
appropriate filters in their mail client. |