메뉴 건너뛰기

리눅스 관련 모음

본문시작

조회 수 74186 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

국산 통나무 수공예 남원제기, 남원목기

자료가 도움이 되셨다면
혼수용품제수용품 필요시
남원제기 공식 홈페이지 http://남원제기.kr
남원목기 공식 홈페이지 http://otchil.kr
에서 구매 해 주세요
정성껏 모시겠습니다.
 

기존에 SpamAssassin과 ClamAV를 연동하는 방법은 많이 있어왔지만 사실상 연동이라기 보다는 Sendmail에서 둘다 따로 호출하거나 Procmail 스크립트를 사용하는 방법등이었습니다.

다음은 ClamAV를 아예 SpamAssassin으로 합쳐 바이러스 발견시 SpamAssassin의 점수계산에 포함되도록 하는 방법입니다.

무선 ClamAV를 설치하고 시작해 보도록 하겠습니다. [이곳]에서 ClamAV 소스를 다운받아 설치합니다. 패키지 모음은 [이곳]에 있습니다.

ClamAV를 설치하기 전에 우선 사용자 계정을 추가합니다.

# groupadd clamav 
# useradd -g clamav -s /bin/false -c "Clam AntiVirus" -d /var/lib/clamav clamav

다운받은 소스를 설치합니다.
# ./configure --sysconfdir=/etc/clamav 
# make 
# make install

추가로 필요한 디렉토리를 생성합니다.
# mkdir /var/lib/clamav 
# mkdir /var/log/clamav 
# mkdir /var/run/clamav 
# chown clamav.clamav /var/lib/clamav 
# chown clamav.clamav /var/log/clamav 
# chown clamav.clamav /var/run/clamav

/etc/clamav/clamd.conf 파일에 다음의 내용을 수정합니다.
LogFile /var/log/clamav/clamd.log 
LogFileMaxSize 2M 
LogTime yes 
PidFile /var/run/clamav/clamd.pid 
TemporaryDirectory /tmp 
LocalSocket /var/lib/clamav/clamd.sock 
FixStaleSocket yes 
ScanMail yes

다음으로는 /etc/clamav/freshclam.conf 파일을 수정합니다.
UpdateLogFile /var/log/clamav/freshclam.log 
PidFile /var/run/clamav/freshclam.pid 
DatabaseOwner clamav 
DNSDatabaseInfo current.cvd.clamav.net 
DatabaseMirror db.kr.clamav.net 
DatabaseMirror database.clamav.net

다음의 스크립트 파일을 /etc/rc.d/init.d 안에 추가합니다.

이제 스크립트를 실행해 봅시다.
# /etc/rc.d/init.d/freshclam start 
# /etc/rc.d/init.d/clamd start

/etc/cron.daily/freshclam이 생성되었다면 freshclam은 따로 데몬으로 돌리실 필요는 없습니다.
SpamAssassin이 설치된 설정 디렉토리 /etc/mail/spamassassin 안에 다음의 파일을 추가합니다.

clamav.cf
loadplugin ClamAV clamav.pm 
full CLAMAV eval:check_clamav() 
describe CLAMAV Clam AntiVirus detected a virus 
score CLAMAV 10 
add_header all Virus _CLAMAVRESULT_


clamav.pm
package ClamAV; 
use strict;

 

# version 2.0, 2010-01-07  #   - use SA public interface set_tag() and add_header, instead of  #     pushing a header field directly into $conf->{headers_spam}

 

# our $CLAMD_SOCK = 3310;               # for TCP-based usage  our $CLAMD_SOCK = "/var/run/clamd.basic/clamd.sock";   # change me

 

use Mail::SpamAssassin;  use Mail::SpamAssassin::Plugin;  use Mail::SpamAssassin::Logger;  use File::Scan::ClamAV;  our @ISA = qw(Mail::SpamAssassin::Plugin);

 

sub new {    my ($class, $mailsa) = @_;    $class = ref($class) || $class;    my $self = $class->SUPER::new($mailsa);    bless($self, $class);    $self->register_eval_rule("check_clamav");    return $self;  }

 

sub check_clamav {    my($self, $pms, $fulltext) = @_;    dbg("ClamAV: invoking File::Scan::ClamAV, port/socket: %s", $CLAMD_SOCK);    my $clamav = new File::Scan::ClamAV(port => $CLAMD_SOCK);    my($code, $virus) = $clamav->streamscan(${$fulltext});    my $isspam = 0;    my $header = "";    if (!$code) {      my $errstr = $clamav->errstr();      $header = "Error ($errstr)";    } elsif ($code eq 'OK') {      $header = "No";    } elsif ($code eq 'FOUND') {      $header = "Yes ($virus)";      $isspam = 1;      # include the virus name in SpamAssassin's report      $pms->test_log($virus);    } else {      $header = "Error (Unknown return code from ClamAV: $code)";    }    dbg("ClamAV: result - $header");    $pms->set_tag('CLAMAVRESULT', $header);    # add a metadatum so that rules can match against the result too    $pms->{msg}->put_metadata('X-Spam-Virus',$header);    return $isspam;  }

 

1;


이후에 File::Scan::ClamAV 를 설치하여야 합니다.

# cpan File::Scan::ClamAV


이제 SpamAssassin에서 메일을 처리할때 ClamAV를 호출하여 바이러스 검사까지 하게 되며 바이러스가 존재할시 스코어 10점을 부여하고 X-Spam-Virus: Yes 헤더를 붙이게 됩니다.

세세한 점수를 확인하고 싶다면 [이곳]에서 확인해 보시면 됩니다.

SpamAssassin을 데몬형태로 사용하고 계신다면 재시작 해주시면 됩니다. 그외의 경우에는 바로 적용됩니다.

참고 : http://wiki.apache.org/spamassassin/ClamAVPlugin

 

 

+++++++++++++++++++++++++++++++++

로그확인은 /var/log/maillog 에서
로그쌓이는걸 원하지않는경우 /etc/init.d/spamd 에서 SPAMDOPTIONS 부분에 -s null 을추가해주자
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

   

  1. No Image 18Mar
    by 햇빛소년
    2011/03/18 by 햇빛소년
    Views 50196 

    한국에 맞는 스팸어쎄신 설정하여 스팸 95% 줄여보기

  2. No Image 18Mar
    by 햇빛소년
    2011/03/18 by 햇빛소년
    Views 51328 

    DCC로 안티스팸 기능 확장하기

  3. No Image 20Mar
    by 햇빛소년
    2011/03/20 by 햇빛소년
    Views 51422 

    [Mysql] password설정 및 변경, root 비번 잃어버렸을 경우 변경법

  4. No Image 26Mar
    by 햇빛소년
    2011/03/26 by 햇빛소년
    Views 50687 

    MYSQL / 필드내 특정 문자열 치환하는 mysql 명령문

  5. No Image 29Mar
    by 햇빛소년
    2011/03/29 by 햇빛소년
    Views 74186 

    Spam Assassin + ClamAV 바이러스 필터 연동하기

  6. No Image 04Apr
    by 햇빛소년
    2011/04/04 by 햇빛소년
    Views 47599 

    cpanm

  7. No Image 07Apr
    by 햇빛소년
    2011/04/07 by 햇빛소년
    Views 44156 

    요긴하게 사용되는 리눅스 명령 모음.

  8. No Image 08Apr
    by 햇빛소년
    2011/04/08 by 햇빛소년
    Views 49950 

    Solving the "Can't connect to UNIX socket" and "/parts: Access denied" problems.

  9. No Image 09Apr
    by 햇빛소년
    2011/04/09 by 햇빛소년
    Views 72543 

    Amavisd 에서 spam filtering 수준 조절

  10. No Image 09Apr
    by 햇빛소년
    2011/04/09 by 햇빛소년
    Views 62648 

    Install amavisd-new, SpamAssassin

  11. No Image 10Apr
    by 햇빛소년
    2011/04/10 by 햇빛소년
    Views 55309 

    rndc: connection to remote host closed 네임서버오류

  12. No Image 13Apr
    by 햇빛소년
    2011/04/13 by 햇빛소년
    Views 48101 

    spamassassin /320.pre -> Rule2XSBBody 체크시 에러 해결법

  13. SURBL을 이용해 스팸 정확도 극대화하기

  14. No Image 16Apr
    by 햇빛소년
    2011/04/16 by 햇빛소년
    Views 48491 

    파이프, 필터, 리다이렉션

  15. No Image 01May
    by 햇빛소년
    2011/05/01 by 햇빛소년
    Views 51811 

    httpd 스크립트 - /etc/rc.d

  16. No Image 02May
    by 햇빛소년
    2011/05/02 by 햇빛소년
    Views 96540 

    Mail Server 구축(postfix, dovecot, amavisd-new, spamassassin, clamav)

  17. Linux Disable Core Dumps

  18. No Image 09May
    by 햇빛소년
    2011/05/09 by 햇빛소년
    Views 51322 

    MySQL에러[Warning] IP address '211.154.154.171' could not be resolved: no reverse address mapping.

  19. sendmail + dovecot 설정

  20. No Image 11May
    by 햇빛소년
    2011/05/11 by 햇빛소년
    Views 51435 

    [1원짜리 팁] hosts.deny

Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 Next
/ 10