### Sendmail config 분석


[root@ip-10-90-10-49 mail]# ll -a

total 200

drwxr-xr-x  2 root root  4096 Aug 13 02:16 .

drwxr-xr-x 77 root root  4096 Aug 28 02:18 ..

-rw-r--r--  1 root root   469 Aug 17  2016 access

-rw-r-----  1 root root 12288 Aug 13 02:16 access.db

-rw-r--r--  1 root root     0 Aug 13 02:16 aliasesdb-stamp

-rw-r--r--  1 root root   233 Aug 17  2016 domaintable

-rw-r-----  1 root root 12288 Aug 13 02:16 domaintable.db

-rw-r--r--  1 root root  5584 Aug 17  2016 helpfile

-rw-r--r--  1 root root    64 Aug 17  2016 local-host-names

-rw-r--r--  1 root root   997 Aug 17  2016 mailertable

-rw-r-----  1 root root 12288 Aug 13 02:16 mailertable.db

-rwxr-xr-x  1 root root  2700 Aug 17  2016 make

-rw-r--r--  1 root root    92 Aug 17  2016 Makefile

-rw-r--r--  1 root root 58439 Aug 17  2016 sendmail.cf

-rw-r--r--  1 root root  7202 Aug 17  2016 sendmail.mc

-rw-r--r--  1 root root 41521 Aug 17  2016 submit.cf

-rw-r--r--  1 root root   941 Aug 17  2016 submit.mc

-rw-r--r--  1 root root   127 Aug 17  2016 trusted-users

-rw-r--r--  1 root root  1847 Aug 17  2016 virtusertable

-rw-r-----  1 root root 12288 Aug 13 02:16 virtusertable.db

[root@ip-10-90-10-49 mail]#



[access / access.db]


http://www.sendmail.org/~ca/email/doc8.12/cf/m4/anti_spam.html#top


Access Database


An ``access'' database can be created to accept or reject mail from selected domains. For example, you may choose to reject all mail originating from known spammers. To enable such a database, use


도메인에 대해 허용 및 거부에 대한 설정을 할수 있다. 


FEATURE(`access_db') 위의 설정으로 위의 기능을 enable 할수 있다. 


/etc/mail/access 는 database 이기때문에 아래의 명령어로 map 을 생성해야 합니다.


makemap hash /etc/mail/access < /etc/mail/access


ipv6 도 지원가능


spammer@aol.com REJECT

cyberspammer.com REJECT

TLD REJECT

192.168.212 REJECT

IPv6:2002:c0a8:02c7 RELAY

IPv6:2002:c0a8:51d2::23f4 REJECT



 - The value part of the map can contain: (설정값에 대한 설명)


OK Accept mail even if other rules in the running ruleset would reject it, for example, if the domain name is unresolvable. "Accept" does not mean "relay", but at most acceptance for local recipients. That is, OK allows less than RELAY.

ㄴ ok 는 relay 보다 작은 의미로 사용된다. 해당서버의 수신자에게 허용을 해주는 정책


RELAY Accept mail addressed to the indicated domain or received from the indicated domain for relaying through your SMTP server. RELAY also serves as an implicit OK for the other checks.

ㄴ 지정된 도메인으로 발송 되거나 수신 된 메일을 smtp 서버를 통해서 relay 할수 있도록 허용해줌, 암시적 OK 역활도 수행


REJECT Reject the sender or recipient with a general purpose message.

ㄴ 보낸사람, 받는사람에 대한 message 를 거부


DISCARD Discard the message completely using the $#discard mailer. If it is used in check_compat, it affects only the designated recipient, not the whole message as it does in all other cases. This should only be used if really necessary.

ㄴ 메시지를 버림, check_compat 가 사용되면 수신자에게만 적용, 필요한 경우에만 사용


SKIP This can only be used for host/domain names and IP addresses/nets. It will abort the current search for this entry without accepting or rejecting it but causing the default action.

ㄴ host 및 domain 과 ip 와 subnet 에 사용이 가능함, 적용범위에 대해서 허용및 거부 정책에 대해서 검색하지 않고 기본 동작을 중지함


### any text where ### is an RFC 821 compliant error code and "any text" is a message to return for the command. The string should be quoted to avoid surprises, e.g., sendmail may remove spaces otherwise. This type is deprecated, use one the two ERROR: entries below instead.

ㄴ RFC 821 호환 오류코드, 더이상 사용되지 않음


ERROR:### any text as above, but useful to mark error messages as such.

ㄴ 오류 메시지


ERROR:D.S.N:### any text where D.S.N is an RFC 1893 compliant error code and the rest as above.

ㄴ RFC 1893 호환 오류 코드




 - For example:


cyberspammer.com ERROR:550 "We don't accept mail from spammers"

okay.cyberspammer.com OK

sendmail.org RELAY

128.32 RELAY

IPv6:1:2:3:4:5:6:7 RELAY

[127.0.0.3] OK

[IPv6:1:2:3:4:5:6:7:8] OK


okay.cyberspammer.com 의 메일은 수락, cyberspammer.com 의 다른 모든 호스트에 대해서 위의 메시지와 함께 거부

sendmail.org, 128.32.*.*, IPv6:1:2:3:4:5:6:7.* 에서 relay 가능

[127.0.0.3], [IPv6:1:2:3:4:5:6:7:8] 는 네트워크 범위가 아닌 텍스트로 해석이 됨



추가적인 이론은 공식문서 내용을 참조 



[domaintable/domaintable.db]


http://etutorials.org/Server+Administration/Sendmail/Part+I+Build+and+Install/Chapter+4.+Configure+sendmail.cf+with+m4/FEATUREdomaintable/


domainable 은 sendmail 8.2 이상에서 사용이 가능함, 8.8 버전이상부터는 virtual domain 으로 대채가 가능, 공식문서에는 domaintable 에 대한 내용이 없음


before.abc.com 도메인으로 서비스를 하다가 after.abc.com 으로 서비스를 변경하려고할때 이전의 도메인에 대한 요청을 이후의 도메인으로 전달해주는 설정이다. 



[mailertable/mailertable.db]


http://etutorials.org/Server+Administration/Sendmail/Part+I+Build+and+Install/Chapter+4.+Configure+sendmail.cf+with+m4/FEATUREmailertable/


메일 라우팅을 하는것에 대한 설정



[virtusertable/virtusertable.db]


하나의 호스트에서 여러게의 도메인을 호스팅 할때에 사용하는 기능입니다.


https://oops.org/?t=lecture&sb=sendmail&n=4

http://etutorials.org/Server+Administration/Sendmail/Part+I+Build+and+Install/Chapter+4.+Configure+sendmail.cf+with+m4/FEATUREvirtusertable/


info@stuff.for.sale.com       bob

info@stuff.wanted.com         hans@remote.host

info@auction.com              hans@remote.host

@fictional.com                user@another.host


info@stuff.for.sale.com 메일은 bob local user mailbox 로 전달됨

info@stuff.wanted.com, info@auction.com 메일은 hans@remote.host 메일로 전달됨

@fictional.com 호스트의 모든 메일은 user@another.host 메일로 전달됨


info@stuff.for.sale.com       forsale@fictional.com

@fictional.com                user@another.host


info@stuff.for.sale.com 메일은 결과적으로 user@another.host 메일로 전달됨



ㅁsdndmail.mc 파일에 아래의 설정이 되어 있어야 합니다.


FEATURE(`virtusertable')



ㅁKvirtusertable hash /etc/mail/virtusertable 명령을 통해서 db 에 저장할수 있습니다.


Kvirtusertable hash /etc/mail/virtusertable



ㅁ아래의 설정처럼 db 파일을 지정할수 있습니다.


FEATURE(`virtusertable',`dbm -o /etc/mail/virt_user_table')



ㅁdb 형식으로 LDAP 으로 지정할수도 있습니다. 


FEATURE(`virtusertable', `LDAP')




[trusted-users]


http://etutorials.org/Server+Administration/Sendmail/Part+I+Build+and+Install/Chapter+4.+Configure+sendmail.cf+with+m4/FEATUREuse_ct_file/


신뢰할수 있는 사용자를 등록하는 설정 파일 입니다. 



ㅁsendmail 기능에서 아래의 내용이 되어 있어야 합니다. 

FEATURE(`use_ct_file')



ㅁ설정 파일을 변경하려면 아래의 내용처럼 수정을 해줘야 합니다. 

define(`confCT_FILE', `/etc/mail/trusted.list')



일반적인 localuser 를 등록해주면 된다. 설정파일에는 "# apache, mailman, majordomo, uucp, are good candidates" apache 등의 시스템 유저를 등록해주면 좋다 라고 언급이 되어 있다. 




[local-host-name]


https://www.linux.co.kr/home/lecture/?leccode=394

http://etutorials.org/Linux+systems/red+hat+linux+9+professional+secrets/Part+III+Internetworking+with+Red+Hat+Linux/Chapter+15+Mail+Server/Using+sendmail/


sendmail 서버가 메일을 승인할때 등록하는 도메인 설정 파일 입니다. 



'MAIL > Sendmail' 카테고리의 다른 글

Sendmail 기본설치 및 테스트  (0) 2017.10.31

+ Recent posts