天天看點

Postfix_Dovecot_Openldap_Extmail 安裝

網上找了好多,自己再實踐了一下,記錄一下

0:安裝相關軟體

yum install gcc gcc-c++ libtool libtool-devel gdbm gdbm-devel openldap-servers openldap-devel \

openldap-clients perl-CGI perl-LDAP perl-GD httpd php php-ldap

添加使用者

groupadd -g 600 vgroup

useradd -u 600 -g vgroup -d /home/domains -s /sbin/nologin vuser

groupadd -g 2525 postfix;

useradd -u 2525 -g postfix -s /sbin/nologin -d /dev/null postfix

groupadd -g 2526 postdrop

useradd -g postdrop -u 2526 -s /bin/false -d /dev/null postdrop

groupadd dovenull

useradd -g dovenull -s /sbin/nologin -d /dev/null dovenull

groupadd dovecot

useradd -g dovecot -s /sbin/nologin -d /dev/null dovecot

1:安裝Bind(測試時使用)

yum install bind bind-untils caching-nameserver

vi /etc/named.conf

#-----------------------------

zone "cisco.com" IN {

        type master;

        file "/etc/cisco.com.zone";

        allow-update { none; };

};

zone "0.168.192.in-addr.arpa" IN {

        file "/etc/192.168.0.local";

zone "test.com" IN {

        file "/etc/test.com.zone";

#------------------------------

在/etc下建立 cisco.con.zone 192.168.0.local test.com.zone

【cisco.com.zone】

$TTL 86400

cisco.com.   IN SOA cisco.com.       root.cisco.com. (

      42   ; serial (d. adams)

      3H   ; refresh

      15M   ; retry

      1W   ; expiry

      1D )   ; minimum

         IN NS   cisco.com.

cisco.com.      IN A   192.168.0.251

cisco.com. IN MX 10 mx.test.com.

【test.com.zone】

test.com.   IN SOA test.com.       root.test.com. (

         IN NS   test.com.

test.com.        IN A   192.168.0.251

test.com. IN MX 10 mx.test.com.

mx   IN A   192.168.0.251

【192.168.0.local】

@       IN      SOA     test.com. root.test.com. (

                                      1997022700 ; Serial

                                      28800      ; Refresh

                                      14400      ; Retry

                                      3600000    ; Expire

                                      86400 )    ; Minimum

        IN      NS      cisco.com.

200       IN      PTR     localhost.

200       IN      PTR     mx.test.com.

#---------------------------------

2:安裝Openldap

vi /etc/openldap/sldap.conf

include /etc/openldap/schema/corba.schema

include /etc/openldap/schema/core.schema

include /etc/openldap/schema/cosine.schema

include /etc/openldap/schema/dyngroup.schema

include /etc/openldap/schema/inetorgperson.schema

include /etc/openldap/schema/java.schema

include /etc/openldap/schema/nis.schema

include /etc/openldap/schema/openldap.schema

include /etc/openldap/schema/ppolicy.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=test.com"

checkpoint 1024 15

rootdn "cn=Manager,dc=test.com"

#PassWD bian

rootpw {SSHA}HAQY8O9hJ6kT0qOp3bazxOn4g+B4AxTi

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=test.com" read

        by * none

#Enable LOG

loglevel 256

vi /etc/openldap/ldap.conf

BASE    dc=tset, dc=com

URI     ldap://127.0.0.1

SIZELIMIT       12

TIMELIMIT       15

DEREF           never

cd /var/www/extsuite/extman/docs/

sed -i 's/extmail.org/test.com/g' init.ldif

cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG

chown ldap.ldap /var/lib/ldap/DB_CONFIG

service ldap start

ldapadd -x -D 'cn=manager,dc=test.=com' -W -f init.ldif

echo "local4.*        /var/log/openldap.log" >>/etc/syslog.conf

service syslog restart

service ldap restart

3:安裝Postfix

patch -p1 <../postfix-2.9-patch05

make -f Makefile.init makefiles \

'CCARGS=-DHAS_LDAP -I/usr/include -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \

-I/usr/include/sasl' \

'AUXLIBS=-L/usr/local/lib -lldap -L/usr/lib/sasl2 -lsasl2 -llber -L/usr/lib'

make && make install

cp ldap_virtual_alias_maps.cf ldap_virtual_domains_maps.cf ldap_virtual_mailbox_maps.cf /etc/postfix/

vi /etc/postfix/main.cf

添加

inet_interfaces=all

virtual_mailbox_base=/home/domains/

virtual_uid_maps=static:600

virtual_gid_maps=static:600

virtual_alias_maps=ldap:/etc/postfix/ldap_virtual_alias_maps.cf

virtual_mailbox_domains=ldap:/etc/postfix/ldap_virtual_domains_maps.cf

virtual_mailbox_maps=ldap:/etc/postfix/ldap_virtual_mailbox_maps.cf

service postfix restart

echo “hello world” | mail -s test [email protected] 

 ll -d /home/domains/westos.org/postmaster/Maildir/ 如自動建立使用者目錄表示成功

4:安裝Dovecot

./configure CPPFLAGS=-I/usr/kerberos/include LDFLAGS=-L/usr/kerberos/lib --prefix=/usr \

 --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share \

 --sysconfdir=/etc --with-ldap -with-ssl=openssl

cp /usr/share/doc/dovecot-2.0/example-config/dovecot-ldap.conf.ext /etc/dovecot/

vi /etc/dovecot/dovecot.conf

#Disable SSL

ssl = no

#Enable Plaintext

disable_plaintext_auth = no

protocol pop3 {

        pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s

}

dict {

  #quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext

  #expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext

!include conf.d/*.conf

!include_try local.conf

#Enable Log

log_path = /var/log/dovecot

mail_debug =yes

auth_debug = yes

vi /etc/dovecot/conf.d/10-mail.conf

mail_location = maildir:/home/domains/%d/%n/Maildir

mail_uid = vuser

mail_gid = vgroup

first_valid_uid = 600

vi /etc/dovecot/conf.d/10-auth.conf

#!include auth-system.conf.ext

!include auth-ldap.conf.ext

vi /etc/dovecot/dovecot-ldap.conf.ext

hosts = 127.0.0.1:389

dn = cn=Manager,dc=westos.org

dnpass = westos

auth_bind = yes

base = o=extmailAccount,dc=westos.org

deref = never

scope = subtree

pass_attrs = mail,userPassword

pass_filter = (&(objectClass=extmailUser)(mail=%u)(active=1))

default_pass_scheme = MD5

vi /etc/dovecot/conf.d/auth-ldap.conf.ext

passdb {

  driver = ldap

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

service dovecot start

5:安裝httpd

vi /etc/httpd/conf/httd.conf

<VirtualHost *:80>

ServerName mail.westos.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 vuser vgroup

</VirtualHost>

7:安裝Extmail

chown -R vuser.vgroup /var/www/extsuite/extman/cgi

chown -R vuser.vgroup /var/www/extsuite/extmail/cgi

sed -i 's:SYS_CRYPT_TYPE = md5crypt:SYS_CRYPT_TYPE = ldap-md5:;s:SYS_AUTH_TYPE = mysql:SYS_AUTH_TYPE = ldap:;s:example.com:test.com:;s:SYS_LDAP_PASS = secret:SYS_LDAP_PASS = bian:' /var/www/extsuite/extmail/webmail.cf

sed -i 's:SYS_CRYPT_TYPE = md5crypt:SYS_CRYPT_TYPE = ldap-md5:;s:SYS_SESS_DIR = /tmp/extman/:SYS_SESS_DIR = /tmp:;s:SYS_BACKEND_TYPE = mysql:SYS_BACKEND_TYPE = ldap:;s:SYS_CRYPT_TYPE = md5crypt:SYS_CRYPT_TYPE = ldap-md5:;s:extmail.org:test.com:;s:SYS_LDAP_PASS = secret:SYS_LDAP_PASS = bian:' /var/www/extsuite/extman/webman.cf

echo "/var/www/extsuite/extman/daemon/cmdserver -v -d">>/etc/rc.local

chmod 600 /var/www/extsuite/extman/webman.cf

>/var/log/extmail.log

附:

如需日志,安裝Unix-Syslog

perl Makefile.PL; make test; make install

圖形日志:yum install rrdtool-perl perl-Time-HiRes

下載下傳File-Tail

cp -r /var/www/extsuite/extman/addon/mailgraph_ext /usr/local

echo "/usr/local/mailgraph_ext/mailgraph-init start">>/etc/rc.local

添加背景登入驗證碼,修改webman.cf,SYS_CAPTCHA_ON = 0 (1打開)

[email protected]    預設密碼為extmail

[email protected]        預設密碼為extmail*123*

Extman 添加使用者時要記得添加 通用名 否則可能不能添加

本文轉自 nonono11 51CTO部落格,原文連結:http://blog.51cto.com/abian/1118543,如需轉載請自行聯系原作者

繼續閱讀