<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://studioware.com/wikislax/index.php?action=history&amp;feed=atom&amp;title=SpamAssassin</id>
		<title>SpamAssassin - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://studioware.com/wikislax/index.php?action=history&amp;feed=atom&amp;title=SpamAssassin"/>
		<link rel="alternate" type="text/html" href="http://studioware.com/wikislax/index.php?title=SpamAssassin&amp;action=history"/>
		<updated>2026-05-07T15:11:01Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.29.2</generator>

	<entry>
		<id>http://studioware.com/wikislax/index.php?title=SpamAssassin&amp;diff=28&amp;oldid=prev</id>
		<title>Wikislax: Created page with &quot;{{RightTOC}}  == What is SpamAssassin ? ==  [http://spamassassin.apache.org/index.html SpamAssassin] checks mail for spam using syntactic rules in perl and optional external m...&quot;</title>
		<link rel="alternate" type="text/html" href="http://studioware.com/wikislax/index.php?title=SpamAssassin&amp;diff=28&amp;oldid=prev"/>
				<updated>2017-12-06T21:31:28Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{RightTOC}}  == What is SpamAssassin ? ==  [http://spamassassin.apache.org/index.html SpamAssassin] checks mail for spam using syntactic rules in perl and optional external m...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{RightTOC}}&lt;br /&gt;
&lt;br /&gt;
== What is SpamAssassin ? ==&lt;br /&gt;
&lt;br /&gt;
[http://spamassassin.apache.org/index.html SpamAssassin] checks mail for spam using syntactic rules in perl and optional external modules. SpamAssassin integration with MTAs requires glue code such as external daemons (amasvid-new) or [[MIMEDefang]] with the sendmail [[Milter]] interface.&lt;br /&gt;
&lt;br /&gt;
== Installing Perl modules ==&lt;br /&gt;
&lt;br /&gt;
Perl modules can be installed interactively using the CPAN module &amp;quot;# '''perl -MCPAN -e shell'''&amp;quot;. On first use, CPAN asks questions most of which can be answered by &amp;lt;enter&amp;gt;. Choose to automatically install the missing modules when detected by CPAN. In theory, this would insure that all the missing modules are installed. In practise, SpamAssassin did not work properly (no spam detected) after installing in this way, so we'd recommend to install the perl modules instead in the order described below, which worked for us.&lt;br /&gt;
&lt;br /&gt;
The modules are distributed in sub-directories of /usr/local/lib64/perl5 and /usr/local/share/perl5. It is still unclear if modules can be removed or not and how. Any module failing installation can alternatively be downloaded from the [http://www.cpan.org CPAN] site and installed in this way :&lt;br /&gt;
&lt;br /&gt;
 # tar -C /usr/local -xvf module-x.y.z&lt;br /&gt;
 # cd /usr/local&lt;br /&gt;
 # chown -R root:root module-x.y.z&lt;br /&gt;
 # cd module-x.y.z&lt;br /&gt;
 # perl Makefile.PL&lt;br /&gt;
 # make&lt;br /&gt;
 # make install&lt;br /&gt;
&lt;br /&gt;
== Modules required by SpamAssassin ==&lt;br /&gt;
&lt;br /&gt;
The modules below must be installed prior to installing SpamAssassin :&lt;br /&gt;
&lt;br /&gt;
 # perl -MCPAN -e shell&lt;br /&gt;
 . . .&lt;br /&gt;
 cpan&amp;gt; install CPAN&lt;br /&gt;
 cpan&amp;gt; install YAML&lt;br /&gt;
 cpan&amp;gt; install Digest::SHA1&lt;br /&gt;
 cpan&amp;gt; install HTML::Parser&lt;br /&gt;
 cpan&amp;gt; install Net::DNS&lt;br /&gt;
 cpan&amp;gt; install LWP::UserAgent&lt;br /&gt;
 cpan&amp;gt; install HTTP::Date&lt;br /&gt;
 cpan&amp;gt; install IO::Zlib&lt;br /&gt;
 cpan&amp;gt; install Archive::Tar&lt;br /&gt;
 cpan&amp;gt; install MIME::Base64&lt;br /&gt;
 cpan&amp;gt; install DB_File&lt;br /&gt;
 cpan&amp;gt; install Net::SMTP&lt;br /&gt;
 cpan&amp;gt; install Mail::SPF&lt;br /&gt;
 cpan&amp;gt; install IP::Country::Fast&lt;br /&gt;
 cpan&amp;gt; install Compress::Zlib&lt;br /&gt;
 cpan&amp;gt; install Time::HiRes&lt;br /&gt;
 cpan&amp;gt; install Mail::DKIM&lt;br /&gt;
 cpan&amp;gt; install Mail::DomainKeys&lt;br /&gt;
 cpan&amp;gt; install DBI&lt;br /&gt;
 cpan&amp;gt; install DBD&lt;br /&gt;
 cpan&amp;gt; install Encode::Detect&lt;br /&gt;
 cpan&amp;gt; install Mail::SPF::Query&lt;br /&gt;
 cpan&amp;gt; install Net::Ident&lt;br /&gt;
 cpan&amp;gt; install IO::Socket::SSL&lt;br /&gt;
 cpan&amp;gt; install Bundle::CPAN&lt;br /&gt;
 cpan&amp;gt; install IO::Stringy&lt;br /&gt;
 cpan&amp;gt; install Mail::Audit&lt;br /&gt;
 cpan&amp;gt; install Unix::Syslog&lt;br /&gt;
 cpan&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
== Installing SpamAssassin ==&lt;br /&gt;
&lt;br /&gt;
[http://spamassassin.apache.org/downloads.cgi Download] and untar and install as below then test using the spamassassin command and check the files generated to make sure everything was OK. The -D flag affords getting an extended trace on the system output :&lt;br /&gt;
&lt;br /&gt;
 # tar -tvf Mail-SpamAssassin-x.y.z.tar.gz&lt;br /&gt;
 # tar -C /usr/local -xvf Mail-SpamAssassin-x.y.z.tar.gz&lt;br /&gt;
 # cd /usr/local/Mail-SpamAssassin-x.y.z&lt;br /&gt;
 # perl Makefile.PL&lt;br /&gt;
 # make&lt;br /&gt;
 # make install&lt;br /&gt;
 # sa-update --updatedir /usr/local/share/spamassassin&lt;br /&gt;
 # spamassassin -t -D &amp;lt; sample-nonspam.txt &amp;gt; nonspam.out&lt;br /&gt;
 # spamassassin -t -D &amp;lt; sample-spam.txt &amp;gt; spam.out&lt;br /&gt;
&lt;br /&gt;
In practice, the basic syntactic tests in SpamAssassin are not very efficient. External modules can be used to extend, but are somewhat CPU or time-consuming. Below are a few modules that really work.&lt;br /&gt;
&lt;br /&gt;
== Installing SPF ==&lt;br /&gt;
&lt;br /&gt;
[http://www.openspf.org Sender Policy Framework] is a protocol to make sure senders send from legitimate domains. Install as below :&lt;br /&gt;
&lt;br /&gt;
 # perl -MCPAN -e shell&lt;br /&gt;
 . . .&lt;br /&gt;
 cpan&amp;gt; install Mail::SPF&lt;br /&gt;
 cpan&amp;gt; install Mail::SPF::Query&lt;br /&gt;
&lt;br /&gt;
== Installing DCC ==&lt;br /&gt;
&lt;br /&gt;
The [http://www.rhyolite.com/anti-spam/dcc Distributed Checksum Clearinghouse] uses checksums of known spam to score the incoming mails. [http://www.rhyolite.com/anti-spam/dcc/source/dcc.tar.Z Download] then install as below :&lt;br /&gt;
&lt;br /&gt;
 # tar -C /usr/local -xvzf dcc.tar.Z&lt;br /&gt;
 # cd /usr/local/dcc-x.y.z&lt;br /&gt;
 # ./configure&lt;br /&gt;
 # make&lt;br /&gt;
 # make install&lt;br /&gt;
 # make clean&lt;br /&gt;
 # cd /var&lt;br /&gt;
 # mkdir dcc&lt;br /&gt;
 # groupadd milter&lt;br /&gt;
 # useradd -g milter -s /bin/bash milter&lt;br /&gt;
 # chown -R milter:milter dcc&lt;br /&gt;
&lt;br /&gt;
To use dcc, uncomment the dcc line in /etc/mail/spamassassin/v310.pre. Also authorize udp connections to port 6277  from your client ports and back. Provided you already accept outgoing protocols, accept port 6277 udp packets modifying /etc/rc.d/rc.firewall as below :&lt;br /&gt;
&lt;br /&gt;
 # vi /etc/rc.d/rc.firewall&lt;br /&gt;
 . . .&lt;br /&gt;
 iptables -A INPUT -p udp -j ACCEPT --dport 1024:65535 --sport 6277&lt;br /&gt;
 :x&lt;br /&gt;
 # /etc/rc.d/rc.firewall restart&lt;br /&gt;
&lt;br /&gt;
== Installing Razor ==&lt;br /&gt;
&lt;br /&gt;
[http://razor.sourceforge.net Razor] uses checksums of known spam to score the incoming mails. It requires outbound access to tcp ports 7 and 2703. It requires perl modules Time::HiRes and Getopt::Long plus download razor-agents-x.y.tar.gz and install as below :&lt;br /&gt;
&lt;br /&gt;
 # perl -MCPAN -e shell&lt;br /&gt;
 . . .&lt;br /&gt;
 cpan&amp;gt; install Time::HiRes&lt;br /&gt;
 cpan&amp;gt; install Getopt::Long&lt;br /&gt;
 quit&lt;br /&gt;
 # tar -C /usr/local -xvf razor-agents-x.y.tar.gz&lt;br /&gt;
 # cd razor-agents-x.y&lt;br /&gt;
 # perl Makefile.PL &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install &amp;amp;&amp;amp; make clean&lt;br /&gt;
 # cd&lt;br /&gt;
 # razor-admin -create&lt;br /&gt;
 # razor-admin -discover&lt;br /&gt;
 # razor-admin -register&lt;br /&gt;
&lt;br /&gt;
== Installing Pyzor ==&lt;br /&gt;
&lt;br /&gt;
[http://sourceforge.net/apps/trac/pyzor Pyzor] is a free database and software Hash Sharing System. It requires outbound access to udp and tcp port 24441 (from the mailing lists on the Pyzor site it seems that the Pyzor service is sometimes down). Download the tarball then install as below :&lt;br /&gt;
&lt;br /&gt;
 # tar -C /usr/local -xvf pyzor-x.y.z.tar.bz2&lt;br /&gt;
 # chown -R milter:milter /usr/local/pyzor-x.y.z&lt;br /&gt;
 # wget https://bootstrap.pypa.io/ez_setup.py -O - | python&lt;br /&gt;
 # su milter&lt;br /&gt;
 $ cd /usr/local/pyzor-x.y.z&lt;br /&gt;
 $ python setup.py build&lt;br /&gt;
 $ python setup.py install&lt;br /&gt;
 $ pyzor discover&lt;br /&gt;
 $ &amp;lt;ctrl&amp;gt;d&lt;br /&gt;
 # mv /usr/bin/pyzor /usr/local/bin&lt;br /&gt;
 # mv /usr/bin/pyzord /usr/local/bin&lt;br /&gt;
&lt;br /&gt;
== Language and locale check ==&lt;br /&gt;
&lt;br /&gt;
Uncomment the TextCat language guesser in v310.pre and add the following lines to local.cf :&lt;br /&gt;
&lt;br /&gt;
 # Mail using languages used in these country codes will not be marked&lt;br /&gt;
 # as being possibly spam in a foreign language.&lt;br /&gt;
 # - english french italian russian&lt;br /&gt;
 ok_languages en fr it ru&lt;br /&gt;
 &lt;br /&gt;
 # Mail using locales used in these country codes will not be marked&lt;br /&gt;
 # as being possibly spam in a foreign language.&lt;br /&gt;
 # - english french italian russian&lt;br /&gt;
 ok_locales en fr it ru&lt;br /&gt;
&lt;br /&gt;
Another possible option to create local.cf is to use the [http://www.yrex.com/spam/spamconfig.php Spam Assassin configuration generator].&lt;br /&gt;
&lt;br /&gt;
== The Bayes module ==&lt;br /&gt;
&lt;br /&gt;
The SpamAssassin Bayes module uses databases of previously registered hams and spams to compare with incoming mails and assign probabilities. The module requires at least 200 hams and 200 spams in order to be used (enforced at run-time), but 3000 hams and 3000 spams to be fully efficient. You must provide the training mails. sa-learn affords analyzing them and initializing the databases using mbox or mbx mail folders. However, when using cyrus-imap, none of these formats is available. It is alternatively possible to use fetchmail to dump the messages from the existing cyrus-imap mailboxes. In the example below LearnSpam and LearnHam are shared imap folders that can be created using cyradm :&lt;br /&gt;
&lt;br /&gt;
 # cyradm --user postmaster --auth plain localhost&lt;br /&gt;
 Password: &lt;br /&gt;
 localhost&amp;gt; cm LearnHam&lt;br /&gt;
 localhost&amp;gt; sq LearnHam 307200&lt;br /&gt;
 localhost&amp;gt; sam LearnHam myUser lrswipcda&lt;br /&gt;
 localhost&amp;gt; cm LearnSpam&lt;br /&gt;
 localhost&amp;gt; sq LearnSpam 307200&lt;br /&gt;
 localhost&amp;gt; sam LearnSpam myUser lrswipcda&lt;br /&gt;
 localhost&amp;gt; quit&lt;br /&gt;
&lt;br /&gt;
Once the shared imap folders are created ham and spam mails can be manually copied using for example Thunderbird (not shown here). The Bayes database is created in the ~/.spamassassin directory using :&lt;br /&gt;
&lt;br /&gt;
 # sa-learn --clear&lt;br /&gt;
 # sa-learn --sync&lt;br /&gt;
 # sa-learn --dump magic&lt;br /&gt;
&lt;br /&gt;
Before invoking fetchmail create a .fetchmailrc configuration file with permissions 700 :&lt;br /&gt;
&lt;br /&gt;
 # vi ~/.fetchmailrc&lt;br /&gt;
 . . .&lt;br /&gt;
 poll inner.studioware.com proto imap service 993 user &amp;quot;myUser&amp;quot; pass &amp;quot;myPass&amp;quot; ssl keep&lt;br /&gt;
 &amp;lt;esc&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fetchmail can now be invoked passing the mails to learn to sa-learn :&lt;br /&gt;
&lt;br /&gt;
 # fetchmail --folder 'LearnSpam' -m 'sa-learn --spam'&lt;br /&gt;
 # fetchmail --folder 'LearnHam' -m 'sa-learn --ham'&lt;br /&gt;
&lt;br /&gt;
== Running SpamAssassin ==&lt;br /&gt;
&lt;br /&gt;
SpamAssassin is not ran as such but used from the perl in MIMEDefang, itself being launched by the sendmail milter interface. So there is no daemon to put in place and nothing to launch !&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{pFoot|[[Cyrus-IMAP]]|[[Main Page]]|[[ClamAV]]}}&lt;/div&gt;</summary>
		<author><name>Wikislax</name></author>	</entry>

	</feed>