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 {
        type master;
        file "/etc/192.168.0.local";
        allow-update { none; };
};
zone "test.com" IN {
        type master;
        file "/etc/test.com.zone";
        allow-update { none; };
};
#------------------------------
在/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】
$TTL 86400
test.com.   IN SOA test.com.       root.test.com. (
      42   ; serial (d. adams)
      3H   ; refresh
      15M   ; retry
      1W   ; expiry
      1D )   ; minimum
         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】
$TTL 86400
@       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 support@test.com 
 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
make && make install
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
perl Makefile.PL; make test; make install
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打开)
postmaster@test.com    默认密码为extmail
root@test.com        默认密码为extmail*123*
Extman 添加用户时要记得添加 通用名 否则可能不能添加


本文转自 nonono11 51CTO博客,原文链接:http://blog.51cto.com/abian/1118543,如需转载请自行联系原作者

相关文章
|
7月前
|
存储 安全 Linux
linux centos7中使用 Postfix 和Dovecot搭建邮件系统
linux centos7中使用 Postfix 和Dovecot搭建邮件系统
371 1
|
7月前
|
存储 安全 Linux
linux中使用Postfix和Dovecot搭建邮箱系统服务
Postfix是一个开源的邮件传输代理(MTA),用于路由和传送电子邮件。它是一个可靠、安全且高性能的邮件服务器软件,常用于搭建邮件系统的核心组件之一。 Dovecot是一个开源的邮件服务软件,用于提供邮件访问服务,包括POP3和IMAP协议。它通常与Postfix配合使用,用于接收和存储邮件,以及为用户提供远程访问邮件的功能。
923 3
 linux中使用Postfix和Dovecot搭建邮箱系统服务
|
存储 运维 监控
centos7.6部署Postfix+Dovecot邮件系统
一、理论部分 电子邮件系统基于邮件协议来完成电子邮件的传输 常用的协议有:    简单邮件传输协议(SMTP):用于发送和中转发出的电子邮件,占用服务器的TCP/25端口    邮局协议版本3(POP3):用于将电子邮件存储到本地主机,占用服务器的TCP/110端口    internet消息访问协议版本4(IMAP4):用于在本地主机访问邮件,占用服务器的TCP/143端
470 0
centos7.6部署Postfix+Dovecot邮件系统
|
网络安全 数据安全/隐私保护
|
安全 网络协议 Linux
用 Postfix+Dovecot 在 CentOS7 上快速搭建自己的安全邮件服务器
用 Postfix+Dovecot 在 CentOS7 上快速搭建自己的安全邮件服务器,用 yum 安装实现快速,用 ssl 加密实现安全!
7579 0
|
网络协议 关系型数据库 测试技术