vpopmail dovecot qmail 연동

Posted by 크롱_k
2016.10.28 14:08 서버/리눅스 이야기
https://hetzer7.wordpress.com/category/vpopmail/ << 원본

최근 dovecot이 v2.0으로 메이저 업데이트 되었네요.
기존에 1.x을 사용해오던 저로서는 당황스러웠지만, 시대의 흐름을 따라(?) 2.0의 변화를 알아보고자 컴파일부터, 설정, 실행까지 다시 해보았습니다. (대폭 바뀌었군요 ㅡㅡ;;)
(dovecot 2.0 설정부분은 제가 작성한 영문판 qmail-1.03에서(http://notes.sagredo.eu/node/28)의 지문을 참조했습니다. 설치후 문제가 발생할시 참조하시면 유익합니다.

1. Dovecot 2.0.16 설치
우선 홈페이지에서 v2.0.16 소스를 다운로드한다. 
 
#wget http://www.dovecot.org/releases/2.0/dovecot-2.0.16.tar.gz
#tar zxf dovecot-2.0.16.tar.gz

#cd dovecot-2.0.16

#./configure –with-vpopmail (본인은 qmail + vpopmail 조합을 사용중)

#make

#make install

dovecot 계정을 생성한다.
#useradd -d / -s /sbin/nologin dovecot
#useradd -d /null -s /sbin/nologin dovenull 
로그파일을 생성한다.
#touch /var/log/dovecot/dovecot.log
#chgrp vchkpw /var/log/dovecot/dovecot.log
#chmod 660 /var/log/dovecot/dovecot.log
 
#vi /usr/local/etc/dovecot/conf.d/10-logging.conf
log_path = /var/log/dovecot/dovecot.log
plugin {
}
 
  
설치후 실행에 필요한 샘플 config파일들을 실제 폴더로 옮겨놓는다. 
 #cp -r /var/tmp/dovecot-2.0.16/doc/example-config/* /usr/local/etc/dovecot/
#vi /usr/local/etc/dovecot/dovecont.conf
 
protocols = imap #본인은 imap만을 사용listen = *, ::
login_greeting = Dovecot ready.

#vi /usr/local/etc/dovecot/conf.d/10-auth.conf

disable_plaintext_auth = no
auth_mechanisms = plain
#!include auth-system.conf.ext (주석처리)
..
..
!include auth-vpopmail.conf.ext (vpopmail 사용시)


#vi /usr/local/etc/dovecot/conf.d/10-mail.conf
설정하기전 
#id -u vpopmail 
#id -g vpopmail 
vpopmail의 uid값과 gid값을 미리 조회하여 메모

mail_location = maildir:%h/Maildir

mail_uid = 213
mail_gid = 497

mail_privileged_group = 497
mail_access_groups = 497

first_valid_uid = 213
last_valid_uid = 213

first_valid_gid = 497
last_valid_gid = 497
auth_socket_path = /var/run/dovecot/auth-userdb


# vi /usr/local/etc/dovecot/conf.d/10-master.conf

default_login_user = vpopmail

default_internal_user = vpopmail

service imap-login {
  inet_listener imap {
  # port = 143
  }
  inet_listener imaps {
   # port = 993
   # ssl = yes
  }

}
service pop3-login {
  inet_listener pop3 {
   # port = 110
  }
  inet_listener pop3s {
   # port = 995
   # ssl = yes
  }
}

service lmtp {
  unix_listener lmtp {
    #mode = 0666
  }

  # Create inet listener only if you can’t use the above UNIX socket
  #inet_listener lmtp {
    # Avoid making LMTP visible for the entire internet
    #address =
    #port =
  #}
}

service imap {
  # Most of the memory goes to mmap()ing files. You may need to increase this
  # limit if you have huge mailboxes.
  #vsz_limit = 256M

  # Max. number of IMAP processes (connections)
  #process_limit = 1024
}

service pop3 {
  # Max. number of POP3 processes (connections)
  #process_limit = 1024
}

service auth {
  # auth_socket_path points to this userdb socket by default. It’s typically
  # used by dovecot-lda, doveadm, possibly imap process, etc. Its default
  # permissions make it readable only by root, but you may need to relax these
  # permissions. Users that have access to this socket are able to get a list
  # of all usernames and get results of everyone’s userdb lookups.
  unix_listener auth-userdb {
    mode = 0600
    user = vpopmail
    group = vchkpw
  }

  # Postfix smtp-auth
  #unix_listener /var/spool/postfix/private/auth {
  #  mode = 0666
  #}

  # Auth process is run as this user.
  user = $default_internal_user
}


service auth-worker {
  # Auth worker process is run as root by default, so that it can access
  # /etc/shadow. If this isn’t necessary, the user should be changed to
  # $default_internal_user.
  user = $default_internal_user
}

service dict {
  # If dict proxy is used, mail processes should have access to its socket.
  # For example: mode=0660, group=vmail and global mail_access_groups=vmail
  unix_listener dict {
    #mode = 0600
    #user =
    #group =
  }
}


# vi /usr/local/etc/dovecot/conf.d/10-ssl.conf

ssl = no
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
이후 /var/tmp/dovecot-2.0.16/doc에 있는 mkcert.sh를 실행해서 ssl private 인증서를 만들어 줍니다.

# vi /usr/local/etc/dovecot/conf.d/auth-vpopmail.conf.ext

passdb {
  driver = vpopmail

  # [cache_key=] [webmail=]
  #args =
}

userdb {
  driver = vpopmail

  # [quota_template=] – %q expands to Maildir++ quota
  args = quota_template=quota_rule=*:backend=%q
}
 


    이정도면 설정이 마무리 되었습니다
    dovecot을 재기동하여 telnet으로 imap에 접속해 보거나 roundcubemail의 installer 화면에서 imap 로그인 테스트로 확인해 보시기 바랍니다.


    # telnet [your-IP] 143

    Trying [your-IP]…
    Connected to [your-IP].
    Escape character is ‘^]’.
    * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5 AUTH=CRAM-MD5] Dovecot ready.
    a login test@yourdomain.net [PASSWORD]
    a OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS QUOTA] Logged in
    a select inbox
    * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
    * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
    * 0 EXISTS
    * 0 RECENT
    * OK [UIDVALIDITY 1287576448] UIDs valid
    * OK [UIDNEXT 1] Predicted next UID
    * OK [HIGHESTMODSEQ 1] Highest
    a OK [READ-WRITE] Select completed.
    a list “” *
    * LIST (\HasNoChildren) “.” “INBOX”
    a OK List completed.
    a logout
    * BYE Logging out
    a OK Logout completed.
    Connection closed by foreign host.
    만약 설정후 에러가 발생하게 되면 debuger모드로 해두시고 log파일을 찬찬히 살펴보면서 트러블슈팅하시면 됩니다


    '서버 > 리눅스 이야기' 카테고리의 다른 글

    vi 공백 지우기  (0) 2017.01.06
    linux 메모리 슬롯확인  (0) 2016.11.16
    vpopmail dovecot qmail 연동  (0) 2016.10.28
    SSD health check  (0) 2016.08.30
    mysql 5.7 사용자 계정  (0) 2016.08.24
    1819 : Your password does not satisfy the current policy requirements  (0) 2016.08.24
    이 댓글을 비밀 댓글로