메뉴 건너뛰기

리눅스 관련 모음

본문시작

조회 수 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. rsync 를 이용한 원격 서버 백업하기.

    Date2013.07.01 Category에러해결 By햇빛소년 Views15571
    Read More
  2. rsync 백업 설정이 확실하게 되었는데도 백업이 되지 않는 다면.....

    Date2013.06.30 Category에러해결 By햇빛소년 Views15930
    Read More
  3. segmentation fault가 발생할 때 디버깅 방법

    Date2012.01.05 By햇빛소년 Views38191
    Read More
  4. selinux troubleshooting 해결 명령

    Date2016.02.28 Category에러해결 By햇빛소년 Views797
    Read More
  5. SELinux Lockdown Part One: SELinux Users

    Date2012.06.07 By햇빛소년 Views35101
    Read More
  6. selinux 관련 명령모음.

    Date2012.06.07 By햇빛소년 Views36273
    Read More
  7. selinux 퍼미션 에러 audit2allow 로 쉽게 ....

    Date2014.02.28 Category에러해결 By햇빛소년 Views3470
    Read More
  8. SELinux/audit2allow

    Date2012.06.11 By햇빛소년 Views33239
    Read More
  9. sendmail + dovecot 설정

    Date2011.05.11 By햇빛소년 Views42414
    Read More
  10. Sendmail 스패머 IP 차단 쉘스크립트 v2

    Date2012.12.06 By햇빛소년 Views20108
    Read More
  11. sendmail[8569]: auxpropfunc error invalid parameter supplied

    Date2013.07.11 Category에러해결 By햇빛소년 Views15687
    Read More
  12. Solving the "Can't connect to UNIX socket" and "/parts: Access denied" problems.

    Date2011.04.08 By햇빛소년 Views49951
    Read More
  13. Spam Assassin + ClamAV 바이러스 필터 연동하기

    Date2011.03.29 By햇빛소년 Views74186
    Read More
  14. spamassassin /320.pre -> Rule2XSBBody 체크시 에러 해결법

    Date2011.04.13 By햇빛소년 Views48101
    Read More
  15. spamassassin 에러 Can't locate Mail/SpamAssassin/CompiledRegexps/body 0.pm in @INC

    Date2013.06.24 Category에러해결 By햇빛소년 Views16044
    Read More
  16. specifies multiple packages 대처법

    Date2012.02.22 By햇빛소년 Views27959
    Read More
  17. sql_mode = NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

    Date2014.03.22 Category에러해결 By햇빛소년 Views4856
    Read More
  18. squirrelmail에서 메일 삭제시 Error: file_dotlock_create... 에러에 대하여.

    Date2013.06.30 Category에러해결 By햇빛소년 Views20665
    Read More
  19. ssh 포트변경 및 iptables 수정

    Date2013.06.25 Category설치관련 By햇빛소년 Views15242
    Read More
  20. ssh로 특정 ip접근 hosts.deny 자동 추가

    Date2011.05.12 By햇빛소년 Views45290
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 Next
/ 10