저번주에 웹서버 메일세팅을 하여 MS사의 Outlook이나 Mozilia사의 Thunderbird를 이용하여 웹 서버 작업을 하였습니다. 기본적으로 출처 사이트를 대부분 참고하였고 개인적인 설정변경을 통하여 서버에 작업을 하였습니다. 1차 작성이유는 개인적으로 웹서버 메일을 세팅한것을 잊어버리지 않기위하여, 둘째는 모자란 블로그이지만 미약하게나마 다른분들에게 도움이 될 수 있었으면 좋겠다는 취지로 작성하였습니다. 기본적인 서버세팅이지만 저처럼 리눅스를 많이 사용하지않거나 메일서버세팅을 해본적 없으신 분들을 위하여 작성하였습니다.
------------------------------------------------------------------------------------------
출처 : http://www.krizna.com/ubuntu/setup-mail-server-ubuntu-14-04/
------------------------------------------------------------------------------------------
리눅스에서 postfix와 dovecot을 이용하여 서버메일 설정작업을 진행하도록 하겠습니다.
/etc/hostname 에 가셔서 먼저 호스트 네임을 잡아줍니다.
mail.hostname.com
/etc/hosts에서는 ip와 호스트 네임을 같이 잡아줍시다.
192.168.1.1 mail.hostname.com
postfix를 설치하고 설정파일을 실행합니다.
//update hostname@mail:~$ sudo apt-get update //postfix를 설치 합니다. hostname@mail:~$ sudo apt-get postfix //postfix의 설정을 잡습니다. hostname@mail:~$ sudo dpkg-reconfigure postfix
아래에 있는 사진은 제 리눅스 서버에서 설정된 환경입니다.
설정이 완료되셨으면 /etc/postfix/main.cf 에 접속하셔서 아래와 같이 설정해주시기 바랍니다. 현재 제가 잡고있는 main.cf 파일 설정추가는 다음과 같습니다.
smtpd_tls_cert_file = /etc/ssl/certs/server.crt smtpd_tls_key_file = /etc/ssl/private/server.key smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = mail.hostname.com mydomain = hostname.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = $myhostname, localhost. $mydomain, localhost, $mydomain relayhost = mynetworks = 127.0.0.0/8, 192.168.0.0/24 relay_domains = $mydestination mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache home_mailbox = Maildir/ smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_local_domain = smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_sasl_auth_enable = yes #smtpd_recipient_restrictions =permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination smtp_tls_security_level = may smtpd_tls_security_level = may smtp_tls_note_starttls_offer = yes smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes
작업후 tls 인증을 위하여 다음과 같이 작업합니다.
hostname@mail:~$ openssl genrsa -des3 -out server.key 2048 hostname@mail:~$ openssl rsa -in server.key -out server.key.insecure hostname@mail:~$ mv server.key server.key.secure hostname@mail:~$ mv server.key.insecure server.key hostname@mail:~$ openssl req -new -key server.key -out server.csr hostname@mail:~$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt hostname@mail:~$ sudo cp server.crt /etc/ssl/certs hostname@mail:~$ sudo cp server.key /etc/ssl/private
설정작업의 경로설정 입니다.
hostname@mail:~$ sudo postconf -e 'smtpd_tls_key_file = /etc/ssl/private/server.key' hostname@mail:~$ sudo postconf -e 'smtpd_tls_cert_file = /etc/ssl/certs/server.crt'
위에 설정이 완료된 후에 /etc/postfix/master.cf 파일에 들어가셔서 아래와 같이 수정합니다.
submission inet n - - - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_relay_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING smtps inet n - n - - smtpd -o syslog_name=postfix/smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_relay_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING
여기까지가 postfix관련 설정 이였습니다. main.cf에서 설정변경이 좀있었고 나머지는 기본 설정따라서 작업하였습니다. 다음 페이지에서는 dovecot설치와 telnet으로 설정 확인 하는 작업을 진행해보도록 하겠습니다.
'리눅스' 카테고리의 다른 글
VMware 민트 OS에 SSH, FTP 설정하기 / FTP 쓰기 권한 문제 해결 (0) | 2015.10.28 |
---|---|
민트(MINT) OS한글 키보드 설정 (0) | 2015.10.28 |
vmware에 민트 (MINT) OS 설치 (0) | 2015.10.28 |
window에 VMware 10.0 설치하기 (0) | 2015.10.28 |