QMail – Simscan testing (CentOS 7)

Published by Lello on

Vediamo ora di testare il corretto funzionamento di Simscan

Test Antispam

Proviamo a testare inizialmente solo il funzionamento del modulo antispam; inseriamo nel file /etc/qmail/simcontrol:

dave@anthesia.lan:clam=no,spam=yes,spam_hits=6.5
:clam=yes,spam=yes,spam_hits=20

Il file /etc/qmail/tcp.smtp permette l’accesso alla porta 25 sia su localhost che tramite la nostra lan:

127.:allow,QMAILQUEUE="/var/qmail/bin/simscan"
172.28.0.0/22:allow,QMAILQUEUE="/var/qmail/bin/simscan"

Ricreiamo i file cdb:

# qmailctl cdb
# /var/qmail/bin/simscanmk

Per inviare in attach e file, uso un piccolissimo programma che è sendEmail:

# cd /usr/src
# wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz
# tar xvfz sendEmail-v1.56.tar.gz
# cp sendEmail-v1.56/sendEmail /usr/local/bin
# chmod +x /usr/local/bin/sendEmail

Mandiamo un messaggio al nostro utente dave che contiene il GTUBE Test (Generic Test for Unsolicited Bulk Email):

# sendEmail -f "realuser@realdomain" -t dave@anthesia.lan -m "Prova spam " -o tls=no -m "XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X"

Vediamo cosa troviamo nel file di log /var/qmail/qmail-smtpd/current:

2014-09-18 11:35:53.244706500 tcpserver: status: 1/20
2014-09-18 11:35:53.244879500 tcpserver: pid 10655 from 127.0.0.1
2014-09-18 11:35:53.245284500 tcpserver: ok 10655 mail.anthesia.lan:127.0.0.1:25 :127.0.0.1::53929
2014-09-18 11:35:58.257314500 CHKUSER accepted sender: from <realuser@realdomain|remoteinfo/auth:|chkuser-identify:> remote <helo:mail.anthesia.lan|remotehostname:unknown|remotehostip:127.0.0.1> rcpt <> : sender accepted
2014-09-18 11:35:58.260451500 CHKUSER accepted rcpt: from <realuser@realdomain|remoteinfo/auth:|chkuser-identify:> remote <helo:mail.anthesia.lan|remotehostname:unknown|remotehostip:127.0.0.1> rcpt <dave@anthesia.lan> : found existing recipient
2014-09-18 11:35:58.610581500 simscan:[10655]:SPAM REJECT (997.10/6.50):0.3490s:===== SPAM (997.1) ===== :192.168.33.219:realuser@realdomain:dave@anthesia.lan
2014-09-18 11:35:58.610583500 simscan: Putting the message in quarantine: /var/spool/simscan/quarantine/msg.1411032958.261329.10657
2014-09-18 11:35:58.610584500 simscan: Message recorded in quarantine successful
2014-09-18 11:35:58.611565500 qmail-smtpd: message rejected (Your email is considered spam (997.10 spam-hits)): realuser@realdomain from 127.0.0.1 to dave@anthesia.lan helo mail.anthesia.lan
2014-09-18 11:35:58.611566500 qmail-smtpd: read failed: realuser@realdomain from 127.0.0.1 to dave@anthesia.lan helo mail.anthesia.lan
2014-09-18 11:35:58.611673500 tcpserver: end 10655 status 256
2014-09-18 11:35:58.611674500 tcpserver: status: 0/20

Come possiamo vedere:

  • la mail viene riconosciuta correttamente come spam SPAM REJECT (997.10/6.50) e gli viene assegnato un punteggio di 997.10, ben al di sopra della soglia di 6.5 che avevamo impostato come soglia per lo spam;
  • la mail viene inserita in quarantena (simscan: Message recorded in quarantine successful) affinchè un amministratore possa eventualmente indagare sull’accaduto;
  • la sessione con l’utente remoto viene immediatamente chiusa e viene inviata al sender una mail in cui si afferma che la mail inviata è stata considerata spam.

 

Test ClamAV

Per testare il nostro sistema antivirus utilizziamo nuovamente sendEmail, mettendo in attachmente un file di test con virus che ci fornisce ClamAV; lasciamo invariato il file /etc/qmail/tcp.smtp mentre modifichiamo il file /etc/qmail/simcontrol in questo modo:

dave@anthesia.lan:clam=yes,spam=no,spam_hits=6.5
:clam=yes,spam=yes,spam_hits=6.5

Inviamo la nostra mail di test

# sendEmail -f "realuser@realdomain" -t dave@anthesia.lan -m "Prova antivirus" -o tls=no -a /usr/src/clamav-0.98.4/test/clam-v3.rar

Analizziamo nuovamente il file di log per l’smtp:

2014-09-18 11:42:47.678965500 tcpserver: status: 1/20
2014-09-18 11:42:47.679054500 tcpserver: pid 10668 from 127.0.0.1
2014-09-18 11:42:47.679550500 tcpserver: ok 10668 mail.anthesia.lan:127.0.0.1:25 localhost.localhost:127.0.0.1::56984
2014-09-18 11:42:52.691050500 CHKUSER accepted sender: from <realuser@realdomain|remoteinfo/auth:|chkuser-identify:> remote <helo:mail.anthesia.lan|remotehostname:localhost.localhost|remotehostip:127.0.0.1> rcpt <> : sender accepted
2014-09-18 11:42:52.694190500 CHKUSER accepted rcpt: from <realuser@realdomain|remoteinfo/auth:|chkuser-identify:> remote <helo:mail.anthesia.lan|remotehostname:localhost.localhost|remotehostip:127.0.0.1> rcpt <dave@anthesia.lan> : found existing recipient
2014-09-18 11:42:52.752398500 simscan:[10668]:VIRUS:0.0574s:ClamAV-Test-File:127.0.0.1:realuser@realdomain:dave@anthesia.lan
2014-09-18 11:42:52.752779500 qmail-smtpd: message rejected (Your email was rejected because it contains the ClamAV-Test-File virus): realuser@realdomain from 127.0.0.1 to dave@anthesia.lan helo mail.anthesia.lan
2014-09-18 11:42:52.753379500 qmail-smtpd: read failed: realuser@realdomain from 127.0.0.1 to dave@anthesia.lan helo mail.anthesia.lan
2014-09-18 11:42:52.753774500 tcpserver: end 10668 status 256
2014-09-18 11:42:52.753775500 tcpserver: status: 0/20

Anche in questo caso:

  • il sistema ha riconosciuto la mail inviata come pericolosa in quanto contenente in attach un file riconosciuto come virus (VIRUS:0.0574s:ClamAV-Test-File);
  • ha bloccato la consegna al destinatario chiudendo la connessione (qmail-smtpd: read failed: realuser@realdomain from 127.0.0.1 to dave@anthesia.lan helo mail.anthesia.lan)
  • ha avvertito il mittente che la mail che sta inviando è una mail contenente virus (message rejected (Your email was rejected because it contains the ClamAV-Test-File virus): realuser@realdomain from 127.0.0.1 to dave@anthesia.lan helo mail.anthesia.lan)

 

← QMail – Simscan (CentOS 7) QMail – Courier Authlib (CentOS 7)→