Sendmail 8.14.4 Build for RHEL4 (x86) writer : 이경호
목차 1. 시스템구성... - 2-1.1. 개요... - 2-1.1.1. 정의... - 2-1.1.2. 목적... - 2-1.1.3. 환경... - 2-2. 준비사항... - 3-2.1. 필수설치프로그램... - 3-2.2. Sendmail 서버구축을위한준비... - 3-2.2.1. Sendmail 서버정의... - 3-2.2.2. Sendmail 구성도... - 3-3. Sendmail 8.14.4 설치... - 4-4. Sendmail 설정파일생성... - 5-5. Sendmail 중요설정파일생성및설정... - 6-6. Sendmail 데몬시작... - 7-7. Sendmail 테스트... - 8-8. Sendmail 다운받는곳... - 10-9. 참고자료... - 11 - - 1 -
1. 시스템구성 1.1. 개요 1.1.1. 정의 - VMware 7 을이용 RHEL4 OS 에 Sendmail 서버구축 1.1.2. 목적 - Sendmail 서버구축및테스트가이드를작성합니다. 1.1.3. 환경 - Windows OS : Windows 7 Ultimate K (x64) - Linux OS : Red Hat Enterprise Linux 4 (x32) - Virtual machine : Vmware 7 - Process : Intel Core i5 CPU M 460 @ 2.53GHz - memory : 4G - IP : 192.168.111.10-2 -
2. 준비사항 2.1. 필수설치프로그램 Program Version Usage VMware 7 가상머신설치 Xmanager 4 Shell, OUI, FTP 지원 RHEL4 OS machine 2.6.9 실습리눅스 OS 2.2. Sendmail 서버구축을위한준비 2.2.1. Sendmail 서버정의 - Sendmail은인터넷전자메일의표준규약인 SMTP(Simple Mail Transfer Protocol) 프로토콜을통해서메일서비스기능을한다. Sendmail은메일서버간에메일을주고받는역할을합니다. 2.2.2. Sendmail 구성도 메일서버 1 메일서버 2 /var/spool/mqueue 메일큐 MDA SMTP 인터넷 SMTP 센드메일 (MTA) MDA /var/spool/maile/ 사용자명 센드메일 (MTA) 메일박스 dovecot(mra SMTP 메일클라이언트 1(MUA) POP3 IMAP 메일클라이언트 2(MUA) - 3 -
3. Sendmail 8.14.4 설치 [ 설명 ] sendmail rpm 설치내역확인하여있을경우제거합니다. [root@gz ~]# rpm qa grep sendmail [root@gz ~]# rpm -e --nodeps [ 패키지이름 ] [ 설명 ] wget을활용하여 /usr/local/src 디렉토리에다운받습니다. [root@gz src]# pwd /usr/local/src [root@gz src]# wget ftp://ftp.sendmail.org/pub/sendmail/sendmail.8.14.4.tar.gz --14:52:49-- ftp://ftp.sendmail.org/pub/sendmail/sendmail.8.14.4.tar.gz => `sendmail.8.14.4.tar.gz' Resolving ftp.sendmail.org... 209.246.26.22 Connecting to ftp.sendmail.org 209.246.26.22 :21... connected. Logging in as anonymous... Logged in! ==> SYST... done. ==> PWD... done. ==> TYPE I... done. ==> CWD /pub/sendmail... done. ==> PASV... done. ==> RETR sendmail.8.14.4.tar.gz... done. Length: 2,080,472 (2.0M) (unauthoritative) 100%[==================================================== ======================================================== ========================>] 2,080,472 205.33K/s ETA 00:00 14:53:02 (193.93 KB/s) - `sendmail.8.14.4.tar.gz' saved [2080472] [ 설명 ] 압축해제하고압축해제된디렉토리로이동합니다. [root@gz src]# tar zxf sendmail.8.14.4.tar.gz [root@gz src]# ls sendmail-8.14.4 sendmail.8.14.4.tar.gz [root@gz src]# cd sendmail-8.14.4/ [ 설명 ] smtp의항목이주석처리되어있는지확인합니다. ( 주석처리가있으면삭제 ) [root@gz sendmail-8.14.4]# grep smtp /etc/services smtp 25/tcp mail smtp 25/udp mail - 4 -
[ 설명 ] make 컴파일시디렉토리가없어서에러가날수도있습니다. 에러메시지를확인하여아래와같이디렉토리를생성합니다. install: cannot create regular file `/usr/man/man1/vacation.1': No such file or directory install: cannot create regular file `/usr/man/man8/praliases.8': No such file or directory [root@gz sendmail-8.14.4]# mkdir -p /usr/man/man8 [root@gz sendmail-8.14.4]# mkdir -p /usr/man/man1 [ 설명 ] make 컴파일이정상적으로완료되면 make install 설치하는명령어입니다. [root@gz sendmail-8.14.4]# make && makeinstall 4. Sendmail 설정파일생성 [ 설명 ] 설정파일이있는디렉토리로이동합니다. [root@gz sendmail-8.14.4]# pwd /usr/local/src/sendmail-8.14.4 [root@gz sendmail-8.14.4]# cd cf/cf/ [ 설명 ] 리눅스이므로 generic-linux.mc 파일을 sendmail.mc 파일로변경합니다. [root@gz cf]# mv generic-linux.mc sendmail.mc [ 설명 ] access.db, domainaliases.db 등자동생성하기위해아래내용을추가합니다. [root@gz cf]# vi sendmail.mc FEATURE(access_db)dnl FEATURE(virtusertable, btree /etc/mail/domainaliases.db)dnl FEATURE(genericstable, btree /etc/mail/useraliases.db)dnl FEATURE(accept_unqualified_senders)dnl [ 설명 ] 설정파일을빌드하여파일을생성합니다. [root@gz cf]# sh Build sendmail.cf [root@gz cf]# ls sendmail.cf sendmail.cf [ 설명 ] 설정파일을 install 하면 /etc/mail 디렉토리로이동하게됩니다. [root@gz cf]# make install-cf - 5 -
../../devtools/bin/install.sh -c -o root -g bin -m 0444 sendmail.cf /etc/mail/sendmail.cf../../devtools/bin/install.sh -c -o root -g bin -m 0444 submit.cf /etc/mail/submit.cf [root@gz cf]# ls /etc/mail access domaintable helpfile mailertable Makefile sendmail.mc statistics submit.mc virtusertable access.db domaintable.db local-host-names mailertable.db sendmail.cf spamassassin submit.cf trusted-users virtusertable.db 5. Sendmail 중요설정파일생성및설정 [ 설명 ] access는 sendmail 의접근을제어하는파일입니다. 호스트나도메인을허용하는의미는 RELAY 이며반대로호스트나도메인을허용하지않겠다고하는것은 REJECT 입니다. 예 ) [ 호스트, 도메인, 아이피, 이메일주소 ] [RELAY, REJECT] [root@gz cf]# cd /etc/mail [root@gz mail]# vi access localhost.localdomain RELAY localhost RELAY 127.0.0.1 RELAY 192.168.111.10 RELAY [ 설명 ] aliases 설정파일은특정계정으로메일을보냈을경우그계정으로메일이도착하지않고이파일에지정된다른계정으로메일이전송될수있게합니다. 특정사용자에게온메일을다른사람에게보내주거나리스트를작성해야하는경우에사용되는파일입니다. 예 1) admin 계정에게보내는메일 admin : Gz@ab.com, gz@abcd.com 예 2) manager계정으로오는메일을 webmaster와 root로전달 manager : root, webmaster 예 3) manager 계정으로오는메일을 /etc/mailist/manager 파일에계정들에게전달 manager:: include:/etc/maillist/manager [root@gz mail]# vi aliases webmaster: root - 6 -
[ 설명 ] 사용할도메인이름을입력하면사용할수있지만여기에서는빈파일로생성하겠습니다. [root@gz mail]# touch local-host-names [ 설명 ] access, access.db 를생성및갱신합니다. [root@gz mail]# makemap hash access < access [root@gz mail]# ls access.db access.db [ 설명 ] aliases.db 파일을생성하기위해아래순서대로진행합니다. [root@gz mail]# mkdir -p /var/spool/mqueue [root@gz mail]# chmod 755 /var/spool/mqueue/ [root@gz mail]# newaliases /etc/mail/aliases: 1 aliases, longest 4 bytes, 13 bytes total [root@gz mail]# ls aliases.db aliases.db 6. Sendmail 데몬시작 [ 설명 ] sendmail 명령어경로를확인합니다. [root@gz mail]# which sendmail /usr/sbin/sendmail [ 설명 ] 중계용데몬입니다. [root@gz mail]# /usr/sbin/sendmail -Ac -q1h [ 설명 ] 제출용 ( 수신용 ) 데몬입니다. [root@gz mail]# /usr/sbin/sendmail -bd -q1h [ 설명 ] sendmail 프로세스확인합니다. [root@gz mail]# ps -ef grep -v grep grep sendmail root 2143 1 0 11:44? 00:00:00 sendmail: accepting connections smmsp 2151 1 0 11:44? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue - 7 -
7. Sendmail 테스트 [ 설명 ] 메일보내기테스트입니다. [root@gz mail]# telnet localhost 25 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 localhost.localdomain ESMTP Sendmail 8.13.1/8.13.1; Tue, 1 Feb 2011 18:34:15 +0900 mail from : Gz.kyungho@gmail.com 250 2.1.0 Gz.kyungho@gmail.com... Sender ok rcpt to : Gz.kyungho@gmail.com 250 2.1.5 Gz.kyungho@gmail.com... Recipient ok subject : Test Mail 500 5.5.1 Command unrecognized: "subject : Test Mail" data 354 Enter mail, end with "." on a line by itself Hi Gz, you very handsomeguy haha see you again byebye. 250 2.0.0 p119yfi6008579 Message accepted for delivery quit 221 2.0.0 localhost.localdomain closing connection Connection closed by foreign host. [ 설명 ] 메일로그확인합니다. [root@gz mail]# cd /var/log [root@gz log]# tail -f maillog Feb 1 18:23:10 Gz sendmail[8529]: daemon MTA: problem creating SMTP socket Feb 1 18:23:10 Gz sendmail[8529]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA: server SMTP socket wedged: exiting Feb 1 18:33:51 Gz sendmail[8543]: p119wufy008543: Authentication-Warning: localhost.localdomain: Gz [127.0.0.1] didn't use HELO protocol Feb 1 18:33:56 Gz sendmail[8543]: p119wufy008543: Syntax error in parameters - 8 -
scanning "" Feb 1 18:34:01 Gz sendmail[8543]: p119wufy008543: lost input channel from Gz [127.0.0.1] to MTA after startup Feb 1 18:34:01 Gz sendmail[8543]: p119wufy008543: from=gz.kyungho@gmail.com, size=0, class=0, nrcpts=0, proto=smtp, daemon=mta, relay=gz [127.0.0.1] Feb 1 18:35:41 Gz sendmail[8579]: p119yfi6008579: Authentication-Warning: localhost.localdomain: Gz [127.0.0.1] didn't use HELO protocol Feb 1 18:38:07 Gz sendmail[8579]: p119yfi6008579: from=gz.kyungho@gmail.com, size=54, class=0, nrcpts=1, msgid=<201102010936.p119yfi6008579@localhost.localdomain>, proto=smtp, daemon=mta, relay=gz [127.0.0.1] Feb 1 18:38:10 Gz sendmail[8581]: STARTTLS=client, relay=gmail-smtpin.l.google.com., version=tlsv1/sslv3, verify=fail, cipher=rc4-md5, bits=128/128 Feb 1 18:38:13 Gz sendmail[8581]: p119yfi6008579: to=gz.kyungho@gmail.com, delay=00:02:11, xdelay=00:00:06, mailer=esmtp, pri=120054, relay=gmail-smtpin.l.google.com. [74.125.53.27], dsn=2.0.0, stat=sent (OK 1296802498 10si1007766icg.39) [ 설명 ] 메일확인합니다. - 9 -
8. Sendmail 다운받는곳 [ 설명 ] http://www.sendmail.com/ 에접속 Open Source > Download 클릭합니다. [ 설명 ] ftp sendmail.org 클릭합니다. - 10 -
[ 설명 ] 베타버전제외최신버전인 sendmail.8.14.4.tar.gz 클릭합니다. 9. 참고자료 참고자료서진수강사님 아이티윌오라클전문가과정 17기우재남저자 Red Hat Fedora 리눅스서버 & 네트워크 http://calmmass.tistory.com Google 검색 - 11 -