Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 11-11-2013, 03:44 PM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
Tích hợp MailScanner - ClamAV - SpamAssassin - SquirrelMail vào PostfixTrên Centos 5.
Tích hợp MailScanner - ClamAV - SpamAssassin - SquirrelMail vào PostfixTrên Centos 5.7


Tích hợp MailScanner,ClamAV,SpamAssassin,SquirrelMail vào PostfixTrên Centos 5.7

Chuẩn bị

Disabale Sendmail

# chkconfig sendmail off

# /etc/init.d/sendmail stop

I : Install va Config Posfix

#yum install -y postfix

Sửa file /etc/postfix/main.cf với nội dung như sau :

# vim /etc/postfix/main.cf

inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/


Restart postfix

# /etc/init.d/postfix restart

Install mailx để test Postfix


# yum -y install mailx

Test gởi mail để test thử Postfix chay chưa

[root@kenhgiaiphap ~]# mailx hieu@kenhgiaiphap.vn
Subject: test xem Postfix ch chua

test posfix
.
Cc:
[root@kenhgiaiphap ~]# ll /home/hieu/Maildir/new/
total 4
-rw------- 1 hieu hieu 654 Nov 18 23:25 1321633526.V801Icf652M819684.kenhgiaiphap.vn
[root@kenhgiaiphap ~]#



hoặc có thể test bằng telnet


[root@kenhgiaiphap ~]# telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 kenhgiaiphap.vn ESMTP Postfix
ehlo localhost
250-kenhgiaiphap.vn
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:hieu@kenhgiaiphap.vn
250 2.1.0 Ok
rcpt to:kgp@kenhgiaiphap.vn
250 2.1.5 Ok
data
354 End data with .
test postfix tu telnet by tronghieu
.
250 2.0.0 Ok: queued as 4EA1F375A63
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@kenhgiaiphap ~]# ll /home/kgp/Maildir/new/
total 4
-rw------- 1 kgp kgp 482 Nov 18 23:31 1321633908.V801Icf657M293913.kenhgiaiphap.vn
[root@kenhgiaiphap ~]#



II : Install và config ClamAV


# yum install -y clamd

Start ClamAV

# chkconfig clamd on

# /etc/init.d/clamd restart

Để test ClamAV AntiVirus dùng lệnh

# clamscan

Vidu :

[root@dhcp1 data]# pwd
/data
[root@dhcp1 data]# clamscan

/data/virus_template.com: Eicar-Test-Signature FOUND
/data/kenhgiaiphap.vn: Empty file
/data/eicar.com: Eicar-Test-Signature FOUND
/data/tronghieu: Empty file

/data/MailScanner-4.84.3-1.rpm.tar.gz: OK

----------- SCAN SUMMARY -----------
Known viruses: 1073808
Engine version: 0.97.2
Scanned directories: 1
Scanned files: 3
Infected files: 2
Data scanned: 17.00 MB
Data read: 5.59 MB (ratio 3.04:1)
Time: 6.293 sec (0 m 6 s)
[root@dhcp1 data]# ll
total 5752
-rwsrwsrwt 1 root root 68 Nov 16 01:23 eicar.com
-rw-r--r-- 1 root root 0 Nov 16 00:35 kenhgiaiphap.vn
drwxr-xr-x 2 root root 4096 Nov 18 09:34 MailScanner-4.84.3-1
-rw-r--r-- 1 root root 5864320 Aug 20 19:54 MailScanner-4.84.3-1.rpm.tar.gz
-rw-r--r-- 1 root root 0 Nov 16 00:35 tronghieu
-rw-r--r-- 1 root root 68 Nov 16 01:28 virus_template.com
[root@dhcp1 data]#

Để update database cho ClamAV dùng lệnh :

# freshclam

III: Install spamassassin

# yum install spamassassin

# chkconfig spamassassin on

# /etc/init.d/spamassassin restart

(để cấu hình nâng cao spamassassin thì các bạn có thể
kham khảo thêm các tài liệu ,bài này để cấu hình mặc định)
IV : Install và config MailScanner

Cài các package cần thiết

# yum -y install perl-Archive-Zip perl-DBI perl-DBD-SQLite perl-Filesys-Df perl-Net-CIDR perl-OLE-Storage_Lite

# yum -y install perl-Sys-Hostname-Long perl-Sys-SigAction perl-MIME-tools

download MailScanner tại

http://www.mailscanner.info/downloads.html

# wget http://www.mailscanner.info/files/4/...3-1.rpm.tar.gz

# tar xzvf MailScanner-4.84.3-1.rpm.tar.gz

# cd MailScanner-4.84.3-1

Cài đặt


# yum -y install --nogpgcheck mailscanner* tnef*

Kiểm tra xem MailScanner hoạt động chưa (ko có báo gì là ok)

# MailScanner

[root@dhcp1 MailScanner-4.84.3-1]# MailScanner



[root@dhcp1 MailScanner-4.84.3-1]#

Cấu
hình MailScanner

# vim /etc/MailScanner/virus.scanners.conf

đổi dòng

clamav /usr/lib/MailScanner/clamav-wrapper /usr/local

thành

clamav /usr/lib/MailScanner/clamav-wrapper /usr



# vim /etc/MailScanner/MailScanner.conf

sửa các nội dung như sau :

%org-name% = your organization name
%org-long-name% = your full organization name
%web-site% = your mail support website or company website
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
Incoming Work Group = clam
Incoming Work Permissions = 0640
MTA = postfix
Virus Scanners = clamd
Clamd Socket = /var/run/clamav/clamd.sock
Use SpamAssassin = yes
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin

Tạo và phân quyền các thư mục cần thiết

cd /var/spool/MailScanner/
mkdir spamassassin
chown -R postfix.clam *
chmod -R 750 *
restorecon -R ../MailScanner/

Kết hợp MailScanner với Postfix

# vim /etc/postfix/main.cf

gỡ bõ dấu # ở dòng

header_checks = regexp:/etc/postfix/header_checks

Thêm dòng sau vào cuôi file /etc/postfix/header_checks

# vim /etc/postfix/header_checks

/^Received:/ HOLD



V: install dovecot và squirrelmail để User check mail qua web


# yum -y install squirrelmail dovecot

Để truy cập squirrelmail thì phài start Http

# chkconfig httpd on

# /etc/init.d/httpd restart

Bây giờ ta phải config SquirrelMail cho nó hiểu là chúng ta dang sử dụng Dovecot như là POP3 và IMAP server .


# /usr/share/squirrelmail/config/conf.pl

Bạn sẽ thấy bảng thông báo sau và làm theo hướng dẫn :

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >> <-- D


Please select your IMAP server:
bincimap = Binc IMAP server
courier = Courier IMAP server
cyrus = Cyrus IMAP server
dovecot = Dovecot Secure IMAP server
exchange = Microsoft Exchange IMAP server
hmailserver = hMailServer
macosx = Mac OS X Mailserver
mercury32 = Mercury/32
uw = University of Washington's IMAP server
gmail = IMAP access to Google mail (Gmail) accounts

quit = Do not change anything
Command >> <-- dovecot
…...............

Press any key to continue... <-- ENTER


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >> S


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. delete_move_next
2. squirrelspell
3. newmail

Available Plugins:
4. administrator
5. bug_report
6. calendar
7. change_sqlpass
8. compatibility
9. filters
10. fortune
11. info
12. listcommands
13. mail_fetch
14. message_details
15. sent_subfolders
16. spamcop
17. test
18. translate

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >> <-- Q

Start Dovecot

# chkconfig dovecot on
# /etc/init.d/dovecot restart

Hệ thống đã sẵn sàng hoạt động sau khi start các service sau theo thứ tự :

chkconfig postfix off
chkconfig clamd on
chkconfig MailScanner on
service clamd start
service MailScanner start

Test thử hệ thống

Client truy cập webmail và gởi đính kèm 1 file virus trong email xem hệ thống hoạt động không

http://IP/webmail





đăng nhập vào user được nhận mail (kgp@kenhgiaiphap.vn) check thử xem có nhận mail chưa .

User chỉ nhận được 1 email cảnh báo chứ không nhận được file virus.



File Virus được giữ lại trên Mail server



Có thể copy nội dung file mẫu test virus sau và lưu lại thành file .txt hay.com để gởi đính kèm trong bước trên .

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

Theo: kenhgiaihpap

  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời


Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 11:50 PM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.