Skip to main content

procmailrc를 이용한 스팸메일 차단

  1. 패키지 설치
    $> yum install procmail -y
  2. 스팸메일 수신시 관리하는 계정생성
    $> useradd spam-admin
  3. 스팸차단 로그 생성
    $> touch /var/log/procmail
  4. /etc/procmailrc 파일 생성하기 (샘플)
    $> vi /etc/procmailrc
    ##########################################
    # 수신 메일 제목을 기준으로 메일 차단하기
     
    #Log file path
    LOGFILE=/var/log/procmail
     
    VERBOSE=no
     
    # System Path
    PATH=/usr/bin:/usr/local/bin:/bin
    SHELL=/bin/sh
     
     
     
    # Spam mail Blocking & Forward
    :0
    * ? formail -x"From" -x"From:" -x"Sender:" \
      -x"Reply-To:" -x"Return-Path:" -x"To:"
    /var/spool/mail/spam-admin
     
     
    # Based on spam lists
     
    :0
    * ^Subject: .*[sS][eE][xX]|.*[Pp][Oo][rR][Nn]|.*[Vv][Ii][aA][gG][rR][aA]|.*[Dd][rR][uU][gG]|.*[pP][eE][nN][Ii][sS]|.*[mM][oO][rR][tT][aA][gG][eE].my new photo
    /var/spool/mail/spam-admin
     
    :0
    * ^Subject: .*포.*르.*노|.*색.*골|.*야.*시|.*목.*록|.*리.*스.*트|.*성.*인|.*몰.*카|.*대.*출|.*보.*험|.*무.*료|.*부업|.*경품|.*만화|.*다이어트
    /var/spool/mail/spam-admin
     
     
    :0
    * ^Subject: .*(\{광|\[광|\(광|<광|廣-告|廣告|廣\ 告|廣\.告|=B1=A4=B0=ED|saSw7Q==?=|W7GksO1d|=BC=BA=C0=CE=B1=A4=B0=ED)
    /var/spool/mail/spam-admin
     
     
    :0
    * ^Subject: .*(성인|성인정보|성인\ 광고|포르노|색골|야시시|몰카|포X노|투시|야동|페니스|경마|뽀르노|섹스|비아\.그라|카드연체|카드값대출|카드대출|카드빚|카드대납|스카이라이프|skylife)
    /var/spool/mail/spam-admin
     
     
    :0
    * ^Subject:.(Re:.)*(Thank you!|Your details|Details|My details|Approved|Your application|Wicked screensaver|That movie)
    /var/spool/mail/spam-admin