分享
 
 
 

Spam filtering with GNU/Linux, Pos

王朝system·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

With GNU/Linux and some new and old favorites you can reduce the amount of email spam your customers, employees, and personal mail readers receive. This step-by-step guide shows you how to install procmail and SpamAssassin and how to configure the Postfix mail transport agent to mark potential spam before it reaches your mail program.

Click Here

Click Here

Before we begin, be sure you have Postfix running properly and receiving mail for all of your domains. If you are running an ISP, are the systems administrator for a company, or are modifying the behavior of a mail server that many people depend on, make sure you let your users know in advance that changes are in the works and who to contact should something go wrong.

This process only marks messages as potential spam. Users will receive these messages with the subject line rewritten and a note specifying them as spam. They can then be filtered into a junk mail folder using filters in the mail client. It is possible to delete the potential spam without delivering it, but a computer cannot be relied on to make all the correct decisions for you and may inadvertently mark a message as spam that was not intended to be. If you set your spam filter to delete all mail it believes is spam, don't be surprised when important mail fails to reach you.

Before you start, be sure you have:

# Root access to the machine you are configuring

# Basic knowledge of installing software for the GNU/Linux system

# A working installation of Postfix version 2.0.1 (you can check your version by typing postconf mail_version)

# The procmail program. Many major distributions of GNU/Linux come with procmail already installed or some package (RPM, DEB, source file) containing the procmail program. You can test whether you have procmail already installed by typing which procmail at the prompt. If it returns something like /usr/bin/procmail, it is already installed. If you don't yet have it you can download the source or possibly find a binary package for your distribution

# Perl version 5.005_3 or higher (comes standard with most distributions of GNU/Linux)

Our first step is to install SpamAssassin. The easiest way to do this is with Perl's CPAN tool. Open a shell and at the prompt type:

# perl -MCPAN -e 'shell'

cpan> install Mail::SpamAssassin

CPAN will begin to download and install SpamAssassin. Pay attention to what CPAN is doing as it may ask you questions during the install process. When it finishes, install procmail if it is not installed already.

Next, we set some global options for SpamAssassin. Locate the spamassassin/local.cf file, which is usually at /etc/mail/spamassassin/local.cf. Open the file with your favorite text editor and add the following lines:

allow_user_rules 1

rewrite_subject 1

This is all you really need to add to get started. Of course there are more options you can set to customize the way mail is filtered. For instance, to specify what the subject line should say, add:

subject_tag *SPAM*

You can also specify a number of hits (the number of points an email message must have before being marked as spam) in order to loosely set how restrictive your spam filter will be:

required_hits 3.5

To set up spam filtering for every user on the system, we next modify the global procmailrc file (usually located at /etc/procmail; if you do not have a file already you should create one by opening a blank file in your text editor, entering the lines below, then saving it to this location). Add the following lines to the procmailrc file:

:0fw

|/usr/bin/spamassassin -f -u $1

The above configuration allows individuals to still use other personal procmail rules and still benefit from global spam filtering.

Alternatively you can create or edit a .procmailrc (it must have the dot) file in a user's home directory with the lines:

:0fw

|/usr/bin/spamassassin

This applies spam filtering only to the individual user.

Now open the /etc/postfix/main.cf file and locate and edit or add the following line:

mailbox_command = /usr/bin/procmail -f- -a "$USER"

then restart the Postfix program. Different distributions offer different ways to restart Postfix; one possibility is /etc/init.d/postfix restart.

That's all you have to do in the way of configuration. Now just sit back and wait for the spam to come in and be labeled.

You'll probably find some mail will be tagged as spam that shouldn't be. The only way to correct this is to look at the headers and see how SpamAssassin scored the email in question, then modify the rules base SpamAssassin uses to fit the majority of your incoming mail by editing the files located in the /usr/share/spamassassin directory with your favorite text editor. The rules system works by using regular expressions to search for text in all portions of an email message and assigns either points towards the email being spam or points against the email being spam. Even if you aren't comfortable creating regular expressions or editing the current ones, you can still get better performance by changing the score that a rule assigns to a particular expression (descriptions of each rule are included in the configuration files) to match email that regularly passes through your system. With some tweaking you should be able to get the system to run almost flawlessly.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有