Basically, I'll have a maildir called Spam, with maildirs underneath it. i.e.
Code: Select all
Spam
|---Unverified
|---Undetected
|---Misdetected
`---VerifiedWhen it's done, I'll PM it to you beowulf
Cheers,
Chris.
Code: Select all
Spam
|---Unverified
|---Undetected
|---Misdetected
`---Verified2)ACCEPT_KEYWORD="~x86" emerge Mail-SpamAssassin
Leave the rest of the file as it is described at the beginning of this guide.#set up a Spam maildir where all the spam goes for teaching SA spam vs. non-spam
#and to be sure that no mail - even if detected as spam - gets lost (like when you pipe it to /dev/null)
SPAM_FOLDER= $MAILDIR/.spam/
#pipe mails through SA (this is basically from the example files
#but I use a higher limit, every mail up to 512 kB is filtered)
#spamc is the client programm for the daemonized
#version of SA (designed to keep load and overhead down)
#If you don't run SA as a daemon change "spamc" to "/usr/bin/spamassassin"
#If you do use spamc here you must add spamd to your runlevel
#like this:rc-update add spamd default
:0fw: spamassassin.lock
* < 524288
| spamc
#All mail tagged as spam (eg. with a score higher than the set threshold)
#is moved to ".spam".
:0:
* ^X-Spam-Status: Yes
$SPAM_FOLDER
#Work around procmail bug: any output on stderr will cause the "F" in
#"From" to be dropped. This will re-add it.
#(This is taken directly from the SA example file)
:0
* ^^rom[ ]
{
LOG="*** Dropped F off From_ header! Fixing up. "
:0 fhw
| sed -e '1s/^/F/'
}
Code: Select all
maildirmake -f spam ~/.maildir/So, I hope I haven't left out anything but I think this is all needed to enable spam-filtering with SpamAssassin.#This scans for spam and for good mails every half hour.
#Set the interval (30 minutes) appropriatly for your convenience and the amount of mails you get.
*/30 * * * * sa-learn --dir --spam /root/.maildir/.spam > /dev/null 2>&1
*/30 * * * * sa-learn --dir --ham /root/.maildir/ > /dev/null 2>&1
X-Spam-Status: No, hits=2.1 required=5.0
tests=HTML_00_10,HTML_MESSAGE,NO_REAL_NAME
version=2.55
X-Spam-Level: **
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
Taskara:taskara wrote:ok
I've re-emerged openssl and re runit asks meCode: Select all
./CA.pl -newcaI just press enter.CA certificate filename (or enter to create)
then it continues askingif I just press "enter" it saysMaking CA certificate ...
Using configuration from /etc/ssl/openssl.cnf
Generating a 1024 bit RSA private key
...........................++++++
.................++++++
writing new private key to './demoCA/private/cakey.pem'
Enter PEM pass phrase:what do I put in for the PEM pass phrase ?Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:
phrase is too short, needs to be at least 4 chars
Enter PEM pass phrase:
looks like I'm getting somewhere.. thanks!
I changed the directory from ".maildir/cur" to just ".maildir", sa-learn seems to know his way around in maildirs. So there is no need to specify the "/cur".*/30 * * * * sa-learn --dir --ham /root/.maildir/ > /dev/null 2>&1
#spamc is the client programm for the daemonized
#version of SA (designed to keep load and overhead down)
#If you don't run SA as a daemon change "spamc" to "/usr/bin/spamassassin"
#If you do use spamc here you must add spamd to your runlevel
#like this:rc-update add spamd default
Code: Select all
$ cd ~/.maildir
$ mkdir .Spam{,.False-Positives,.False-Negatives}
$ mkdir .Spam{,.False-Positives,.False-Negatives}/{cur,tmp,new}Code: Select all
mkdir .Ham
mkdir .Ham/{cur,tmp,new}Code: Select all
~/Bin/bogotrainerCode: Select all
#! /usr/bin/python
import os, os.path
#Configuration entries. Not much ATM. More if needed.
bogodir = "~/.bogofilter/"
maildir = "~/.maildir/"
#Leave everything below here unless you want to do some hacking :)
needdbs = 0
bogodir = os.path.expanduser(bogodir)
maildir = os.path.expanduser(maildir)
def cleanhamdirs(dir):
#We don't want Spam in the hamdirs :)
if dir[len(maildir):len(maildir) + 5] == ".Spam":
return 0
#The maildirs of the inbox, must be handled especially
if dir[len(maildir):len(maildir) + 3] == "cur":
return 0
if dir[len(maildir):len(maildir) + 3] == "tmp":
return 0
if dir[len(maildir):len(maildir) + 3] == "new":
return 0
#If you threw it away, you obviously don't want it :)
if dir[len(maildir):len(maildir) + 6] == ".Trash":
return 0
return 1
if os.path.isdir(bogodir):
print "Bogofilter directory found"
#I'm just assuming if the spamlist.db exists, goodlist.db does too
#Program will die if goodlist.db doesn't exist anyway.
if os.path.isfile(os.path.join(bogodir, "spamlist.db")):
print "Databases found"
else:
print "Databases NOT found. Generating..."
needdbs = 1
else:
print "Bogofilter directory NOT found. Generating..."
needdbs = 1
if needdbs:
print "Generating databases:"
print "Regestering spam messages from", os.path.join(maildir,".Spam/cur")
spamlist = os.listdir(os.path.join(maildir,".Spam/cur"))
for spam in spamlist:
spampath = os.path.join(maildir,".Spam/cur/",spam)
print "- ", spampath
os.system("bogofilter -s < " + spampath)
if os.path.isdir(os.path.join(maildir, ".Ham")):
#If a specific .Ham dir exists, use that.
print "Regestering spam messages from", os.path.join(maildir,".Ham/cur")
hamlist = os.listdir(os.path.join(maildir,".Ham/cur"))
for ham in hamlist:
hampath = os.path.join(maildir,".Ham/cur",ham)
print "- ", hampath
os.system("bogofilter -n < " + hampath)
else:
#Or else, use everything that isn't spam!
print "Registering spam messages from", os.path.join(maildir,"cur")
hamlist = os.listdir(os.path.join(maildir,"cur"))
for ham in hamlist:
hampath = os.path.join(maildir,"cur",ham)
print "- ", hampath
os.system("bogofilter -n < " + hampath)
maildirs = [os.path.join(maildir,dir) for dir in os.listdir(maildir)]
maildirs = filter(os.path.isdir, maildirs)
maildirs = filter(cleanhamdirs, maildirs)
for dir in maildirs:
print "Regestering ham messages from", dir
hamlist = os.listdir(os.path.join(dir,"cur"))
for ham in hamlist:
hampath = os.path.join(dir,"cur",ham)
print "- ", hampath
os.system("bogofilter -n < " + hampath)
# So, everything exists, this must be an "updating run", easy!
# First, correct misdetected ham from the false-positives directory,
# and move it into the inbox.
print "Correcting ham messages from", os.path.join(maildir,".Spam.False-Positives")
hamlist = os.listdir(os.path.join(maildir,".Spam.False-Positives/cur"))
for ham in hamlist:
hampath = os.path.join(maildir,".Spam.False-Positives/cur",ham)
print "- ", hampath
os.system("bogofilter -Sn < " + hampath)
#Feed it back through procmail :)
os.system("/usr/bin/procmail -d $USER < " + hampath)
os.remove(hampath)
# Now, correct misdetected spam, and put it in the Spam maildir :)
print "Correcting spam messages from", os.path.join(maildir,".Spam.False-Negatives")
spamlist = os.listdir(os.path.join(maildir,".Spam.False-Negatives/cur"))
for spam in spamlist:
spampath = os.path.join(maildir,".Spam.False-Negatives/cur",spam)
print "- ", spampath
os.system("bogofilter -Ns < " + spampath)
#Don't bother procmailing it, put it in spam! :)
os.rename(spampath, os.path.join(maildir,".Spam/cur",spam))Code: Select all
chmod +x ~/Bin/bogotrainerCode: Select all
rm -rf ~/.bogofilterCode: Select all
~/Bin/bogotrainerCode: Select all
#Bogofilter filtering solution.
:0fw
| bogofilter -u -e -p
:0e
{ EXITCODE=75 HOST }
:0:
* ^X-Bogosity: Yes,
.Spam/Code: Select all
crontab -e
* 23 * * * ~/Bin/bogotrainer >/dev/null 2>&1Ahh geeze, sorry to hear you've gotten stuck... i understand it must be trying on your patience... anyways, when i said to make the .fetchmailrc file executable, we did just that... by the command "chmod 710 ~/.fetchmailrc"taskara wrote:yeah thanks guys,
as beowulf said I did finally find a solution..
I was trying to make a new ssl certificate while I was logged in via ssh, and I did get an error about shared libraries at one stage.
I un emerged ssl, deleted /etc/ssl and rebooted.
upon reboot ssh could not start (cause there was no ssl)
I re-built ssl, created the new certificates, restarted ssh and it came back up.
not sure if this was the cause, but it seemed to get it working for me.. thanks for your patience and brain stormingmuch appreciated.
I got a little further along the guide... but got stuck somewhere else.. so I've kinda given up.
while I remember, there was one section that said "let's make out .fetchmailrc file executable", but I think the step is actually skipped, but changing the permissions of the file is included.. someone who knows what their doing can prob verify / deny this.
so for now I am sending straight through my isps mail server.The connection to the server has failed. Account: 'Chris' IMAP Mail', Server: '192.168.0.10', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error: 10061, Error Number: 0x800CCC0E
Code: Select all
crontab -e
Is there a trick to it? The relevant section of my mail.cf reads as follows:Jun 25 18:58:11 [postfix/smtp] connect to mailin-02.mx.aol.com[64.12.137.184]: server refused mail service (port 25)
Jun 25 18:58:12 [postfix/smtp] connect to mailin-03.mx.aol.com[64.12.138.57]: server refused mail service (port 25)
Jun 25 18:58:12 [postfix/smtp] connect to mailin-01.mx.aol.com[64.12.137.89]: server refused mail service (port 25)
Code: Select all
# cat /etc/postfix/main.cf | grep "smtp_sasl"
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_sasl_security_options =
Code: Select all
# ls -l /etc/postfix/saslpass
-rw------- 1 root root 175 Jun 25 10:40 /etc/postfix/saslpass
# cat /etc/postfix/saslpass
# $Header: /home/cvsroot/gentoo-x86/net-mail/postfix/files/saslpass,v 1.1 2002/07/13 20:17:14 raker Exp $
#
# remotehost user:password
foo.bar.net user:password
Code: Select all
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_tls_key_file = /etc/postfix/newreq.pem
smtpd_tls_cert_file = /etc/postfix/newcert.pem
smtpd_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandomCode: Select all
# cat /etc/postfix/main.cf | grep tlsCode: Select all
$ idCode: Select all
grep -v ^# /etc/postfix/main.cf | grep smtpCode: Select all
# ls -l /etc/sasl2/sasldb2
-rw-r----- 1 postfix root xxxxxxxx /etc/sasl2/sasldb2
Code: Select all
root@server # cat /etc/postfix/main.cf | grep smtp_sasl
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_sasl_security_options =

Amazing! A multi-support!beowulf wrote:[...]Can you post this output:Did you set up the file in /etc/sasl2/sasldb2?Code: Select all
grep -v ^# /etc/postfix/main.cf | grep smtpCode: Select all
# ls -l /etc/sasl2/sasldb2 -rw-r----- 1 postfix root xxxxxxxx /etc/sasl2/sasldb2
Code: Select all
# grep -v ^# /etc/postfix/main.cf | grep smtp
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_sasl_security_options =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains
# ls -l /etc/sasl2/sasldb2
-rw------- 1 postfix root 12288 Jun 25 18:54 /etc/sasl2/sasldb2
root@server chris # cat /etc/postfix/main.cf | grep tls
smtpd_use_tls = yes
smtpd_tls_auth_only = yes
smtpd_tls_key_file = /etc/postfix/newreq.pem
smtpd_tls_cert_file = /etc/postfix/newcert.pem
smtpd_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom