출처 : comp.mail.sendmail
Klez worm 은 제목이 워낙 많아서 다음과 같은 방법으로 필터링 합니다.
메일 헤더에서 boundary가 boundary=Pj56st60Wh7W25E5917590n32477 과
같이 " "로 둘러싸여 있지 않은걸 이용합니다.
sendmail.cf 에 다음을 추가 합니다.
Kklez regex -a@MATCH_KLEZ multipart/alternative; +boundary=[a-z0-9]+$
HContent-Type:$>Check_klez_header
SCheck_klez_header
R$*[TAB]$: $(klez $&{currHeader} $)
R@MATCH_KLEZ[TAB]$#error $: 553 This message may contain Win32.Klez worm
[TAB]은 탭키를 누르라는 의미 입니다.
참고로 sendmail이 MAP_REGEX 지원이 되게 컴파일 되어 있어야 합니다.
sendmail -d0.1 하면
Compiled with: MAP_REGEX LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND
처럼 MA_REGEX 라고 나오면 됩니다.
http://quanta.khu.ac.kr/~dacapo/sendmail/ 를 참고하면 많은 도움이
됩니다.
바이러스 메일은 procmail을 이용합니다.
첨부 파일이 실행 화일(exe, com, bat 등등..)이면 필터링 합니다.
그래서 quarantine란 계정의 메일박스(/var/spool/mail/quarantine)
에 저장합니다. 주의할점은 이 필터를 적용하면 바이러스 메일뿐 아니라
실행화일이 첨부된 모든 메일을 받을 수 없습니다. zip으로 압축해야겠죠.
기본으로 .exe .bat .pif 같은 파일을 필터링 합니다만 name부분 설정에
따라 .mp3.exe, .doc.exe 같이 이중 확장자만 필터링 할 수 있습니다.
procmailrc 파일에 다음을 추가 합니다.
# check body for executable filenames
{
:0 B
# this is tough, because many emails contain URL's that end in .com
# and some contain named elements like forms with name="something"
# and action="http://foo.com/cgi-bin/bar.cgi"
# some viruses are also not using quoted filenames. grrrr...
# the end of line check also allows for padded spaces or tabs
* name=.*.(exe|bat|pif|com|lnk|scr|vbs)(")?( *| *)$
# or for double extensions only:
#* name=.*..*.(exe|bat|pif|com|lnk|scr|vbs)(")?( *| *)$
#* name=.*.(xls|doc|jpg|gif|bmp|wav|mp3).(exe|bat|pif|com|lnk|scr|vbs)(")?( *| *)$
# If found, log and quarantine (or delete)
{
LOG=" Possible attachment virus: "
LOGABSTRACT=all
# Procmail will create mbox (UNIX mailbox file) if it doesn't exist
# If it's aready a directory, mail will be saved as mboxes within it (good for global administration)
# Paths may be absolute, or relative to this file
:0
/var/spool/mail/quarantine
# or to the ol' bit bucket:
# /dev/null
LOGABSTRACT=no
}
}