Membuat Account Pelaporan Spam AutoTrain Bogofilter

From OnnoWiki
Jump to navigation Jump to search

Skenario yang di kembangkan adalah sebagai berikut:

  • user yang memperoleh spam memforward ke e-mail spam, misalnya, spamreport@target.com
  • e-mail di terima di mailbox spamreport@target.com
  • e-mail langsung di proses untuk menjadi training bagi bogofilter

Langkah Pembuatan-nya adalah sebagai berikut:

Install Procmail dan Account spamreport

Install procmail dan Membuat account spamreport

apt-get install procmail
adduser spamreport

Login ke account spamreport

ssh spamreport@localhost


Cek Procmail

Cek kondisi procmail

procmail -v
procmail v3.22 2001/09/10
    Copyright (c) 1990-2001, Stephen R. van den Berg	<srb@cuci.nl>
    Copyright (c) 1997-2001, Philip A. Guenther		<guenther@sendmail.com> 

Submit questions/answers to the procmail-related mailinglist by sending to: 
	<procmail-users@procmail.org>

And of course, subscription and information requests for this list to:
	<procmail-users-request@procmail.org>

Locking strategies:	dotlocking, fcntl()
Default rcfile:		$HOME/.procmailrc
	It may be writable by your primary group
Your system mailbox:	/var/mail/spamreport

Check Shell dan bogofilter

Check shell

which sh

akan keluar

/bin/sh

Check bogofilter

which bogofilter

akan keluar

/usr/bin/bogofilter

Buat ~/.procmailrc

Edit file ~/.procmailrc

vi ~/.procmailrc
#Preliminaries
SHELL=/bin/sh               #Use the Bourne shell (check your path!)
MAILDIR=/home/spamreport     #First check what your mail directory is!
LOGFILE=${MAILDIR}/procmail.log
LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "

# Submit to bogofilter to train
:0
| bogofilter -d /home/bogofilter/ -M -s < /var/spool/mail/spamreport && > /var/spool/mail/spamreport

Pastikan spamreport bisa membaca file tersebut

chmod u+r ~/.procmailrc

Check lokasi procmail dan ID spamreport

Cek lokasi procmail

which procmail

keluar

/usr/bin/procmail

Cek ID spamreport

whoami

Keluar

spamreport

Konfigurasi .forward

Edit .forward

vi ~/.forward

masukan kalimat

"|IFS=' ' && exec /usr/bin/procmail || exit 75 #spamreport"

Ubah permission .forward

chmod 644 ~/.forward

Cek permission spamreport

Cek permission home directory spamreport

 ls -lFd ~/

pastikan keluar

drwx--s--x

atau

drwxr-xr-x

Jika tidak lakukan

chmod u+rwx ~/
chmod og+x ~/
ls -lFd ~/

Pranala Menarik