본문 바로가기

해봐야 안다.OTL/Linux

[리눅스] 메일서버: spamassassin을 이용한 메일 보안

<기본 세팅>

<현재 구축된 서버 상태>

 

<HOST_OS:네트워크 세팅 값>

전 세계 모든 메일서버의 바이러스 테스트를 이걸로 한다.

 

<Sendmail server 192.168.100.100>

root@woo:15:00:25]#tail -f /var/log/maillog

메일서버의 로그를 보기 위해 위 명령을 입력.

 

감염된 메일이 날라오면 메일서버에서 알아서 삭제해버린다.

결국 메일은 오지 않았다.

 

=> clamav 설치는 추후에 올리겠습니다. 파일이 없어져 버렸네요

 

 

<SpamAssassin을 이용한 스팸메일 필터링>

홈페이지:http://spamassassin.apache.org

- spamassassin은 perl로 개발 되었으며 IDS처럼 Rule기반으로 메일의 헤더와 내용을 분석과 실시간 차단리스트를 참고하여 각각의 Rule에 매칭이 될 경우 +나 – 점수를 부여하여 총 점수가 기준 점수를 초과하는지 여부를 통해 spam 메일의 여부를 결정하게 된다

spamassassin을 실행하게 되면 기본적으로 127.0.0.1의ㅏ TCP 783 포트를 리스닝하는 spamd라는 데몬이 항상 동작하게 된다. 이 spamd라는 데몬은 spamc라는 경량의 C기반의 클라이언트 프로그램과 통신하면서 spam인지 여부를 계산하고 판별하는 역할을한다.

 

[Docs] => [Top-level INSTALL file] <참고 문서 인스톨하는 방법>

설치시 두 가지 방법이있다.(자세한 내용은 [메뉴] => [Docs] => [Top-level INSTALL file] 참고)

 

일단 스팸어쌔신이 깔려있는지 확인 설치전 확인은 필수.

--

[root@woo:10:21:48]#rpm -qa |grep Spam

만약 존재하면 rpm –e 명령으로 삭제

--

<MCPAN 설치>

[root@min:~]#perl -MCPAN -e shell

(Perl 모듈로 인스톨해주는 패키지 인스톨러 yum과 비슷

혹시 안 될경우 yum install MCPAN 으로 설치)

 

CPAN is the world-wide archive of perl resources. It consists of about

100 sites that all replicate the same contents all around the globe.

Many countries have at least one CPAN site already. The resources

found on CPAN are easily accessible with the CPAN.pm module. If you

want to use CPAN.pm, you have to configure it properly.

 

If you do not want to enter a dialog now, you can answer 'no' to this

question and I'll try to autoconfigure. (Note: you can revisit this

dialog anytime later by typing 'o conf init' at the cpan prompt.)

 

Are you ready for manual configuration? [yes] yes

 

The following questions are intended to help you with the

configuration. The CPAN module needs a directory of its own to cache

important index files and maybe keep a temporary mirror of CPAN files.

This may be a site-wide directory or a personal directory.

 

First of all, I'd like to create this directory. Where?

 

CPAN build and cache directory? [/root/.cpan]

--

 

 If you want, I can keep the source files after a build in the cpan

home directory. If you choose so then future builds will take the

files from there. If you don't want to keep them, answer 0 to the

next question.

 

How big should the disk cache be for keeping the build directories

with all the intermediate files?

 

Cache size for build directory (in MB)? [10] 100

 

By default, each time the CPAN module is started, cache scanning

is performed to keep the cache size in sync. To prevent from this,

disable the cache scanning with 'never'.

 

By default, each time the CPAN module is started, cache scanning

is performed to keep the cache size in sync. To prevent from this,

disable the cache scanning with 'never'.

 

Perform cache scanning (atstart or never)? [atstart]

 

To considerably speed up the initial CPAN shell startup, it is

possible to use Storable to create a cache of metadata. If Storable

is not available, the normal index mechanism will be used.

Cache metadata (yes/no)? [yes] yes

 

The next option deals with the charset your terminal supports. In

general CPAN is English speaking territory, thus the charset does not

matter much, but some of the aliens out there who upload their

software to CPAN bear names that are outside the ASCII range. If your

terminal supports UTF-8, you say no to the next question, if it

supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it

supports neither nor, your answer does not matter, you will not be

able to read the names of some authors anyway. If you answer no, names

will be output in UTF-8.

 

Your terminal expects ISO-8859-1 (yes/no)? [yes]
 
If you have one of the readline packages (Term::ReadLine::Perl,

Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN

shell will have history support. The next two questions deal with the

filename of the history file and with its size. If you do not want to

set this variable, please hit SPACE RETURN to the following question.

 

File to save your history? [/root/.cpan/histfile]

Number of lines to save? [100]

 

 

The CPAN module can detect when a module that which you are trying to

build depends on prerequisites. If this happens, it can build the

prerequisites for you automatically ('follow'), ask you for

confirmation ('ask'), or just ignore them ('ignore'). Please set your

policy to one of the three values.

 

Policy on building prerequisites (follow, ask or ignore)? [ask] follow

 

The CPAN module will need a few external programs to work properly.

Please correct me, if I guess the wrong path for a program. Don't

panic if you do not have some of them, just press ENTER for those. To

disable the use of a download program, you can type a space followed

by ENTER.

 

Where is your gzip program? [/bin/gzip] ENTER 클릭

Where is your tar program? [/bin/tar] ENTER 클릭

Where is your unzip program? [/usr/bin/unzip] ENTER 클릭

Where is your make program? [/usr/bin/make] ENTER 클릭

Where is your links program? [/usr/bin/links] ENTER 클릭

Where is your wget program? [/usr/bin/wget] ENTER 클릭

Warning: ncftpget not found in PATH

Where is your ncftpget program? []ENTER 클릭

Warning: ncftp not found in PATH

Where is your ncftp program? [] /usr/bin

Where is your ftp program? [/usr/kerberos/bin/ftp] ENTER 클릭

Where is your gpg program? [/usr/bin/gpg] ENTER 클릭

What is your favorite pager program? [/usr/bin/less] ENTER 클릭

What is your favorite shell? [/bin/bash] ENTER 클릭
 
Every Makefile.PL is run by perl in a separate process. Likewise we

run 'make' and 'make install' in processes. If you have any

parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass

to the calls, please specify them here.

 

If you don't understand this question, just press ENTER.

Parameters for the 'perl Makefile.PL' command?

Typical frequently used settings:

PREFIX=~/perl non-root users (please see manual for more hints)

 

Your choice: []

Parameters for the 'make' command?

Typical frequently used setting:

-j3 dual processor system

 

Your choice: []

Parameters for the 'make install' command?

Typical frequently used setting:

UNINST=1 to always uninstall potentially conflicting files

 

Your choice: []

 

Sometimes you may wish to leave the processes run by CPAN alone

without caring about them. As sometimes the Makefile.PL contains

question you're expected to answer, you can set a timer that will

kill a 'perl Makefile.PL' process after the specified time in seconds.
 
If you set this value to 0, these processes will wait forever. This is

the default and recommended setting.

 

Timeout for inactivity during Makefile.PL? [0]

 

(컴파일하는 파일을 만들어 주는 것)

If you're accessing the net via proxies, you can specify them in the

CPAN configuration or via environment variables. The variable in

the $CPAN::Config takes precedence.

 

Your ftp_proxy? ENTER 클릭

Your http_proxy? ENTER 클릭

Your no_proxy? ENTER 클릭

You have no /root/.cpan/sources/MIRRORED.BY

I'm trying to fetch one

CPAN: LWP::UserAgent loaded ok

Fetching with LWP:

ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY

 

 

Now we need to know where your favorite CPAN sites are located. Push

a few sites onto the array (just in case the first on the array won't

work). If you are mirroring CPAN to your local workstation, specify a

file: URL.

 

First, pick a nearby continent and country (you can pick several of

each, separated by spaces, or none if you just want to keep your

existing selections). Then, you will be presented with a list of URLs

of CPAN mirrors in the countries you selected, along with previously

selected URLs. Select some of those URLs, or just keep the old list.

Finally, you will be prompted for any extra URLs -- file:, ftp:, or

http: -- that host a CPAN mirror.

 

(1) Africa

(2) Asia(3) Australasia

(4) Central America

(5) Europe
 
(6) North America

(7) Oceania

(8) South America

Select your continent (or several nearby continents) [] 2

Sorry! since you don't have any existing picks, you must make a

geographic selection.

(1) China

(2) Hong Kong

(3) India

(4) Indonesia

(5) Japan

(6) Kazakhstan

(7) Republic of Korea

(8) Russia

(9) Singapore

(10) Taiwan

(11) Thailand

(12) Turkey

 

Select your country (or several nearby countries) [] 7

Sorry! since you don't have any existing picks, you must make a

geographic selection.

 

(1) ftp://cpan.mirror.cdnetworks.com/CPAN/

(2) ftp://cpan.sarang.net/CPAN/

(3) ftp://ftp.kaist.ac.kr/pub/CPAN

Select as many URLs as you like (by number),

put them on one line, separated by blanks, e.g. '1 4 5' [] 1 2 3

 

Enter another URL or RETURN to quit: []

New set of picks:

ftp://cpan.mirror.cdnetworks.com/CPAN/

ftp://cpan.sarang.net/CPAN/

ftp://ftp.kaist.ac.kr/pub/CPAN

 

commit: wrote /usr/lib/perl5/5.8.8/CPAN/Config.pm

Terminal does not support AddHistory.
 
cpan shell -- CPAN exploration and modules installation (v1.7602)

ReadLine support available (try 'install Bundle::CPAN')

cpan> install Bundle::CPAN ENTER 클릭

..

..

.

설치 중…

.

.

.

libnet-1.22/META.yml

libnet-1.22/SIGNATURE

 

CPAN.pm: Going to build G/GB/GBARR/libnet-1.22.tar.gz

 

Checking for Socket...ok

Checking for IO::Socket...ok

Checking if your kit is complete...

Looks good

 

Ah, I see you already have installed libnet before.

 

Do you want to modify/update your configuration (y|n) ? [yes]

 

This script will prompt you to enter hostnames that can be used as

defaults for some of the modules in the libnet distribution.

To ensure that you do not enter an invalid hostname, I can perform a

lookup on each hostname you enter. If your internet connection is via

a dialup line then you may not want me to perform these lookups, as

it will require you to be on-line.

 

Do you want me to perform hostname lookups (y|n) ? [yes]

 

The following questions all require a list of host names, separated

with spaces. If you do not have a host available for any of the

services, then enter a single space, followed by <CR>. To accept the

default, hit <CR>
 
Enter a list of available NNTP hosts : []엔터 입력

Enter a list of available SMTP hosts : []엔터 입력

Enter a list of available POP3 hosts : []엔터 입력

Enter a list of available SNPP hosts : []엔터 입력

Enter a list of available PH Hosts : []엔터 입력

Enter a list of available TIME Hosts : []엔터 입력

Enter a list of available DAYTIME Hosts : []엔터 입력

 

 

Do you have a firewall/ftp proxy between your machine and the internet

If you use a SOCKS firewall answer no

(y|n) ? [no]

 

Normally when FTP needs a data connection the client tells the server

a port to connect to, and the server initiates a connection to the client.

Some setups, in particular firewall setups, can/do not work using this

protocol. In these situations the client must make the connection to the

server, this is called a passive transfer.

 

Should all FTP connections be passive (y|n) ? [yes]

What is your local internet domain name : [] cho.iss

 

If you specified some default hosts above, it is possible for me to

do some basic tests when you run `make test'

 

This will cause `make test' to be quite a bit slower and, if your

internet connection is via dialup, will require you to be on-line

unless the hosts are local.

 

Do you want me to run these tests (y|n) ? [yes] no

.

.

.

.

.

.
 
Running make test

PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl

Features present: preput 1 getHistory 1 addHistory 1 attribs 1 ornaments 1 appname 1 minline 1 autohistory 1 newTTY 1 tkRunning 1 setHistory 1

Flipping rl_default_selected each line.

Enter arithmetic or Perl expression: exit[엔터]

..

..

.

.

.

.

cpan shell -- CPAN exploration and modules installation (v1.7602)

ReadLine support enabled

cpan> install Digest::SHA1 HTML::Parser Net::DNS LWP HTTP::Date IO::Zlib Archive::Tar Sys::Syslog Pod::Usage

 

cpan> install MIME::Base64 DB_File Net::SMTP Mail::SPF Mail::SPF::Query NetAddr::IP IP::Country::Fast Net::Ident IO::SocketINET6 IO::Socket::SSL Compress::Zlib Time::HiRes Mail::DKIM Mail::DomainKeys Crypt::OpenSSL::Bignum DBI Encode::Detect

 

cpan> install Mail::SpamAssassin

다 설치되면 "q"누르고 나옴.

 

[root@woo:11:22:25]#spamassassin -V

SpamAssassin version 3.2.5

running on Perl version 5.8.8

[root@woo:11:22:36]#
 



설치가 완료되면 이 디렉토리가 존재한다.

기본적으로 스팸 필터링을 하기 위해서 갖고있는 룰들이다.

/etc/mail/spamassassin/ 주 설정 파일

/usr/bin/spam => 관련 바이너리

/usr/share/spamassassin/ => 기본 제공 룰

 

Local.cf => Assassin이 사용하는 설정 파일이다.

[root@woo:11:22:36]#ls /etc/mail/spamassassin/

init.pre local.cf v310.pre v312.pre v320.pre

[root@woo:11:23:33]#useradd -M -s /bin/false -c "SpamAssassin Operator" spamd

[root@woo:11:24:09]#cat /etc/passwd |grep spamd

spamd:x:512:512:SpamAssassin Operator:/home/spamd:/bin/false

스팸어쌔신을 돌릴 계정하나 생성해준다.

이제 스크립트랑 서비스 등록을 하도록한다.

 

[root@woo:11:24:10]#vi /etc/sysconfig/spamassasin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#Hint : if you want to enable

# (the debug output goes to /var/log/maillog) then use :

# SPAMDOPTIONS="-x -u spamd -H /home/spamd -d -D"

# Don't leave debugging turned on unnecessarily though,

# because it will slow down a busy server.

#

# Otherwise, for normal operation (debugging disabled) use :

SPAMDOPTIONS="-x -u spamd -H /home/spamd -d"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:wq

http://203.237.211.230/named_scripts/spamassassin.html --> 파일전체 보기

[root@woo:11:31:54]#cp /root/.cpan/build/Mail-SpamAssassin-3.2.5/spamd/redhat-rc-script.sh

/etc/init.d/spamd => /root/.cpan/build 디렉토리에서 "tab"키를 누르면 디렉토리가 나오는데

위 디렉토리가 없으면 생성된 디렉토리 "1ehHth"로…

Mail-SpamAssassin-3.2.5-1ehHth/ Mail-SpamAssassin-3.2.5-zhS_E1/

Mail-SpamAssassin-3.2.5-1ehHth.yml Mail-SpamAssassin-3.2.5-zhS_E1.yml

[root@woo:11:31:54]#chmod 755 /etc/init.d/spamd

[root@woo:11:31:54]#chkconfig --add spamd

[root@woo:11:31:54]#chkconfig spamd on

[root@woo:11:31:54]#Service spamd start

 

[root@woo:11:31:54]#ps -ef |grep spamd

root 17643 1 48 11:31 ? 00:00:00 /usr/bin/spamd -d -c -m5 -H -r /var/run/spamd.pid

root 17651 17643 0 11:31 ? 00:00:00 spamd child

root 17652 17643 0 11:31 ? 00:00:00 spamd child

root 17662 27472 0 11:31 pts/4 00:00:00 grep --color spamd

[root@woo:11:31:55]#netstat -nlp |grep spamd

tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 17643/spamd.pid

로칼에서만 동작함.

스팸으로 인식하는 확률 약85~88% 정도이기 때문에 스팸메일을 정상으로 인식하는 확률은 줄어든다. 그래서 미디엄으로 한다.

<링크>

스팸을 지능적으로 필터링하기 위한 알고리즘

자동으로 학습시켜주는 것

스팸을 확인하기 위해서 스팸에대한 정보를 공유하기 위한 db서버를 참조

 

 

 

 

--

[root@woo:11:32:42]#mv /etc/mail/spamassassin/local.cf /etc/mail/spamassassin/local.cf.20091026

그전에 원 파일을 다른 이름으로 백업시켜놓는다.

#vi /etc/mail/spamassassin/local.cf ß 붙여넣기

#vi /etc/procmailrc

DROPPRIVS=yes

#SpamAssassin Procmail Start

#

:0fw: spamassassin.lock => Procmail이 스팸어쌔신이랑 통신을 할 때

* < 256000

| spamc –u $LOGNAME

#Spamassassin End

[root@woo:11:33:00]# service sendmail restart

[root@woo:11:33:00]# service spamd restart

[root@woo:11:33:00]# tail –f /var/log/maillog

--

 

이제 아웃룩에서 자기 자신한테 메일을 보내보자

From:kkk@cho.iss

To:kkk@cho.iss

 

 

=> 그 다음 로그를 확인한다.

로그 확인 결과 받은 메일은 깨끗하고 7.5점이 스팸으로 분류되는 점수이지만 2.8점으로

정상 메일로 분류되어 수신되었다.

 

=> 아웃룩에서 메일 헤더를 살펴본다.

"**" : 이 별표는 점수다.

스팸으로 분류되기 위해선 7.5점을 넘어서야 한다. 그렇기 때문에 스팸메일이 아닌 정상메일로 분류되었다.

 

지금 한 작업은 내부로 들어오는 메일에 대해서만 필터링을 하고 외부로 보내는 메일에 대해서는 필터링 하지 않는다. Clamav만 바이러스 필터링만 하고 보낸다.

 

--

그럼 밖으로 나가는 것은 어떻게 하느냐 SpamAss-Milter 를 설치/운영하여야 한다.

 

[root@woo:11:37:44]#spamassassin -t /root/.cpan/build/Mail-SpamAssassin-3.2.5-l1mFU3/sample-spam.txt

 

[root@woo:11:37:44]#spamassassin -t /root/.cpan/build/Mail-SpamAssassin-3.2.5-l1mFU3/sample-nonspam.txt

=> 스팸어쌔신이 제대로 작동하는지 확인할 수 있는 기능이다.

 

[root@woo:11:38:07]#cat /usr/share/spamassassin/20_head_tests.cf |more

=> 스팸어쌔신의 룰이다. 메일의 헤더를 테스트하기 위한 하나의 룰

각 룰 마다 점수화 되어있어 걸리면 점수가 추가 되는 식이다.

--

이제는 보내는 메일에 대해서 스팸 필터링을 해보자.

 

<SpamAssassin>

나가는 메일 필터링하기(Spamass-milter)

SpamAssassin의 경우 기본적으로 Inbound 되는 메일에 대한 Spam Filtering을 제공한다. 그렇다면 메일서버에서 외부로 나가는 메일에 대한 필터링 부분이 있을것이다. 이부분을 해결해 주는 것이 Spamass-milter라는 별도의 Milter mail filter이다.

=> 다운로드 받자

 

[root@woo:11:39:10]#cd /

[root@woo:11:39:10]#mkdir /usr/local/src/spam

[root@woo:11:39:11]#cd /usr/local/src/spam

[root@woo:11:39:11]#wget http://ftp.twaren.net/Unix/NonGNU/spamass-milt/spamass-milter-0.3.1.tar.gz

[root@woo:11:39:27]#tar xvfz spamass-milter-0.3.1.tar.gz

[root@woo:11:39:33]#cd /etc/mail

=> 기존의 sendmail.cf를 백업할 것이다.

[root@woo:11:39:33]#mv sendmail.cf sendmail.cf.20091026

 

[root@woo:11:39:40]#vi sendmail.mc

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

53 define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN P LAIN')dnl => 주석 없는지 확인

116 DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl => 0.0.0.0 주소 부분 확인

맨 밑에 추가 삽입

앞에는 '`' 1옆에 있는 거 뒤에는 ' ' ' 콜론 옆에 따옴표

177 INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spammilter/spamass.soc k, F=,T=C:15m;S:4m;E:10m')dnl

178 define(`confMILTER_MACROS_CONNECT', `t, b, j, _, {daemon_name}; {if_name}, {if_addr}')dnl

179 define(`confMILTER_MACROS_HELO', `s, {tls_version}, {cipher}, {cipher_bits }, {cert_subject}, {cert_issuer}')dnl

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:wq

 

[root@woo:11:42:50]#m4 sendmail.mc > sendmail.cf

[root@woo:11:42:51]#cat sendmail.cf |grep Filter

O InputMailFilters=spamassassin

 

 

[root@woo:11:42:56]#vi sendmail.cf

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

549 O InputMailFilters=spamassassin

550

551 # Milter options

552 #O Milter.LogLevel

553 O Milter.macros.connect=t, b, j, _, {daemon_name}; {if_name}, {if_addr}

554 O Milter.macros.helo=s, {tls_version}, {cipher}, {cipher_bits}, {cert_sub ject}, {cert_issuer}

555 O Milter.macros.envfrom=i, {auth_type}, {auth_authen}, {auth_ssf}, {auth_ author}, {mail_mailer}, {mail_host}, {mail_addr}

556 O Milter.macros.envrcpt={rcpt_mailer}, {rcpt_host}, {rcpt_addr}

557 O Milter.macros.eom={msg_id}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

확인한다. => 이렇게 되어 있음 잘 된거다.

 

 

 

[root@woo:11:43:29]#cd /usr/local/src/spam/spamass-milter-0.3.1

[root@woo:11:43:32]#./configure && make && make install

[root@woo:11:43:49]#mkdir /var/run/spammilter

[root@woo:11:43:54]#chown spamd.spamd /var/run/spammilter/

[root@woo:11:43:58]#chmod 755 /var/run/spammilter/

[root@woo:11:44:05]#/usr/local/sbin/spamass-milter -p /var/run/spammilter/spamass.sock –f

[root@woo:11:44:08]#ps -ef |grep spam

root 17867 1 0 11:33 ? 00:00:00 /usr/bin/spamd -d -c -m5 -H -r /var/run/spamd.pid

root 17875 17867 0 11:33 ? 00:00:00 spamd child

root 17876 17867 0 11:33 ? 00:00:00 spamd child

root 20765 1 0 11:44 ? 00:00:00 /usr/local/sbin/spamass-milter -p

/var/run/spammilter/spamass.sock -f

 

root 20782 27285 0 11:44 pts/2 00:00:00 grep --color spam

 

[root@woo:11:44:09]#service sendmail restart

Shutting down sm-client: [ OK ]

Shutting down sendmail:                      [ OK ]

Starting sendmail: [ OK ]

Starting sm-client: [ OK ]

[root@woo:11:44:14]#tail –f /var/log/maillog => 로그 보기

 

=> 아웃룩에서 다시 메일을 보내보자. 외부로.

 

Spammilter는 단순히 필터 기능을 제공할뿐 실제적인 일은 SpamAssassin이 해준다.

Spammilter를 설치/운영 하기 위해서는 반드시 SpamAssassin이 설치되어 있어야 한다.

 

================================================================

 

 

 

받는 쪽 tack7001@nate.com

 

[root@woo:11:44:14]#cd /etc/init.d

http://203.237.211.230/named_scripts/spammilter.html => 전체복사

[root@woo:11:46:59]#vi milter => 붙여넣기

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

37 daemon --user=spamd /usr/local/sbin/spamass-milter -p ${SM_SOCKET} –f

$ {SM_EXTRA_FLAGS}

=> nobody 에서 spamd 로 바꿈.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:wq

[root@woo:11:44:14]#cd /etc/init.d

[root@woo:11:46:59]#vi milter

[root@woo:11:47:09]#vi milter

[root@woo:11:47:17]#chmod 755 milter

[root@woo:11:47:18]#chkconfig --add milter

[root@woo:11:47:18]#chkconfig milter on

[root@woo:11:47:19]#service milter restart

Shutting down spamass-milter: [ OK ]

Starting spamass-milter: runuser: warning: cannot change directory to /home/spamd: No such file or directory

[ OK ]

[root@woo:11:47:24]#ps -ef |grep spam

root 17867 1 0 11:33 ? 00:00:00 /usr/bin/spamd -d -c -m5 -H -r /var/run/spamd.pid

root 17875 17867 0 11:33 ? 00:00:01 spamd child

root 17876 17867 0 11:33 ? 00:00:00 spamd child

spamd 21015 1 0 11:47 ? 00:00:00 /usr/local/sbin/spamass-milter -p

/var/run/spammilter/spamass.sock -f -b spam -- -d 127.0.0.1 -p 783

--

 

[root@woo:11:51:29]#vi sendmail.cf

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

91 Cwcho.iss

103 DSmailx.cho.iss

166 DZ8.13.8 => DZhello

189 #O MaxMessageSize=10240000

225 #O HelpFile=/etc/mail/helpfile => 주석달음

447 O SmtpGreetingMessage=$j Exchange; $b

482 O MaxRecipientsPerMessage=10

549 O InputMailFilters=spamassassin, clmilter

550 Xclmilter, S=local:/var/run/clamav/clmilter.sock,F=,T=S:4m;R:4m

1671 Xspamassassin, S=local:/var/run/spammilter/spamass.sock, F=,T=C:15m;S:4m;E:10m

=> 들어가있는지 확인

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:wq

 

[root@woo:11:52:22]#service sendmail restart

Shutting down sm-client: [ OK ]

Shutting down sendmail: [ OK ]

Starting sendmail: [ OK ]

Starting sm-client: [ OK ]

 

[root@woo:11:52:24]#tail -f /var/log/maillog

--

자기 자신한테 메일 보내본다.