sophos on amavisd-new in ubuntu working as mail gateway and relay to other host

sophos on amavisd-new in ubuntu working as mail gateway and relay to other host
วันนี้ มีโจทย์อยู่ว่า สร้างเครื่อง mail gateway โดยลงตัว scan virus เป็น sophos engine บน amavisd-new ครับผม

ผมเลือกใช้ตัว ubuntu 14 ครับ เริ่มกันเลย
หลังจากลง os + apt-get update ทุกอย่างเรียบร้อยแล้ว
ก็ สมัคร sophos ขอ download package test : Sophos Anti-Virus on Linux and UNIX computers
จะประมาณ 400 กว่า MB นะครับ
ทำการแตก package
#tar zxf sav-linux-9-i386.tgz
#cd sophos-av

#./install.sh

ก็เริ่มกันเลย ใช้ค่าเป็น default ไปทุกอย่าง ยกเว้นตอนใส่ username + pass เพื่อจะ update license ก็ใส่ตามที่ได้รับค่ามาจาก email ครับ
หลังจากลงเสร็จ พวกไฟล์จะถูกเก็บอยู่ที่ /opt/sophos-av
#cd /opt/sophos-av

ต่อไปเริ่มลง mail gateway กันเลยครับ mta ผมเป้น postfix , console anti-virus = amavisd-new
#apt-get install postfix amavisd-new

ลงเสร็จก็ configure main.cf ของ postfix ครับ
#cd /etc/postfix
#mkdir -p backup_conf && cp *.cf backup_conf
#vi main.cf

##add by golf
content_filter = smtp-amavis:[127.0.0.1]:10024

#@local_domains_acl = ( “chubbytour.com”, “packetlove.com” );
# DOMAINS FOR WHICH THIS GATEWAY WILL ACCEPT EMAILS
relay_domains = $myhostname, hash:/etc/postfix/relay_domains
# RELAY MAPPINGS PER DOMAIN
transport_maps = hash:/etc/postfix/transport

เสร็จแล้ว
#vi /etc/postfix/relay_domains
example.com OK
#vi /etc/postfix/transport
example.com smtp:xxx.yyy.zzz ;โดยที่ xxx.yyy.zzz คือชื่อ host ที่เราต้องการ relay เมลไปถึงนะครับผม

#postmap /etc/postfix/relay_domains
#postmap /etc/postfix/transport

#/etc/init.d/postfix restart

ต่อไป configure amavis-new ครับ
#cd /etc/amavis/conf.d
#vi 15-content_filter_mode

# If You wish to enable it, please uncomment the following lines:

@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);

เสร็จแล้วทำการ save ออกมา

ไฟล์ต่อไปจะทำการปิด clamav แล้วเปิด sophos engine ครับ
#vi 15-av_scanners

# [‘ClamAV-clamd’,
# \&ask_daemon, [“CONTSCAN {}\n”, “/var/run/clamav/clamd.ctl”],
# qr/\bOK$/m, qr/\bFOUND$/m,
# qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],

### http://www.sophos.com/ – backs up Sophie or SAVI-Perl
[‘Sophos Anti Virus (sweep)’, ‘sweep’,
‘-nb -f -all -rec -ss -sc -archive -cab -mime -oe -tnef ‘.
‘–no-reset-atime {}’,
[0,2], qr/Virus .*? found/m,
qr/^>>> Virus(?: fragment)? ‘?(.*?)’? found/m,
],
# other options to consider: -idedir=/usr/local/sav

เสร็จแล้วทำการ save ออกมา

ต่อไปเพิ่ม domain ในกรณีมีหลาย domain ที่จะทำการ scan แล้ว relay mail ต่อไป แก้ไขภายในไฟล์ 50-user เพิ่มสองบันทัดด้านล่างลงไป
#vi 50-user

$myhostname = ‘yourhostname.domain.com’;
@local_domains_acl = ( “example.com”, “packetlost.com” );

เสร็จแล้วทำการ save ออกมา

#/etc/init.d/amavis restart

ก็อันเป็นที่เรียบร้อยครับผม

ส่วนผลประโยชน์ในการใช้งาน sophos engine นั้น ผลลัพธ์ถือว่าดีกว่า clamav มากๆๆๆ จากประสบการณ์ที่ผ่านมา ฮ่าๆๆๆ
ทั้งเรื่อง การ update pattern ที่รวดเร็วกว่า , มีระบบจัดการ ไวรัส trojan ใหม่ๆได้ดีกว่า , ตรวจเชคชื่อ ของ virus , trojan ได้เลย
ยกตัวอย่างจาก log kub

May 29 23:00:25 ubuntu postfix/smtp[13802]: 1233EC3DE3: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=15, delays=0.03/0.01/0/15, dsn=2.7.0, status=sent (250 2.7.0 Ok, discarded, id=13797-01 -[color=red] INFECTED: Troj/Agent-ALNQ)[/color]

ก็ลองใช้งานกันดู หรือนำไปประยุกต์กันดูนะครับผม : )

Add A Comment

Your email address will not be published. Required fields are marked *