"Dovecot"의 두 판 사이의 차이

wwiki
이동: 둘러보기, 검색
(/etc/dovecot/conf.d/10-auth.conf)
 
(사용자 2명의 중간 판 17개는 보이지 않습니다)
2번째 줄: 2번째 줄:
 
Dovecot은 Linux/Unix 계열 시스템 용 IMAP과 POP3 전자메일 서버
 
Dovecot은 Linux/Unix 계열 시스템 용 IMAP과 POP3 전자메일 서버
  
==LDAP 연동==
+
===설치===
 +
$ apt-get install -y dovecot-core
 +
 
 +
==[[LDAP]] 연동==
 +
보내는 메일의 인증방식이 dovecot의 SASL을 사용하는 경우 메일을 보내기 위하여 SMTP서버에 접속할 때 다음 방법으로 LDAP와 연동할 수 있다.
  
 
===패키지 설치===
 
===패키지 설치===
$ sudo apt install dovecot-ldap
+
$ sudo apt install dovecot-ldap
  
 
===설정 수정===
 
===설정 수정===
  
====/etc/dovecot/conf.d/10-auth.conf====
+
====LDAP인증을 사용하도록 설정====
<nowiki>#</nowiki>주석처리(PAM인증을 사용하지 않음)  
+
파일위치: /etc/dovecot/conf.d/10-auth.conf<syntaxhighlight lang="bash">
 
+
#주석처리(PAM인증을 사용하지 않음)
<nowiki>#</nowiki>!include auth-system.conf.ext  
+
#!include auth-system.conf.ext
 
 
<nowiki>#</nowiki>주석해제
 
  
!include auth-ldap.conf.ext  
+
#주석해제
 +
!include auth-ldap.conf.ext
 +
</syntaxhighlight>
  
====/etc/dovecot/conf.d/10-logging.conf====
+
====인증 디버깅 로그 활성화====
 +
파일위치: /etc/dovecot/conf.d/10-logging.conf<syntaxhighlight lang="ini">
 
auth_verbose = yes
 
auth_verbose = yes
 
 
auth_verbose_passwords = yes
 
auth_verbose_passwords = yes
 
 
auth_debug = yes
 
auth_debug = yes
 
 
auth_debug_passwords = yes
 
auth_debug_passwords = yes
 
 
mail_debug = yes
 
mail_debug = yes
 +
</syntaxhighlight>로그 파일 위치 보기
 +
doveadm log find
 +
로그 보기
 +
doveadm log errors
  
====/etc/dovecot/conf.d/auth-ldap.conf.ext====
+
====비밀번호와 사용자계정을 LDAP에서 불러오도록 설정되었는지 확인(기본값)====
 +
파일위치: /etc/dovecot/conf.d/auth-ldap.conf.ext<syntaxhighlight lang="nginx">
 
passdb {
 
passdb {
  
driver = ldap
+
  driver = ldap
 +
  args = /etc/dovecot/dovecot-ldap.conf.ext
 +
}
  
args = /etc/dovecot/dovecot-ldap.conf.ext
+
userdb {
  
 +
  driver = ldap
 +
  args = /etc/dovecot/dovecot-ldap.conf.ext
 +
  # default_fields = home=/home/mail/%d/%u
 
}
 
}
 +
</syntaxhighlight>
 +
 +
====Maildir에 대한 설정====
 +
파일명: /etc/dovecot/conf.d/10-mail.conf<syntaxhighlight lang="ini">
 +
mail_location = maildir:~/Maildir
  
userdb {
+
# postfix설정에서 추가한 계정 vmail에 맞춰 추가
 +
mail_uid = 5000
 +
mail_gid = 5000
 +
mail_privileged_group = vmail
 +
</syntaxhighlight>
 +
 
 +
====썬더버드 한글판의 경우 보낸 편지함 충돌을 위한 설정====
 +
버전에 따라서 충돌이 없을 수 있을 듯.
 +
 
 +
파일명: /etc/dovecot/conf.d/10-mail.conf
  
driver = ldap
+
namespace inbox { 내부에 추가해줄 내용<syntaxhighlight lang="nginx">
 +
mailbox Sent {
  
args = /etc/dovecot/dovecot-ldap.conf.ext
+
  auto = subscribe # autocreate and autosubscribe the Sent mailbox
 +
  special_use = \Sent
 +
}
  
<nowiki>#</nowiki> default_fields = home=/home/mail/%d/%u
+
mailbox "Sent Messages" {
  
 +
  auto = no
 +
  special_use = \Sent
 
}
 
}
 +
</syntaxhighlight>
  
====/etc/dovecot/dovecot-ldap.conf.ext====
+
====매핑파일 생성====
 +
파일명: /etc/dovecot/dovecot-ldap.conf.ext (/etc/dovecot/conf.d/10-auth.conf에서 설정한 파일)<syntaxhighlight lang="ini">
 
hosts = localhost
 
hosts = localhost
 
 
dn = cn=[로그인계정],dc=example,dc=com
 
dn = cn=[로그인계정],dc=example,dc=com
 
 
dnpass = [password]
 
dnpass = [password]
 
 
ldap_version = 3
 
ldap_version = 3
 
 
base = ou=users,dc=example,dc=com
 
base = ou=users,dc=example,dc=com
 
 
deref = never
 
deref = never
 
 
scope = onelevel
 
scope = onelevel
 
 
default_pass_scheme = plain
 
default_pass_scheme = plain
  
user_attrs = cn=user,mailDirectory=homeDirectory
+
# uidNumber=uid,gidNumber=gid 부분은 /etc/dovecot/conf.d/10-mail.conf에서 설정한 vmail계정으로 실행되도록 삭제
  
user_filter = (cn=%n)
+
user_attrs = homeDirectory=home
  
pass_attrs = cn=user,userPassword=Password
+
#비밀번호 필터를 ldap의 메일주소로 설정(%u:user@domain, %n: user)
 +
pass_filter = (&(objectClass=posixAccount)(mail=%u))
 +
</syntaxhighlight>
  
pass_filter = (cn=%n)
+
====설정확인====
 +
$ dovecot -n
  
====설정확인====
+
====테스트====
$ dovecot -n
+
[[IMAP#telnet.EC.9C.BC.EB.A1.9C .ED.85.8C.EC.8A.A4.ED.8A.B8|IMAP telnet으로 테스트]]
  
===메일함 관련 권한 수정===
+
== 외부링크 ==
$ sudo chmod g+w /home
+
https://www.dovecot.org/
 
[[분류:Email]]
 
[[분류:Email]]

2021년 10월 28일 (목) 06:23 기준 최신판

개요[편집 | 원본 편집]

Dovecot은 Linux/Unix 계열 시스템 용 IMAP과 POP3 전자메일 서버

설치[편집 | 원본 편집]

$ apt-get install -y dovecot-core

LDAP 연동[편집 | 원본 편집]

보내는 메일의 인증방식이 dovecot의 SASL을 사용하는 경우 메일을 보내기 위하여 SMTP서버에 접속할 때 다음 방법으로 LDAP와 연동할 수 있다.

패키지 설치[편집 | 원본 편집]

$ sudo apt install dovecot-ldap

설정 수정[편집 | 원본 편집]

LDAP인증을 사용하도록 설정[편집 | 원본 편집]

파일위치: /etc/dovecot/conf.d/10-auth.conf

#주석처리(PAM인증을 사용하지 않음)
#!include auth-system.conf.ext

#주석해제
!include auth-ldap.conf.ext

인증 디버깅 로그 활성화[편집 | 원본 편집]

파일위치: /etc/dovecot/conf.d/10-logging.conf

auth_verbose = yes
auth_verbose_passwords = yes
auth_debug = yes
auth_debug_passwords = yes
mail_debug = yes

로그 파일 위치 보기

doveadm log find

로그 보기

doveadm log errors

비밀번호와 사용자계정을 LDAP에서 불러오도록 설정되었는지 확인(기본값)[편집 | 원본 편집]

파일위치: /etc/dovecot/conf.d/auth-ldap.conf.ext

passdb {

  driver = ldap
  args = /etc/dovecot/dovecot-ldap.conf.ext
}

userdb {

  driver = ldap
  args = /etc/dovecot/dovecot-ldap.conf.ext
  # default_fields = home=/home/mail/%d/%u
}

Maildir에 대한 설정[편집 | 원본 편집]

파일명: /etc/dovecot/conf.d/10-mail.conf

mail_location = maildir:~/Maildir

# postfix설정에서 추가한 계정 vmail에 맞춰 추가
mail_uid = 5000
mail_gid = 5000
mail_privileged_group = vmail

썬더버드 한글판의 경우 보낸 편지함 충돌을 위한 설정[편집 | 원본 편집]

버전에 따라서 충돌이 없을 수 있을 듯.

파일명: /etc/dovecot/conf.d/10-mail.conf

namespace inbox { 내부에 추가해줄 내용

mailbox Sent {

  auto = subscribe # autocreate and autosubscribe the Sent mailbox
  special_use = \Sent
}

mailbox "Sent Messages" {

  auto = no
  special_use = \Sent
}

매핑파일 생성[편집 | 원본 편집]

파일명: /etc/dovecot/dovecot-ldap.conf.ext (/etc/dovecot/conf.d/10-auth.conf에서 설정한 파일)

hosts = localhost
dn = cn=[로그인계정],dc=example,dc=com
dnpass = [password]
ldap_version = 3
base = ou=users,dc=example,dc=com
deref = never
scope = onelevel
default_pass_scheme = plain

# uidNumber=uid,gidNumber=gid 부분은 /etc/dovecot/conf.d/10-mail.conf에서 설정한 vmail계정으로 실행되도록 삭제

user_attrs = homeDirectory=home

#비밀번호 필터를 ldap의 메일주소로 설정(%u:user@domain, %n: user)
pass_filter = (&(objectClass=posixAccount)(mail=%u))

설정확인[편집 | 원본 편집]

$ dovecot -n

테스트[편집 | 원본 편집]

IMAP telnet으로 테스트

외부링크[편집 | 원본 편집]

https://www.dovecot.org/