1 / 28

Sendmail 8.11.3 의 모든것

Sendmail 8.11.3 의 모든것. 일시 : 01.4.28 발표 : 정 남 억. 차 례. sendmail 이란? 패키지 구하기 패키지 풀기 기존 sendmail Backup configure 및 make sendmail 환경설정 및 설치 sendmail 시동 sendmail 의 Testing 8. sendmail relay test. SendMail 이란?.

sydnee
Télécharger la présentation

Sendmail 8.11.3 의 모든것

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sendmail 8.11.3 의 모든것 일시 : 01.4.28 발표 : 정 남 억 (주)그린벨시스템즈

  2. 차 례 • sendmail 이란? • 패키지 구하기 • 패키지 풀기 • 기존 sendmail Backup • configure 및 make • sendmail 환경설정 및 설치 • sendmail 시동 • sendmail의 Testing • 8. sendmail relay test (주)그린벨시스템즈

  3. SendMail 이란? sendmail은 인터넷 전자편지의 표준 규약인 SMTP (Simple Mail Transfer Protocol)를 지원하는 전형적인 MTA(Message Transfer Agent) 데몬으로 1970년대 후반에 버어클리 유닉스로 유명한 캘리포니아의 버어클리 대학의 인재인 Eric Allman씨에 의해 작성되었다. Eric Allman씨는 현재 Sendmail Inc.라고 불리우는 자신의 회사를 운영하고 있으며 공개 소프트웨어계의 거물급 인사이다. UNIX 기계에 MTA(Message Transfer Agent)인 sendmail과 중간 매개체인 popper/imap4를 설치하여 mail 서버로 삼고, PC쪽에서 Outlook, Eudora등의 MUA(Message User Agent)를 설치하여 서버쪽에 저장된 편지를 끌어당겨서 읽도록 환경을 설정하고 운영하는 과정은 익히 알려진 표준화된 관리방법으로 자리잡고 있다 sendmail 8.11.3 계열 설치와 관련한 가장 기본적인 최소한의 사항만 설명했으므로 보다 자세한 내용을 알고 싶다면 sendmail 패키지에 딸려오는 문서를 확인하기 바란다 ※주의사항 sendmail은 해커들의 주요 공격 목표이므로 항시 최신판으로 무장하고 있어야 함에 주의하자. (주)그린벨시스템즈

  4. 1. 패키지 구하기 1.1.1. www.sleepycat.com 의 Berkeley DB 2.7.5 1.1.2. GNU 의 M4 1.4, groff 패키지 1.1.3. www.sendmail.org 의 sendmail 8.11.3 버전 (주)그린벨시스템즈

  5. 2. 패키지 풀기 http://www.sunfreeware.com/gcc-2.95.3-sol26-sparc-local.gz compiled GNU C/C++/FORTRAN/Java compiler package installs in /usr/local 2.1 gcc-2.95.3 # gzip –d gcc-2.95.3-sol26-sparc-local.gz # pkgadd –d gcc-2.95.3-sol26-sparc-local 2.2 berkeley DB # gzip –d db-2.7.5.tar.gz # tar xvf db-2.7.5.tar 2.3 m4-1.4 # gzip –d m4-1.4.tar.gz # tar xvf m4-1.4.tar (주)그린벨시스템즈

  6. 2.4 groff-1.11a # gzip –d groff-1.11a.tar.gz # tar xvf groff-1.11a.tar 2.5 sendmail # gzip –d sendmail.8.11.3.tar.gz #tar xvf sendmail.8.11.3.tar ※ db-2.7.5 & groff-1.11a 은 설치 options (주)그린벨시스템즈

  7. 3. 기존 sendmail Backup # mv /usr/lib/sendmail /usr/lib/sendmail.org # mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf.org (주)그린벨시스템즈

  8. 4. configure 및 make 4.1 Berkeley DB # cd /db-2.7.5/dist # ./configure # make # make install 4.2 m4 # cd /m4-1.4 # ./configure # make # make install 4.3 groff # cd groff-1.11a # ./configure # make # make install (주)그린벨시스템즈

  9. 4.4 sendmail • 다음과 같은 방법으로 현재 사용중인 시스템 사양을 확인해보자 • # uname –a • SunOS nejoung 5.6 Generic_105181-05 sun4m sparc sun4m (주)그린벨시스템즈

  10. 4.4.1 Berkeley DB를 사용할경우 • # cd /sendmail-8.11.3/devtools/OS • # chmod u+w SunOS.5.6 • # cp SunOS.5.6 linux • ----------------- linux ----------------------- • define(`confCC', `gcc’) • define(`confMAPDEF', `-DNEWDB -DNIS -DMAP_REGEX') • define(`confENVDEF', `-DV4FS ') • define(`confOPTIMIZE', `-O') • define(`confLIBS', `-ldb')define(`confSHELL', `/usr/bin/sh') • define(`confSTDIR', `/etc/mail') • define(`confHFDIR', `/usr/share/lib') • define(`confINSTALL', `${BUILDBIN}/install.sh') • define(`confSBINGRP', `mail') • ----------------- linux-------------------------- • sendmail8.9.3은/sendmail8.9.3/BuildTools/OS/SunOS.5.6 file 에 위치 (주)그린벨시스템즈

  11. site.config.m4파일을 작성. ------------ site.config.m4 --------------------------- APPENDDEF(`confINCDIRS', `-I/usr/local/BerkeleyDB/include') APPENDDEF(`confLIBDIRS', `-L/usr/local/BerkeleyDB/lib') ------------ site.config.m4 --------------------------- M4 패키지에서 APPENDDEF라는 명령은 해당 매크로 확장 뒷부분에 새로운 문자열을 추가시키는 작용을 한다. 만약Berkeley DB를 설치하지 않고 컴파일만 해둔 경우라면 ------------ site.config.m4 --------------------------- APPENDDEF(`confINCDIRS', `-I/home/ftp/db-2.7.5/dist') APPENDDEF(`confLIBDIRS', `-L/home/ftp/db-2.7.5/dist') ------------ site.config.m4 --------------------------- (주)그린벨시스템즈

  12. Berkeley DB를 사용안한경우( /sendmail-8.11.3/devtools/OS/SunOS.5.6) • #$Id: SunOS.5.6,v 8.14.18.3 2000/12/14 01:04:46 rand Exp $ • define(`confCC', `gcc') • define(`confLDOPTS_SO',`-G') • define(`confSONAME',`-h') • define(`confBEFORE', `sysexits.h') • define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS -DMAP_REGEX') • define(`confENVDEF', `-DSOLARIS=20600') • define(`confLIBS', `-lsocket -lnsl -lkstat') • define(`confMTLDOPTS', `-lpthread') • define(`confMBINDIR', `/usr/lib') • define(`confEBINDIR', `/usr/lib') • define(`confSBINGRP', `sys') • define(`confINSTALL', `${BUILDBIN}/install.sh') • define(`confDEPEND_TYPE', `CC-M') • PUSHDIVERT(3) • sysexits.h: • if [ -r /usr/include/sysexits.h ]; \ • then \ ln -s /usr/include/sysexits.h; \ • fi (주)그린벨시스템즈

  13. 4.4.2 sendmail 컴파일 # cd /sendmail-8.11.3 # ./Build (주)그린벨시스템즈

  14. 5. sendmail 환경설정 및 설치 • O/S 에 관한 ~.mc가 없을 때 아래와 같이 설정한다. • 임의의 config 파일을 복사하여 새로운 이름으로 config 파일을 생성시키고수정을 위해 미리 쓰기 권한을 부여해둔다. • # cp /sendmail-8.11.3/cf/cf/generic-solaris2.mc generic-linux.mc • # chmod u+w generic-linux.mc • --------------- generic-linux.mc ------------- • . divert(-1) • . divert(0)dnl • . VERSIONID(`@(#)generic-linux.mc 8.8 (Berkeley) 5/19/1998') • . OSTYPE(linux)dnl • . DOMAIN(generic)dnl • . MAILER(local)dnl • . MAILER(smtp)dnl • --------------- generic-linux.mc ---------------------- (주)그린벨시스템즈

  15. config 파일(예: generic-linux.mc)의 가장 마지막 줄에 추가. ----------------가장 마지막 줄에 추가 ------------------- FEATURE(access_db, `hash -o /etc/mail/access')dnl ---------------- 가장 마지막 줄에 추가 ------------------- (주)그린벨시스템즈

  16. 3rd party relay attack방어 -------------- 가장 마지막 줄에 추가 ------------------- FEATURE(relay_hosts_only) -------------- 가장 마지막 줄에 추가 ------------------- -------------- 가장 마지막 줄에 추가 ------------------- FEATURE(relay_entire_domain) -------------- 가장 마지막 줄에 추가 ------------------- (주)그린벨시스템즈

  17. 5.1 sendmail.cf 생성 # cd sendmail-8.11.3/cf/cf # /usr/local/bin/m4 ../m4/cf.m4 generic-solaris2.mc > #/etc/mail/sendmail.cf 5.2 sendmail설치 # cd sendmail-8.11.3/obj. SunOS.5.6.sun4/sendmail # make install 5.3 makemap 복사 # cd sendmail-8.11.3/obj. SunOS.5.6.sun4/makemap # make install 5.4 sendmail.cf 복사 # cp sendmail-8.11.3/cf/cf/sendmail.cf /etc/mail/ # ln -s /etc/mail/sendmail.cf /etc/sendmail.cf (주)그린벨시스템즈

  18. 5.5 sendmail.cw 생성 • # cd /etc/mail • # touch sendmail.cw • # cd .. • # ln –s /etc/mail/sendmail.cw /etc (주)그린벨시스템즈

  19. 5.5.1 aliases 및 aliases.db 생성 • /etc/mail/aliases • ----------------- aliases ------------------ • administrator: root • ----------------- aliases ------------------ • sendmail 이 alias 검색을 위해 사용하는 aliases.db를 생성시키자. • # cd /etc/mail/ ; 0 bytes짜리 파일을 만들어내는 명령 • # touch aliases.db ; sendmail -bi 명령이 aliases.db를 초기에 • 생성시키는데 실패할 경우를 피하기 위함 • # chmod 644 aliases.db • # sendmail -bi ; aliases 파일에 있는 규칙을 • aliases.db에 file hash table 형식으로 저장 • /etc/mail/aliases: 1 aliases, longest 4 bytes, 17 bytes total (주)그린벨시스템즈

  20. 5.5.2 relay-domains 설정 • /etc/mail/relay-domains 파일에 relay를 원하는 domain 혹은 host를 한줄에 하나씩 적어준 다음 sendmail을 재시동 (주)그린벨시스템즈

  21. 5.5.3 access 및 access.db 생성 • ----------------- access --------------------- • 203.240.208 RELAY • 203.240.209 RELAY • devilhacker@devilhacker.com REJECT • root@nameog.greenbell.co.kr 550 I hate spammers like you! • ----------------- access ---------------------- • access.db를 생성시키고 makemap으로 규칙을 등록. • # cd /etc/mail/ • # touch access.db # chmod 644 access.db • # ./makemap dbm /etc/mail/access < /etc/mail/access • *********************************************************** • Berkeley DB 일때 • /usr/sbin/makemap hash /etc/mail/access < /etc/mail/access • *********************************************************** (주)그린벨시스템즈

  22. Makemap 명령 Shell script작성 • --------------- do_it.sh -------------------------- • #!/bin/sh • /etc/mail/makemap dbm /etc/mail/access < /etc/mail/access • --------------- do_it.sh -------------------------- • do_it.sh를 사용하기 전에 실행 권한을 주는 것을 잊지 말자. (주)그린벨시스템즈

  23. 5.5.4디렉토리 접근허가 변경 • /etc, /etc/mail, /usr, /var, /var/spool, /var/spool/mqueue 디렉토리의 • 소유주는 root이어야 한다. • # chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue • # chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue • # chmod -R go-w /etc/mail • sendmail의 디렉토리 관련 접근허가 테스트 • # sendmail -v –bi • /etc/mail/aliases: 3 aliases, longest 10 bytes, 45 bytes total (주)그린벨시스템즈

  24. 6. sendmail 시동 • # ps -ef | grep sendmail • root 1503 1 0 7월 26 ? 0:16 /usr/lib/sendmail -bd –q30m • # kill -9 1503 • # /usr/lib/sendmail -bd -q30m • # ps -ef | grep sendmail • root 1809 1 0 7월29 ? 0:16 /usr/lib/sendmail -bd –q30m • 화면에 특별한 메시지가 나타나지 않는다면 daemon이 성공리에 동작 한 것이다. (주)그린벨시스템즈

  25. 7.sendmail의 Testing • 7.1 sendmail daemon 확인 • # telnet localhost smtp • Trying 127.0.0.1 • Connected to localhost • Escape character is '^]'. • 220 localhost ESMTP Sendmail 8.11.3/8.11.3; Tue, 27 Jul 1999 17:05:09 +1000 (KDT) • 위의 sendmail banner가 나오면 정상적으로 sendmail daemon이 동작하고 • 있는 것이다. • 7.2 sendmail 발송 확인 • # /usr/lib/sendmail -v yourid(root) • test • . • yourid... Connecting to local... • yourid... Sent (주)그린벨시스템즈

  26. 7.3 sendmail 수신 확인 • mail, pine, mutt등을 사용하여 localhost의 yourid 계정에서 직접 수신된 편지를 확인해본다. • 7.4 외부로부터의 송수신 확인 • 내부에서 편지를 주고받을 수 있으면 이제 외부 호스트와 localhost의 yourid 계정 사이에 편지를 주고받아 송수신이 가능한지 살펴본다 • 7.5 Relay 확인 • 내부 PC에서 sendmail 호스트를 localhost로 잡아두고 전자편지를 발송하여 제대로 전달되는지 살펴본다 (주)그린벨시스템즈

  27. 8. Mail relay testing • Address to test:(as host name or dotted quad) • Your e-mail address:(leave blank for anonymous mode) • Your abuse.net password:(see below if you don't know it) • Check this box if you're testing a server that normally receives mail for you. • Create an abuse.net address(Address valid for 24 hours only) • Click this button to start testing • If you are a registered abuse.net user but don't have the abuse.net password from your welcome message, enter your e-mail address bove and click this button to mail yourself your password. 참조 : http://www.abuse.net/relay.html (주)그린벨시스템즈

  28. 8.1Mail relay testing결과 Connecting to 203.240.208.16 for anonymous test ... <<<220nejoung.greenbell.co.krESMTPSendmail8.11.3/8.11.3;Tue,24Apr200110:02:02+0900(KST)>>>HELOwww.abuse.net<<<250nejoung.greenbell.co.krHellowww.abuse.net[208.31.42.77],pleasedtomeetyou Relay test 1 >>>RSET<<<2502.0.0Resetstate>>>MAILFROM:<spamtest@abuse.net><<<2502.1.0<spamtest@abuse.net>...Senderok>>>RCPTTO:<relaytest@abuse.net><<<5505.7.1<relaytest@abuse.net>...Relayingdenied Relay test 2 >>>RSET<<<2502.0.0Resetstate>>>MAILFROM:<spamtest><<<5015.5.4<spamtest>...Domainnamerequiredforsenderaddressspamtest Relay test result All tests performed, no relays accepted (주)그린벨시스템즈

More Related