postfix+dovecot+openldap+extmail+spamassassin+M...

系统环境:rhel6 x86_64 selinux and iptables disabled
postfix+dovecot+openldap+extmail+spamassassin+M..._第1张图片
 
  1.使用extmail自带模板在openldap中创建数据库
     yum install openldap-servers openldap-clients -y
     cd /var/www/extsuite/
     tar zxf extmail-1.2.tar.gz
     tar zxf extman-1.1.tar.gz
     mv extmail-1.2 extmail
     mv extman-1.1 extman
     cd extman/docs/
     cp extmail.schema /etc/openldap/schema/
     cd /etc/openldap/;rm -fr slapd.d
     cp slapd.conf.bak slapd.conf
     chgrp ldap slapd.conf
     cp /usr/share/doc/openldap-servers-2.4.19/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
     chown ldap.ldap /var/lib/ldap/DB_CONFIG
     vi slapd.conf
**************************************************************
include         /etc/openldap/schema/corba.schema
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/duaconf.schema
include         /etc/openldap/schema/dyngroup.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/java.schema
#include                /etc/openldap/schema/misc.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/openldap.schema
include         /etc/openldap/schema/ppolicy.schema
include         /etc/openldap/schema/collective.schema
include         /etc/openldap/schema/extmail.schema

allow bind_v2

pidfile         /var/run/openldap/slapd.pid
argsfile        /var/run/openldap/slapd.args

database        bdb
suffix          "dc=extmail.org"
checkpoint      1024 15
rootdn          "cn=Manager,dc=extmail.org"
rootpw          westos

directory       /var/lib/ldap

index objectClass                       eq,pres
index ou,cn,mail,surname,givenname      eq,pres,sub
index uidNumber,gidNumber,loginShell    eq,pres
index uid,memberUid                     eq,pres,sub
index nisMapName,nisMapEntry            eq,pres,sub


database monitor

access to *
        by dn.exact="cn=Manager,dc=extmail.org" read
        by * none


**************************************************************
       /etc/init.d/slapd restart
       cd /var/www/extsuite/extman/docs/
       载入模板:
       ldapadd -W -x -D "cn=Manager,dc=extmail.org" -f init.ldif

   2.配置postfix,使用支持虚拟域。
      cd /var/www/extsuite/extman/docs/
      cp ldap_virtual_alias_maps.cf ldap_virtual_domains_maps.cf ldap_virtual_mailbox_maps.cf /etc/postfix/
      groupadd -g 600 vgroup
      useradd -u 600 -g vgroup -d /home/domains -s /sbin/nologin vuser
      postconf -e inet_interfaces=all
      postconf -e virtual_mailbox_base=/home/domains/
      postconf -e virtual_uid_maps=static:600
      postconf -e virtual_gid_maps=static:600
      postconf -e virtual_alias_maps=ldap:/etc/postfix/ldap_virtual_alias_maps.cf
      postconf -e virtual_mailbox_domains=ldap:/etc/postfix/ldap_virtual_domains_maps.cf
      postconf -e virtual_mailbox_maps=ldap:/etc/postfix/ldap_virtual_mailbox_maps.cf
      /etc/init.d/postfix restart
      测试:
        echo "hello world" | mail -s test [email protected]
        [root@desktop19 docs]# ll /home/domains/extmail.org/postmaster/Maildir/
        cur/ new/ tmp/  postfix配置成功!

   3.配置MDA(dovecot)
      yum install dovecot -y
      cd /etc/dovecot/conf.d
      vi 10-mail.conf
        mail_location = maildir:/home/domains/%d/%n/Maildir
        mail_uid =vuser
        mail_gid =vgroup
        first_valid_uid = 600
      vi 10-auth.conf
        #!include auth-system.conf.ext
        !include auth-ldap.conf.ext
      vi auth-ldap.conf.ext
        passdb {
             driver = ldap
             args = /etc/dovecot/dovecot-ldap.conf.ext
           }
        #userdb {
          #  driver = ldap
          #  args = /etc/dovecot/dovecot-ldap.conf.ext
          #}
      vi ../dovecot-ldap.conf.ext
         hosts =127.0.0.1:389
         dn = cn=Manager,dc=extmail.org
         dnpass =westos
         auth_bind = yes
         base = o=extmailAccount,dc=extmail.org
         deref = never
         scope = subtree
         pass_attrs = mail,userPassword
         pass_filter = (&(objectClass=extmailUser)(mail=%u)(active=1))
         default_pass_scheme = MD5-CRYPT
      /etc/init.d/dovecot restart
      测试:
*****************************************************
[root@desktop19 conf.d]# telnet localhost 110
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready. <[email protected]>
user [email protected]
+OK
pass extmail
+OK Logged in.
list
+OK 1 messages:
1 574
.

*****************************************************
 
    4.配置extmail:
      vi /etc/httpd/conf/httpd.conf
*************************************************************
<VirtualHost *:80>
      ServerName www.example.com
      DocumentRoot /var/www/html
</VirtualHost>

<VirtualHost *:80>
      ServerName mail.extmail.org
      DocumentRoot /var/www/extsuite/extmail/html/
      ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
      Alias /extmail /var/www/extsuite/extmail/html
      ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi
      Alias /extman /var/www/extsuite/extman/html
      SuexecUserGroup vmail vmail
</VirtualHost>
*************************************************************
     cd /var/www/extsuite/extmail
     chown -R vuser.vgroup cgi/
     cp webmail.cf.default webmail.cf
     vi webmail.cf
        SYS_LOG_ON = 1
        SYS_AUTH_TYPE = ldap
        SYS_MAILDIR_BASE = /home/domains
        SYS_CRYPT_TYPE = md5crypt
        SYS_LDAP_BASE = o=extmailAccount,dc=extmail.org
        SYS_LDAP_RDN = cn=Manager,dc=extmail.org
        SYS_LDAP_PASS = westos
        SYS_LDAP_HOST = localhost
    cd /var/www/extsuite/extman
    chown vmail.vmail cgi/ -R
    cp webman.cf.default webman.cf
    vi webman.cf
        SYS_MAILDIR_BASE = /home/domains
        SYS_SESS_DIR = /tmp
        SYS_CAPTCHA_ON = 1
        SYS_CAPTCHA_LEN = 4
        SYS_BACKEND_TYPE = ldap
        SYS_CRYPT_TYPE = md5crypt
        SYS_LDAP_BASE = dc=extmail.org
        SYS_LDAP_RDN = cn=Manager,dc=extmail.org
        SYS_LDAP_PASS = westos
        SYS_LDAP_HOST = localhost
    /var/www/extsuite/extman/daemon/cmdserver -d
    若出现下面的情况:不提供注册服务
      如图1

postfix+dovecot+openldap+extmail+spamassassin+M..._第2张图片
  
    则在http://mail.extmail.org/extman/下开启
      如图2


postfix+dovecot+openldap+extmail+spamassassin+M..._第3张图片

add a domain


postfix+dovecot+openldap+extmail+spamassassin+M..._第4张图片



你可能感兴趣的:(openLdap,postfix,Dovecot,ExtMail,spamassassin,MailScanner,ClamAV)