리눅스, 자료실, 성경검색, 추억의게임, 고전게임, 오락실게임, rootman, http://www.rootman.co.kr
* 54.224.118.247 *
| Home | Profile | Linux | 자료실 | zabbix | Mysql 5.6 | 갤러리 | 성경검색 | 해피니스 | 자유게시판 | 게시물검색 | L | O | R |    

 
[qmail] [qmail] qmail-scanner에 filtering 된 이메일 처리
 작성자 : rootman
Date : 2014-02-14 23:45  |  Hit : 4,753  

별 의미 없는 작업일 수도 있으나, qmail-scanner 에 의해 걸러진 메일을 검수 차원에서 subject 위주로 확인하고,
확실하다고 생각되는 메일은 특정 디렉터리에 위치 이동,
애매한 파일은 강제로 force 하는 형태 하려고 만들었습니다.


최종 업데이트 : 2014/02/19

[[email protected] /var/spool/qscan]# sh  check_qscan.sh
check_qscan.sh d/d2/S/F/W
d : debug
d2 : Filter
S : Spam force
F : Send force
W : learn (whiltelist.txt)
[[email protected] /var/spool/qscan]#

[[email protected] /var/spool/qscan/m]# sh qscan_process.sh S
- spam learning....(ns1.rootman.co.kr139238774858814260)  Learned tokens from 1 message(s) (1 message(s) examined)
- spam learning....(ns1.rootman.co.kr139238775558814319)  Learned tokens from 1 message(s) (1 message(s) examined)
- spam learning....(ns1.rootman.co.kr139238784558814395)  Learned tokens from 1 message(s) (1 message(s) examined)
- spam learning....(ns1.rootman.co.kr139238801658814675)  Learned tokens from 1 message(s) (1 message(s) examined)
- spam learning....(ns1.rootman.co.kr139238809558814773)  Learned tokens from 1 message(s) (1 message(s) examined)

[[email protected] /var/spool/qscan/m]# cat qscan_process.sh
#!/bin/sh
PATH=$PATH:/usr/sbin:/sbin:/usr/bin:/bin:/var/qmail/bin
export PATH

host=${HOSTNAME}

Dir="/var/spool/qscan/quarantine/policy/new"
if [ "$1" == "" ]; then
   echo "$0 d/d2/S/F/W"
   echo "d : debug"
   echo "d2 : Filter"
   echo "S : Spam force"
   echo "F : Send force"
   echo "W : learn (whiltelist.txt)"
   exit
fi

if [ "$1" == "d" ]; then
   echo
   echo  "* debug list"
   for R in $(ls $Dir/$host*)
   do
      p1=`cat $R | hcode -dk -m | awk -F"<" '/^From:/ {gsub(">",""); if(length($2)<25) {print $2"\t"} else {print $2}}' `
      echo -e "$R" "\t" "$p1" "\t" `cat $R | hcode -dk -m | awk /^Subject/`
   done
   exit
fi

if [ "$1" == "d2" ]; then
   echo
   echo  "* debug list (title)"
   for R in $(ls $Dir/$host*)
   do
      p1=`cat $R | hcode -dk -m | awk '/Quarantine-Description/{print $0}' `
      echo -e "$R" "\t" "$p1"
   done
   exit
fi

if [ "$1" == "F" ]; then
   for FF in $(ls $Dir/$host*)
   do
       cat $FF | qmail-inject
       echo "- force resending...($FF) "
       mv $FF /var/log/spamForceList/
   done
   exit
fi

if [ "$1" == "W" ]; then
   for P in $(cat $Dir/whiltelist.txt)
   do
       echo "- whitelist learning....($P) " `sa-learn --ham --file $R`
       cat $P | qmail-inject
       mv $R /var/log/spamNotList/
   done
   exit
fi

if [ "$1" == "S" ]; then
   for R in $(ls $Dir/$host*)
   do
      f1=`cat $R | awk '{if ($0 ~ /attachments drop/) print "attach"}'`
      if [ "$f1" == "attach" ]; then
          echo "* attach learning....($R)" `sa-learn --spam --file $R`
          mv $R /var/log/spamAttach/
      else
         g1=`cat $R | hcode -dk -m | awk /^Subject/ | awk '
          {
              if ($0 ~ /간단하게/)    { print "spamM" }
              if ($0 ~ /남성하초/)    { print "spamM" }
              if ($0 ~ /남성에/)    { print "spamM" }
              if ($0 ~ /비아그라/)    { print "spamM" }
              if ($0 ~ /명품가방/)    { print "spamM" }
              if ($0 ~ /발기치료/)    { print "spamM" }
              if ($0 ~ /남자구실/)    { print "spamM" }
              if ($0 ~ /발기되/)     { print "spamM" }
              if ($0 ~ /발기력/)    { print "spamM" }
              if ($0 ~ /세워주/)    { print "spamM" }
              if ($0 ~ /시알리/)    { print "spamM" }
              if ($0 ~ /아다깨/)       { print "spamM" }
              if ($0 ~ /아내.*(는|를)/)       { print "spamM" }
              if ($0 ~ /중년남/)    { print "spamM" }
              if ($0 ~ /화색이/)    { print "spamM" }
              if ($0 ~ /챙겨먹/)    { print "spamM" }
              if ($0 ~ /획기적/)    { print "spamM" }
              if ($0 ~ /방문자/)    { print "spamM" }
              if ($0 ~ /할아버/)    { print "spamM" }
              if ($0 ~ /키우세/)    { print "spamM" }
              if ($0 ~ /중년남/)    { print "spamM" }
              if ($0 ~ /대준다/)     { print "spamM" }
              if ($0 ~ /남편.*(이|하|에)/)    { print "spamM" }
              if ($0 ~ /단단.*(하|한)/)     { print "spamM" }
              if ($0 ~ /딱딱.*(하|한)/)    { print "spamM" }
              if ($0 ~ /동거녀/)    { print "spamM" }
              if ($0 ~ /따먹으/)     { print "spamM" }
              if ($0 ~ /딱딱하/)     { print "spamM" }
              if ($0 ~ /따먹기/)     { print "spamM" }
              if ($0 ~ /불끈서/)    { print "spamM" }
              if ($0 ~ /불기둥/)    { print "spamM" }
              if ($0 ~ /힘좋은/)    { print "spamM" }
              if ($0 ~ /여대생/)    { print "spamM" }
              if ($0 ~ /이쁜.*(년|뇬)/)    { print "spamM" }
              if ($0 ~ /정력.*(좋|제)/)    { print "spamM" }
              if ($0 ~ /술한잔/)    { print "spamM" }
              if ($0 ~ /옥녀도/)    { print "spamM" }
              if ($0 ~ /잠자리/)    { print "spamM" }
              if ($0 ~ /페니스/)    { print "spamM" }
              if ($0 ~ /변강쇠/)    { print "spamM" }
              if ($0 ~ /마누라/)    { print "spamM" }
              if ($0 ~ /섹스파/)    { print "spamM" }
              if ($0 ~ /소개팅/)    { print "spamM" }
              if ($0 ~ /힘없이/)    { print "spamM" }
              if ($0 ~ /그녀와/)    { print "spamM" }
              if ($0 ~ /원나잇/)    { print "spamM" }
              if ($0 ~ /여자애/)    { print "spamM" }
              if ($0 ~ /허리가/)    { print "spamM" }
              if ($0 ~ /하룻밤/)    { print "spamM" }
              if ($0 ~ /항시대/)    { print "spamM" }
              if ($0 ~ /죽이는/)    { print "spamM" }
              if ($0 ~ /밤에도/)    { print "spamM" }
              if ($0 ~ /사정.*(하|할|전|후)/)    { print "spamM" }
              if ($0 ~ /여자.*(가|는|샤)/)    { print "spamM" }
              if ($0 ~ /여자.*(가|는|샤|들)/)    { print "spamM" }
              if ($0 ~ /삽입.*(후|하)/)    { print "spamM" }
              if ($0 ~ /조루.*(로|증)/)    { print "spamM" }
              if ($0 ~ /남자.*(가|는)/)    { print "spamM" }
              if ($0 ~ /여친이/)    { print "spamM" }
              if ($0 ~ /후-불-제/)   { print "spamM" }
              if ($0 ~ /파격할인/)    { print "spamM" }
              if ($0 ~ /만원으로/)    { print "spamM" }
              if ($0 ~ /viagra/)    { print "spamM" }
              if ($0 ~ /VIAGRA/)    { print "spamM" }
              if ($0 ~ /색녀/)        { print "spamM" }
              if ($0 ~ /남근/)        { print "spamM" }
              if ($0 ~ /애인/)         { print "spamM" }
              if ($0 ~ /발기/)         { print "spamM" }
              if ($0 ~ /오빠/)   { print "spamM" }
              if ($0 ~ /정력/)   { print "spamM" }
              if ($0 ~ /퀸카/)   { print "spamM" }
              if ($0 ~ /모텔/)   { print "spamM" }
              if ($0 ~ /181818/)   { print "spamM" }
             }'`
         if [ `echo "$g1" | grep -c "spamM"` -gt 0 ]; then
            echo "- spam learning....($R) " `sa-learn --spam --file $R`
            mv $R /var/log/spamList/
         fi
      fi
   done
fi

 
 

Total. 645
번호 분류 제목 작성자 등록일 조회수
645 기초강좌 NFS server unable to open connection to tcp6/udp6 networks rootman 09-27 2212
644 php [php] mssql ms-sql 한글 변환 끄적임.. 정리 rootman 03-29 3244
643 기초강좌 java vim 에서 자바 환경 만들기 rootman 02-16 2436
642 삭제예정 [xencenter] xenserver tool 설치 rootman 08-24 3405
641 mysql [mysql] Creating a File-Per-Table Tablespace Outside the Dat… rootman 08-03 3587
640 기초강좌 Centos Xwindow 설치 rootman 06-16 4449
639 php [php] highlight 함수 rootman 04-01 4309
638 qmail [qmail] qmail-scanner에 filtering 된 이메일 처리 rootman 02-14 4754
637 Shell [날짜] awk를 이용하여 unixtime의 시간 차 구하기 rootman 01-27 5626
636 기초강좌 centos에 그놈(gnome) 설치하기 rootman 01-10 5549
635 쉘(awk) [awk] shell 변수 사용하기 rootman 12-27 5257
634 기초강좌 서버 캐시 메모리 초기화하기 (drop_caches) rootman 12-11 6223
633 windows tips 그리드 제거 배치 스크립트 rootman 11-28 5828
632 기초강좌 패스워드 lockgin control rootman 09-06 4
631 windows tips win7 자동 로그인 설정하기 rootman 08-18 5651
 1  2  3  4  5  6  7  8  9  10    
AND OR