메일서버 구축 (Sendmail, dovecot)
메일서버 구축
구축환경
DNS Server (CentOS 6.7)
192.168.0.151
Mail Server (CentOS 6.7)
192.168.0.152
DNS 구축
http://itgameworld.tistory.com/115
위 링크를 통해 DNS 서버를 먼저 구축한다.
단, 아래와 같이 zone파일에서 mail에 관련된 부분을 설정
[root@localhost ~]# vi /var/named/itgame.com.zone
$TTL 1D
@ IN SOA @ itgame.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
IN MX 10 mail.itgame.com
A 192.168.0.152
ns A 192.168.0.152
mail A 192.168.0.152
www A 192.168.0.152
AAAA ::1
메일서버 구축 (Sendmail)
[root@localhost ~]# yum -y install sendmail*
[root@localhost ~]# vi /etc/mail/sendmail.mc
51 dnl #
52 TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
53 define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
54 dnl #
88
89 Cwitgame.com
90 # file containing names of hosts for which we receive email
91 Fw/etc/mail/local-host-names
92
[root@localhost ~]# makemap hash /etc/mail/access < /etc/mail/access
telnet을 이용한 테스트
[root@localhost ~]# yum -y install telnet
[root@localhost data]# telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail 8.14.4/8.14.4; Tue, 18 Oct 2016 19:13:49 +0900
ehlo localhost ##입력
250-localhost.localdomain Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-DELIVERBY
250 HELP
netstat를 이용한 테스트
[root@localhost data]# netstat -nlp | grep 25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1832/sendmail
unix 2 [ ACC ] STREAM LISTENING 12584 2111/gnome-power-ma /tmp/orbit-gdm/linc-83f-0-2f11e9699f8b1
unix 2 [ ACC ] STREAM LISTENING 12792 2125/pulseaudio /var/lib/gdm/.pulse/5da8c3ab9688f9ca926aacc70000000b-runtime/native
unix 2 [ ACC ] STREAM LISTENING 9964 1525/dbus-daemon /var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 12569 2110/gdm-simple-gre /tmp/orbit-gdm/linc-83e-0-60b2aee89a819
Dovecot 설치
[root@localhost data]# yum -y install dovecot
[root@localhost data]# vi /etc/dovecot/conf.d/10-mail.conf
29 #
30 mail_location = mbox:MEMORY:INBOX=/var/spool/mail/%u:INDEX=MEMORY
31
[root@localhost data]# vi /etc/dovecot/conf.d/10-auth.conf
.... ##9번 줄의 주석을 해제 후 ssl을 사용하기 때문에 no로 값을 변경한다.
8 # connection is considered secure and plaintext authentication is allowed.
9 disable_plaintext_auth = no
10
[root@localhost data]# chkconfig dovecot on
계정생성 및 테스트
[root@localhost ~]# useradd testmail
[root@localhost ~]# passwd testmail
아래 링크를 통하여 테스트를 진행합니다.
Windows의 경우 Outlook 등을 사용하면 된다. 설정은 크게 다르지 않다.
참조 :
http://se-sik.tistory.com/7