Description: Spam Locker is an open source, licensed under the GPL, which originates from APF technology and is recognized as the core anti-spam system by SMTP behavior. Written in the Perl language;
Spam Locker uses a variety of current anti-spam field of leading technology, such as local black and white list, gray list technology, multi-RBL query technology and so on;
These many manufacturers are proud of anti-spam technology, now can be used spam locker free;
Spam Locker is the SMTP phase (when messages are confiscated), SpamAssassin is the content filtering phase (Mail has been received), so 2 can be mixed.
Reference:
Http://wiki.extmail.org/spam_locker
1, installation SLOCKD
Spam Locker was designed and developed by the Extmail team and is therefore downloaded and installed in its official Yum:
can also be downloaded from the annex to this article:
[Email protected] ~]# RPM-IVH http://mirror.extmail.org/yum/emos/1.5/os/x86_64/EMOS/extsuite-slockd-0.99-1hzq.noarch.rpm
Temporarily turn off the SPF plug-in feature
[Email protected] ~]# Vi/usr/local/slockd/config/plugin.cfspf_plugin = no
Setting the Dns,spam locker depends heavily on the DNS library, and you must install NET::D NS libraries to work correctly (installed on AMAVISD)
[Email protected] ~]# echo "nameserver 202.101.224.68" >>/etc/resolv.conf
2. Start
[[email protected] ~]# /usr/local/slockd/slockd-init start[[email protected] ~]# echo "/usr/local/slockd/slockd-init start" >> /etc/rc.d/rc.local[[email protected] ~]# ps aux|grep slockdroot 33573 0.0 0.6 137316 6428 ? SNs 16:00 0:00 slockd (Master) root 33574 0.5 1.2 165324 12432 ? sn 16:00 0:00 slockd (Idle) root 33575 0.5 1.2 165328 12416 ? sn 16:00 0:00 slockd (Idle) root 33591 0.0 0.0 103256 848 pts/1 s+ 16:01 0:00 grep slockd[[email protected] tools]# netstat -tnlp|grep 10030tcp 0 0 127.0.0.1:10030 0.0.0.0:* LISTEN 33573/slockd (maste
3. View Logs
[[email protected] ~]# tail/var/log/slockd.logstarting child 33574starting child 33575
4. Test SLOCKD
[[email protected] ~]# Cd/usr/local/slockd/tools[[email protected] tools]# perl policy_sig-h localhost-p 10030--helo F Oobar--ip 192.168.0.1--from [email protected]--to [email protected]action=554 blocked using zen.spamhaus.org, see http: bl.extmail.org/cgi/rbl?192.168.0.1
Returning 554 indicates that the SLOCKD is working properly and viewing the log;
[Email protected] tools]# tail/var/log/slockd.logstarting child 3369712-05 16:24:45 [33693]: Socket error: No file or directory #这 A mistake for the moment did not find the reason 12-05 16:24:45 [33693]: [554 blocked using zen.spamhaus.org, see http://bl.extmail.org/cgi/rbl?192.168.0.1, From=<[email protected]> to=<[email protected]> helo=<foobar> ip=<192.168.0.1> client=< >]12-05 16:24:45 [33693]: Policy mode:nope12-05 16:24:45 [33693]: [Session ended and closing socket]
Open the URL in the error to see why:
http://bl.extmail.org/cgi/rbl?192.168.0.1
192.168.0.1 has been blocked by APF server or SLOCKD's RBL to send an excessive amount of spam your host is open relay (Open-relay) Your host has been infected by a virus or worm your host is misconfigured or does not meet the RFC requirements
Enable the SPF plug-in and restart the process:
[Email protected] ~]# Vi/usr/local/slockd/config/plugin.cfspf_plugin = yes[[email protected] ~]#/usr/local/slockd/ Slockd-init Stop[[email protected] ~]#/usr/local/slockd/slockd-init start
Re-testing will be reported 551:
12-05 16:03:22 [33574]: [551 see Http://bl.extmail.org/cgi/[email protected], From=<[email protected]> to=<[ Email protected]> helo=<foobar> ip=<192.168.0.1> Client=<>]
Open the URL in the error to see why:
http://bl.extmail.org/cgi/[email protected]
You do not receive authorization to send a message in the name of foo.com: Your IP address has not been authorized by the sender's name SPF record and your IP address has not been authorized by the sender domain name MSPF record.
5, Configuration Postfix integrated SLOCKD
[[email protected] tools]# vi/etc/postfix/main.cf# at the end of the recipient limit option plus smtpd_recipient_restrictions = ..., check_policy_ser Vice inet:127.0.0.1:10030 [[email protected] tools]# service Postfix Reload
6, plug-in introduction
(1) Plug-in configuration
The plug-in execution order is determined by the location of the plug-in in the configuration file PLUGIN.CF.
[[Email protected] tools]# vi /usr/local/slockd/config/plugin.cf# spamtrap Plugin: Garbage Sender Address Collection trap Spamtrap_plugin = yesspamtrap_list = config/spamtrap_listspamtrap_action = FILTER spamtrap:# local black-and-white list plugin localctrl_plugin = yes# blacklist, whitelist (while controlling both the pickup and the sender) Localctrl_ bl = config/blacklistlocalctrl_wl = config/whitelist# sender Black and white list localctrl_sender_bl = config/sender_blacklistlocalctrl_sender_wl = config/sender_whitelist# recipient black and white list LOCALCTRL_RECIP_BL &NBSP;=&NBSP;CONFIG/RECIP_BLACKLISTLOCALCTRL_RECIP_WL&NBSP;=&NBSP;CONFIG/RECIP_WHITELIST#&NBSP;SPF record detection plug-in spf_ plugin = no# reject code is hard error or soft error, no is hard error 5xxspf_soft_reject = no# valid pass, return OK, illegal is wrong, If not sure, return to the dunnospf_default_action = dunno# multi-RBL Query plugin dnsbl_plugin = no# Reject code is hard or soft error, no is hard error 5xxdnsbl_soft_reject = no# rbl server list # few RBL may intercept too sensitive, We recommend using only the following two RBL or not using Dnsbl_server_list = zen.spamhaus.org, bl.spamcop.net,# Gray List Technology plugin greylist_plugin = yes# Database path to store records greylist_db = /var/lib/greylist.db# delay Time greylist_delay = 60
(2) Local black and white list plugin description:
Filter rules:
Messages come in---Extract sender address information---whitelist---blacklist--sender_whitelist--
--sender_blacklist----Enter the user's mailbox or the next process
Precautions:
Blacklist\whitelist only support domain name, can not set up a single mailbox account or IP
Recipient_whitelist In addition to jumping open slockd detection, but also jump open amavisd/dspam and ClamAV, etc.;
It is recommended not to place the local area in the recipient_whitelist;
It is recommended that you do not randomly place the domain that is easily counterfeited, such as 163, into the sender_whitelist.
(3) Multi-channel RBL Query plugin Description:
SLOCKD's RBL feature often judges large carrier mailboxes as garbage and returns them to the sender,
Disable the SLOCKD RBL service and use Dspam to filter the spam messages;
The default comes with many RBL server addresses, and only the following two are recommended if you need to use them:
Zen.spamhaus.org,
Bl.spamcop.net,
(4) Gray list technical Pendant description:
Grey List technical design is largely based on the principle of a retry, that is, the first time you see an IP to send a message to a recipient,
Then it will simply return a temporary error (4xx) and reject the request, and the normal mail server will be
Time (such as half an hour) to re-send the message. Greylist discovery or just the same IP address and the recipient, think this
IP is from a legitimate server and is released. If it is a non-normal message, then it will never be retried again.
Or it would be crazy to retry, but was rejected because the interval was too close. So, greylist just set a proper clearance interval,
To a large extent, this kind of spam has a good immune ability. One of the characteristics of greylist is not to lose letters,
The regular mail server thinks that the 4xx error is only a temporary, soft error, and will retry at intervals, so the message can be delivered successfully.
7. Test SLOCKD black and white list
(1) Test sender blacklist
Description: Postfix will leave the local domain and test reject external mailbox senders:
[Email protected] ~]# Vi/usr/local/slockd/config/sender_blacklist[email protected]
Note: If you build a test mailbox server, no public domain name, you can build a mailbox server in the intranet, as an external mailbox for testing, in my future documentation is also necessary.
Send email to [email protected] using [email protected] Email
You will receive a return notification:
Recipient address rejected:blocked by Localctrl, see Http://bl.extmail.org/cgi/why?localctrl
To view the SLOCKD log:
[Email protected] ~]# tail/var/log/slockd.log 12-08 10:52:41 [20849]: [504 blocked by Localctrl, see Http://bl.extmail. Org/cgi/why?localctrl, From=<[email protected]> to=<[email protected]> helo=<mail.eplantstore.com > ip=<10.188.1.86> client=<unknown>]
Conclusion: You can see that the message was successfully rejected by the local blacklist plugin Localctrl.
(2) Test recipient blacklist
[Email protected] ~]# Vi/usr/local/slockd/config/receip_blacklist[email protected]
Use [email protected] email to [email protected] and [email protected] respectively to send an email,
The result of test is not received, postmaster can receive,
Indicates that the recipient blacklist successfully blocked the local domain of a mailbox account to receive external mail;
Use [email protected] to send an e-mail to [email protected]
The result test can be received because Postfix trusts the local domain (mynetwork) mailbox,
To enable local mailbox interoperability restrictions, you can use Postfix's own Access table, which you'll talk about later in the "Restrictions" section.
Conclusion: SLOCKD has been integrated with postfix, you can use the blacklist to block external senders and block local mailboxes from receiving external mail.
This article is from the "Moon Ching Xing Fei" blog, please be sure to keep this source http://ywzhou.blog.51cto.com/2785388/1591600
Postfix e-mail (eight): Install anti-spam system spam Locker