100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > postfix邮件系统搭建手册(openldap)

postfix邮件系统搭建手册(openldap)

时间:2020-09-04 21:44:35

相关推荐

postfix邮件系统搭建手册(openldap)

1 Postfix邮件系统介绍1.1 Postfix邮件系统介绍Postfix是Wietse Venema在IBM的GPL协议之下开发的MTA(邮件传输代理)软件。Postfix是Wietse Venema想要为使用最广泛的Sendmail提供替代品的一个尝试。在Internet世界中,大部分的电子邮件都是通过Sendmail来投递的,大约有100万用户使用Sendmail,每天投递上亿封邮件。这真实一个让人吃惊的数字。Postfix试图更快、更容易管理、更安全,同时还与Sendmail保持足够的兼容性。1.2 Postfix特点1、 Postfix是免费的: Postfix想要作用的范围是广大的Internet用户,试图影响大多数的Internet上的电子邮件系统,因此它是免费的。 2、 更快: Postfix在性能上大约比Sendmail×××倍。一部运行Postfix的台式PC每天可以收发上百万封邮件。 3、 兼容性好: Postfix是Sendmail兼容的,从而使Sendmail用户可以很方便地迁移到Postfix。Postfix支持/var[/spool]/mail、/etc/aliases、 NIS、和 ~/.forward 文件。 4、 更健壮: Postfix被设计成在重负荷之下仍然可以正常工作。当系统运行超出了可用的内存或磁盘空间时,Postfix会自动减少运行进程的数目。当处理的邮件数目增长时,Postfix运行的进程不会跟着增加。 5、 更灵活: Postfix是由超过一打的小程序组成的,每个程序完成特定的功能。你可以通过配置文件设置每个程序的运行参数。 6、 安全性: Postfix具有多层防御结构,可以有效地抵御恶意***者。如大多数的Postfix程序可以运行在较低的权限之下,不可以通过网络访问安全性相关的本地投递程序等等。1.3 Postfix邮件系统组成及工作原理Postfixs邮件系统是由十多个具有不同功能的模块组成,这些模块以进程的方式工作,我们可以把它们称为Postfix的功能进程,这些功能性进程都是相互协作、相互平等,它们可以为彼此提供特定的服务。大部分Postfix功能性进程由一个守护进程进行管理,该进程负责负责协调各个功能性进程间的工作,这个进程叫做master。 Postfix各个功能性进程之间的关系如下图所示: 【说明】 Postfix邮件系统主要由上图中所列的功能模块组成,下面将分别描述每个功能模块在整个邮件系统中的作用: 1、MTA: 整个邮件系统的核心,主要负责来自网络的或者本地的邮件,并根据邮件的目标地址将邮件通过MDA发送其他MTA或者保存到本地。由Postfix本身应用程序提供。 2、MDA: 邮件传送代理,主要负责将邮件传送到目的地 3、MAA: 一般情况下,邮件系统将用户的邮件保存在服务器上用户指定的家目录中,用户如何获取服务器上的邮件呢?这个就是MAA的主要功能,他主要为用户提供pop3/imap功能,让用户通过它来获取邮件服务器上的邮件。中间会提供一些用户身份认证的机制。 4、MUA: 邮件用户代理,接受用户输入的各种指令,将用户的邮件发送至MTA或者通过POP3、IMAP协议将邮件从MTA取到本机。常见的MUA有Foxmail、Outlook、tundbird等邮件客户端程序。 5、Webmail: 提供Webmail功能和后台管理功能 6、Mailbox MTA获取邮件之后,调用MDA将邮件保存在MAILBOX中。MAILBOX主要用来保存用户的邮件。 7、认证系统 提供用户身份验证的功能,Postfix支持多种数据库,比较常用的有MySQL、Ldap。我们可以通过postconf–m,查看Postfix支持的数据库的类型。 8、防病毒反垃圾邮件系统 垃圾邮件和病毒邮件已经成为整个邮件系统中公害,几乎每个邮件系统都面临着这样的问题,在Postfix我们采用业界比较出名的amavisd-new进程来调用clamad和dspam来扫描病毒和垃圾邮件。2 Linux服务器系统初始化安装与配置2.1服务器配置:Ø硬件: CPU: Intel(R) Xeon(TM) CPU 3.00GHz 内存:4G 磁盘:磁盘1->73G 磁盘2->146G Ø操作系统 Redhat AS 5.4 x86_642.2磁盘分区:2.3服务器安装的组件2.4初始化配置信息Ø网络设置 [root@mail ~]# hostname mail.servyou- [root@mail Server]# vi /etc/resolv.conf search servyou- nameserver 202.101.172.46 nameserver 202.101.172.35 [root@mail Server]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 设置IPADDR=192.168.2.37 Ø启动项设置 [root@mail ~]#chkconfig --level 35 sendmail off [root@mail ~]#chkconfig --level 35 iptables off [root@mail ~]#chkconfig --level 35 ip6tables off [root@mail ~]#servicesendmail stop [root@mail ~]#vi/etc/inittab 修改--> 启动级别设置为3 [root@mail ~]#cd / [root@mail ~]#mkdirdata Ø配置yum源 [root@mail ~]#vi /etc/yum.repos.d/#添加--> [Server] name=Red Hat Enterprise Linux Server baseurl=ftp://192.168.2.179/pub/Server enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [VT] name=Red Hat Enterprise Linux VT baseurl=ftp://192.168.2.179/pub/VT enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [Cluster] name=Red Hat Enterprise Linux Cluster baseurl=ftp://192.168.2.179/pub/Cluster enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [ClusterStorage] name=Red Hat Enterprise Linux ClusterStorage baseurl=ftp://192.168.2.179/pub/ClusterStorage enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [redhatds] name=Red Hat Enterprise Linux Directory Manager baseurl=ftp://192.168.2.179/pub/redhatds enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 说明:192.168.2.179的ftp上存放了REDHAT AS 5.4 x86_64操作系统的yum仓库,只需要按照上面的配置,既可以通过yum的方式安装各个软件包。 Ø新增系统帐号,后面安装邮件系统各个组件的时候需要用到 [root@mail ~]#groupadd postfix [root@mail ~]#useradd -g postfix -s /bin/false postfix [root@mail ~]#groupadd postdrop [root@mail ~]#groupadd vmail -g 1000 [root@mail ~]#useradd -u 1000 -g 1000 -M -s /sbin/nologin -d /dev/null vmail Ø安装php、http及相关依赖包 [root@mail ~]#yum -yinstall httpd php php-mysql php-gdphp-imap php-mbstring php-ldap [root@mail ~]#yum -yinstall perl-Unix-Syslog \ perl-GD \ perl-Digest-SHA1 \ perl-Digest-HMAC \ perl-Net-IP \ perl-Net-DNS \ perl-Time-HiRes \ perl-HTML-Tagset \ perl-HTML-Parser \ perl-libwww-perl \ perl-IO-stringy \ perl-IO-Multiplex \ perl-Net-SSLeay-1.30 \ perl-IO-Socket-SSL \ perl-Net-Server \ perl-TimeDate \ perl-MailTools \ perl-MIME-Base64 \ perl-Convert-BinHex \ perl-MIME-tools \ perl-Convert-TNEF \ perl-Convert-UUlib \ perl-Compress-Zlib \ perl-Archive-Zip \ perl-IO-Zlib \ perl-Archive-Tar \ arc-5.21o \ oo-2.10 \ unarj3 Postfix邮件系统各个组件的安装与配置3.1 OpenLDAP的安装、配置及数据的初始化3.1.1 OpenLDAP的安装可以通过两种方式来安装,第一种是在安装系统是自已就安装了,你如果认为它的版本太低了,可以通过YUM的方式升级一下,也可以通过源代码的方式安装,我这里是通过YUM的方式简单的安装了一下,如果通过源代码安装的话,那后面的一些组件的安装时就需要注意一下路径了。 [root@mail ~]#yum –y install openldap*3.1.2 OpenLDAP的配置Openldap的配置文件位于/etc/openldap/下,主要的配置文件有slapd.conf和ldap.conf。ldap配置文件主要本机ldap测试工具连接ldap服务器时的一些参数的设定,slapd.conf配置文件才是ldap服务器的配置文件,一定不要弄错。对于这两个配置文件我们需要做如下的修改:1、ldap.conf[root@mail ~]#vi/etc/openldap/ldap.conf 修改--> BASE dc=servyou-2、slapd.conf[root@mail ~]#vi/etc/openldap/slapd.conf 修改--> include/etc/openldap/schema/extmail.schema#该配置文件位于extman的解压包里 suffix"dc=servyou-" rootdn"cn=Manager,dc=servyou-" rootpw123456 serviceldapstart3.1.3 OpenLDAP数据的配初始化在配置ldap的时候,我们需要把后面我们的Webmail用的ldap的schema配置在LDAP服务器的配置文件里面去。具体的配置方法如下: [root@mail ~]#cd /data/ [root@mail data]#tarzxvfextman-1.1.tar.gz [root@mail data]#cp extman-1.1/docs/extmail.schema /etc/openldap/schema/ [root@mail data]#cp extman-1.1/docs/init.ldif /etc/openldap/ [root@mail ~]#vi /etc/openldap/init.ldif修改--> 将init.ldif文件里面的修改为servyou- cp/etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG serviceldapstart chkconfig --level 35 ldap on 设置开机启动。 ldapadd -x -D "cn=Manager,dc=servyou-" -W -f /etc/openldap/init.ldif 注意:错误提示:Enter LDAP Password: ldap_bind: Invalid credentials (49)解决方法:有可能是配置初始化数据或者配置文件有错,请仔细检查配置或者密码3.2BerkeleyDB的安装与配置:3.2.1BerkeleyDB的安装BerkeleyDB 可以通过两种方式来安装,第一种是在安装系统是自已就安装了,你如果认为它的版本太低了,可以通过YUM的方式升级一下,也可以通过源代码的方式安装,我这里是通过编译源码的方式安装的。 [root@mail data]#tarzxvf db-5.1.25.tar.gz [root@mail data]#cddb-5.1.25 [root@mail db-5.2.28]#./dist/configure --prefix=/usr/local/BerkeleyDB [root@mail db-5.2.28]#make [root@mail db-5.2.28]#make install3.2.2 BerkeleyDB的配置BerKeleyDB初始化安装完成之后,所有头文件都保存在/usr/local/BerkeleyDB/include,为了方便其他组件调用BerKeleyDB的头文件。操作如下 [root@mail db-5.2.25]# cd/ [root@mail1]# ln -sv /usr/local/BerkeleyDB/include /usr/include/db4 create symbolic link `/usr/include/db4/include' to `/usr/local/BerkeleyDB/include' [root@mail1]# mv /usr/include/db.h /usr/include/db.h.bak [root@mail1]# ln -sv /usr/local/BerkeleyDB/include/db.h /usr/include/db.h create symbolic link `/usr/include/db.h' to `/usr/local/BerkeleyDB/include/db.h' [root@mail1]# mv /usr/include/db_cxx.h /usr/include/db_cxx.h.bak [root@mail1]# ln -sv /usr/local/BerkeleyDB/include/db_cxx.h /usr/include/db_cxx.h create symbolic link `/usr/include/db_cxx.h' to `/usr/local/BerkeleyDB/include/db_cxx.h' [root@mail ~]#ldconfig -v3.3认证系统Courier-authlib的安装与配置3.3.1 Courier-authlib的安装authlib提供pop3、smtp、imap等其他组件访问LDAP、MySQL、PAM等数据库组件的认证接口,类似于ODBC,所以我们需要在其他组件前面安装,具体的安装过程如下: [root@mail data]#tarjxvf courier-authlib-0.63.0.tar.bz2 [root@mail data]#cdcourier-authlib-0.63.0 [root@mail courier-authlib-0.63.0]#./configure --prefix=/usr/local/authlib --sysconfdir=/etc --with-authldaprc=/etc/authlib/authldaprc --with-mailuser=vmail --with-mailgroup=vmail --without-stdheaderdir --without-authuserdb --without-pam --without-authmysql --without-authpwd --without-authshadow --without-authpgsql --without-authcustom --with-redhat [root@mail courier-authlib-0.63.0]#make [root@mail courier-authlib-0.63.0]#makeinstall [root@mail courier-authlib-0.63.0]#makeinstall-configure3.3.2 Courier-authlib的配置在安装完成之后,我们需要对courier-authlib做一下初始化的配置:1、authdaemonrc的配置[root@mail courier-authlib-0.63.0]#cd / [root@mail ~]#vi/etc/authlib/authdaemonrc修改内容--> authmodulelist="authldap" authmodulelistorig="authldap" daemons=5#改参数可以根据服务器的性能做适当的调整。 authdaemonvar=/usr/local/authlib/var/spool/authdaemon DEBUG_LOGIN=0#改参数的值可以为0、1、2,一般情况下设置为0,需要调试的时候修改为2 DEFAULTOPTIONS="wbnodsn=1" LOGGEROPTS=""2、authldaprc的配置[root@mail ~]#cp /etc/authlib/authldaprc /etc/authlib/authldaprc.bak [root@mail ~]#vi/etc/authlib/authldaprc添加内容--> LDAP_URIldap://127.0.0.1:389 LDAP_PROTOCOL_VERSION3 LDAP_BASEDNo=extmailAccount,dc=servyou- LDAP_BINDDNcn=Manager,dc=servyou- LDAP_BINDPW123456 LDAP_TIMEOUT5 LDAP_MAILmail LDAP_FILTER(&(objectClass=extmailUser)(active=1)) LDAP_HOMEDIRhomeDirectory LDAP_MAILROOT/home/domains LDAP_MAILDIRmailMessageStore LDAP_MAILDIRQUOTAquota LDAP_CRYPTPWuserPassword LDAP_UIDuidNumber LDAP_GIDgidNumber LDAP_AUXOPTIONSdisablesmtpd=disablesmtpd,disablesmtp=disablesmtp,disablewebmail=disablewebmail,disablenetdisk=disablenetdisk,disableimap=disableimap,disablepop3=disablepop3 LDAP_DEREFnever LDAP_TLS0 LDAP_DOMAINservyou-3、系统初始化配置在每次系统启动的时候,我们希望courier-authlib能够自动启动,需要做如下设置: [root@mail data]#cd/data/courier-authlib-0.63.0 [root@mail courier-authlib-0.63.0]#cp courier-authlib.sysvinit /etc/init.d/courier-authlib [root@mail courier-authlib-0.63.0]#chmod 755 /etc/init.d/courier-authlib [root@mail courier-authlib-0.63.0]#chkconfig --add courier-authlib [root@mail courier-authlib-0.63.0]#chkconfig --level 35 courier-authlib on [root@mail courier-authlib-0.63.0]#service courier-authlib start [root@mail courier-authlib-0.63.0]#chmod +x /usr/local/authlib/var/spool/authdaemon/ [root@mail courier-authlib-0.63.0]#echo "/usr/local/authlib/lib/courier-authlib/" >> /etc/ld.so.conf [root@mail courier-authlib-0.63.0]#ldconfig3.4 smtpd认证工具Cyrus-sasl组件的安装与配置SASL全称Simple Authentication and Security Layer,是一种用来扩充C/S模式验证能力的机制。在Postfix可以利用SASL来判断用户是否有权使用转发服务,或是辨认谁在使用我们的服务器。3.4.1 cyrus-sasl的安装(在安装cyrus-sasl之前我们需要将系统自带的软件包卸载,然后再进行cysasl的安装。确认系统中是否已经安装cyrus-sasl,确认方法: [root@mail ~]#rpm –qa |grep sasl 用rpm -e –nodeps 软件包名 进行卸载,如果是64为操作系统,系统默认会安装64和x86的两个相关包,需要加上 --allmatches的参数进行卸载,卸载完成之后,可以用前面的命令进行确认,直到系统没有sasl相关的软件包为止。再进行 cyrus-sasl的安装。)--可以不删除。 [root@mail data]#tarzxvf cyrus-sasl-2.1.23.tar.gz [root@mail data]#cdcyrus-sasl-2.1.23 [root@mail cyrus-sasl-2.1.23]#./configure --prefix=/usr/local/sasl2/ --sysconfdir=/etc --disable-anon --enable-plain --enable-login --enable-ldapdb --with-ldap --with-authdaemond=/usr/local/authlib/var/spool/authdaemon/socket 说明: 1、make 报错 db_berkeley.c:106: error: too few arguments to function '(*mbdb)->open' make[2]: *** [db_berkeley.lo] Error 1 make[2]: Leaving directory `/data/cyrus-sasl-2.1.23/sasldb' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/data/cyrus-sasl-2.1.23' make: *** [all] Error 2 解决方法 [root@mail cyrus-sasl-2.1.23]#cd sasldb/ [root@mail sasldb]#vidb_berkeley.c修改为--> #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1 ret = (*mbdb)->open(*mbdb, NULL, path, NULL, DB_HASH, flags, 0660); #else ret = (*mbdb)->open(*mbdb, "NULL", path, NULL, DB_HASH, flags, 0660); #endif cd .. viutils/dbconverter-2.c修改为--> #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1 ret = (*mbdb)->open(*mbdb, NULL, path, NULL, DB_HASH, DB_CREATE, 0664); #else ret = (*mbdb)->open(*mbdb, "NULL", path, NULL, DB_HASH, DB_CREATE, 0664); #endif [root@mail sasldb]#cd .. [root@mail cyrus-sasl-2.1.23]#make [root@mail cyrus-sasl-2.1.23]#makeinstall3.4.2 Cyrus-sasl的初始化配置[root@mail cyrus-sasl-2.1.23]#echo "/usr/local/sasl2/lib/sasl2" >>/etc/ld.so.conf [root@mail cyrus-sasl-2.1.23]#vi/usr/lib64/sasl2/smtpd.conf 内容为--> pwcheck_method: authdaemond log_level: 3 mech_list: PLAIN LOGIN authdaemond_path:/usr/local/authlib/var/spool/authdaemon/socket [root@mail cyrus-sasl-2.1.23]#cp /usr/lib64/sasl2/smtpd.conf /usr/lib/sasl2/ [root@mail cyrus-sasl-2.1.23]#cp /usr/lib64/sasl2/smtpd.conf /etc/3.5 Postfix软件的安装与配置Postfix邮件系统的核心组件,主要提供MTA服务,及整个邮件系统的框架。3.5.1 Postfix的安装[root@mail data]# tarzxvfpostfix-2.8.2.tar.gz [root@mail data]# cdpostfix-2.8.2 [root@mail postfix-2.8.2]# make tidy [root@mail postfix-2.8.2]#make makefiles "CCARGS=-DHAS_LDAP -I/usr/include -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/sasl2/include/sasl/ -I/usr/local/BerkeleyDB/include -DUSE_TLS -I-DUSE_TLS -I/usr/include/openssl" "AUXLIBS=-L/usr/lib -lldap -llber -L/usr/lib -lsasl2 -L/usr/local/BerkeleyDB/lib -L/usr/lib -lssl -lcrypto" make make install 提示输入--> install_root: [/] tempdir: [/data/postfix-2.8.2] /tmp config_directory: [/etc/Postfix] command_directory: [/usr/sbin] daemon_directory: [/usr/libexec/postfix] data_directory: [/var/lib/postfix] html_directory: [no] mail_owner: [postfix] mailq_path: [/usr/bin/mailq] manpage_directory: [/usr/local/man] newaliases_path: [/usr/bin/newaliases] queue_directory: [/var/spool/Postfix] readme_directory: [no] Sendmail_path: [/usr/sbin/Sendmail] setgid_group: [postdrop] [root@mail Postfix-2.8.2]# newaliases#生成别名数据库3.5.2 Postfix的配置Postfix的配置存放/etc/postfix/目录下,主要配置文件有main.cf、master配置文件。这里不做详细描述,详细配置请参考附录。3.6 Maildrop的安装与配置maildrop 是一个使用C++编写的用来代替本地MDA 的带有过滤功能邮件投递代理,是courier 邮件系统组件之一。它从标准输入接受信息并投递到用户邮箱;maildrop 既可以将邮件投递到mailboxes 格式邮箱,亦可以将其投递到maildirs 格式邮箱。同时,maildrop 可以从文件中读取入站邮件过滤指示,并由此决定是将邮件送入用户邮箱或者转发到其它地址等。和procmail 不同的是,maildrop 使用结构化的过滤语言,因此,邮件系统管理员可以开发自己的过滤规则并应用其中。 在此将使用maildrop 来代替Postfix 自带的MDA,并以此为基础扩展后文的邮件杀毒和反垃圾邮件功能的调用;在此可能会修改前文中的许多设置,请确保您的设置也做了相应的修改。3.6.1 Maildrop的安装1、pcre的安装 在安装maildrop之前请先确认系统中是否已经安装了pcre组件,maildrop需要此组件的支持。确认方法: [root@mail data]#rpm-qa |grep pcre确认prce是否安装。在这里我们系统默认已经安装了此组件,这里就不另外安装了。pcre的×××地址为: wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.bz2 configure&&make&&make install 然后按照解压、配置、编译、安装的步骤进行安装即可。这里不再详述。 2、maildrop的安装 [root@mail data]#tarjxvf maildrop-2.5.4.tar.bz2 [root@mail data]#cdmaildrop-2.5.4 [root@mail data]#ln -s /usr/local/authlib/bin/courierauthconfig /usr/bin/courierauthconfig [root@mail data]#ln -s /usr/local/authlib/include/* /usr/include [root@mail maildrop-2.5.4]#./configure --enable-sendmail=/usr/sbin/sendmail --enable-trusted-users='root vmail' --enable-syslog=1 --enable-maildirquota --enable-maildrop-uid=1000 --enable-maildrop-gid=1000 --with-trashquota --with-dirsync [root@mail maildrop-2.5.4]# make [root@mail maildrop-2.5.4]# make install3.6.2 Maildrop的配置配置Postfix调用maildrop来处理邮件。 1、Postfix中matser.cf配置文件的修改 [root@mail maildrop-2.5.4]# vi/etc/postfix/master.cf 修改--> maildropunix-n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/local/bin/maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop} 2、Postfix中main.cf配置文件的修改 [root@mail maildrop-2.5.4]# vi/etc/postfix/main.cf 修改--> virtual_transport = maildrop 3、maildrop配置文件maildroprc的修改 [root@mail maildrop-2.5.4]# vi/etc/maildroprc 加入--> logfile "/var/log/maildrop.log" TEST="/bin/test -f" # # Check for custom user .mailfilter file # CUSTOM_FILTER="$HOME/.mailfilter" `$TEST $CUSTOM_FILTER && exit 1 || exit 0` if ( $RETURNCODE == 0 ) { to "$HOME/Maildir" } 4、创建maildrop日志文件,并赋予相应的权限 [root@mail maildrop-2.5.4]#touch /var/log/maildrop.log [root@mail maildrop-2.5.4]#chown vmail.vmail /var/log/maildrop.log3.6.3 Maildrop的验证maildrop -v 如下输入正常--> maildrop 2.5.4 Copyright 1998- Double Precision, Inc. GDBM/DB extensions enabled.Courier Authentication Library extension enabled.代表安装正常Maildir quota extension are now always enabled. This program is distributed under the terms of the GNU General Public License. See COPYING for additional information.3.7 Courier-imap的安装与配置courier-iamp在整个邮件系统中充当MAA的角色,主要为用户提供pop3和imap服务。3.7.1 Courier-imap的安装[root@mail data]#tarjxvf courier-imap-4.9.3.tar.bz2 [root@mail data]#cdcourier-imap-4.9.3 [root@mail courier-imap-4.9.3]#./configure --prefix=/usr/local/imap --sysconfdir=/etc --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6 CPPFLAGS='-I/usr/local/authlib/include' LDFLAGS='-L/usr/local/authlib/lib/courier-authlib' COURIERAUTHCONFIG='/usr/local/authlib/bin/courierauthconfig' [root@mail courier-imap-4.9.3]#make [root@mail courier-imap-4.9.3]#makeinstall [root@mail courier-imap-4.9.3]#makeinstall-configure3.7.2courier-imap的配置courier-iamp的配置文件主要包括:pop3d、pop3-ssl、imapd、imapd-ssl。 1、pop3d配置文件的修改 [root@mail courier-imap-4.9.3]#vi/etc/pop3d 修改--> POP3DSTART=YES 2、pop3d-ssl配置文件 [root@mail courier-imap-4.9.3]#vi/etc/pop3d-ssl 修改--> POP3DSSLSTART=YES 3、f配置文件 [root@mail courier-imap-4.9.3]#vi/etc/f 修改--> #default_md = sha1(注释点这项) 4、imapd配置文件 [root@mail courier-imap-4.9.3]#vi/etc/imapd 修改--> IMAPDSTART=yes 5、imapd-ssl配置文件 [root@mail courier-imap-4.9.3]#vi/etc/imapd-ssl 修改--> IMAPDSSLSTART=YES 6、f配置文件 [root@mail courier-imap-4.9.3]#vi/etc/f 修改--> #default_md = sha1(注释点这项) 7、maildrop 初始化配置 [root@mail courier-imap-4.9.3]#cpcourier-imap.sysvinit /etc/rc.d/init.d/courier-imapd [root@mail courier-imap-4.9.3]#chmod 755 /etc/rc.d/init.d/courier-imapd [root@mail courier-imap-4.9.3]#chkconfig --add courier-imapd [root@mail courier-imap-4.9.3]#chkconfig --level 35 courier-imapd on [root@mail courier-imap-4.9.3]#servicecourier-imapdstart4 Webmail的安装与配置Webmail主要为管理员提供管理和维护的平台、为用户提供查看和管理邮件平台。主要包括Extman和Extmail两个组件。下面将详细介绍其安装与配置的方法。4.1 Extman的安装与配置extman主要提供web的后台管理与维护。4.1.1 Extman的安装extman的安装非常简单,只需要将extman的 [root@mail data]#tarzxvfextman-1.1.tar.gz [root@mail data]#cp-ra extman-1.1 /var/www/extsuite/extman [root@mail data]#cd/var/www/extsuite/extman/4.1.2 Extman的配置[root@mail extman]#cpwebman.cf.default webman.cf [root@mail extman]#viwebman.cf修改内容--> SYS_SESS_DIR = /var/www/extsuite/extman/tmp SYS_BACKEND_TYPE = ldap SYS_LDAP_BASE = dc=servyou- SYS_LDAP_RDN = cn=Manager,dc=servyou- SYS_LDAP_PASS = 123456 SYS_GROUPMAIL_SENDER = postmaster@servyou-4.2 Extmail的安装与配置4.2.1 Extmail的安装[root@mail data]#tarzxvfextmail-1.2.tar.gz [root@mail data]#cp-ra extmail-1.2 /var/www/extsuite/extmail4.2.2 Extmail的配置[root@mail data]#cd/var/www/extsuite/extmail/ [root@mail extmail]#cpwebmail.cf.default webmail.cf [root@mail extmail]#viwebmail.cf 修改内容--> SYS_MYSQL_USER = extmail SYS_MYSQL_PASS = extmail SYS_MYSQL_DB = extmail SYS_AUTH_TYPE = ldap SYS_SPAM_REPORT_ON = 1 SYS_DEBUG_ON = 0 SYS_LDAP_PASS = 123456 SYS_LDAP_BASE = o=extmailAccount,dc=servyou- SYS_LDAP_RDN = cn=Manager,dc=servyou- SYS_G_ABOOK_LDAP_BASE = ou=AddressBook,dc=servyou- SYS_G_ABOOK_LDAP_ROOTDN = cn=Manager,dc=servyou- SYS_SESS_DIR = /var/www/extsuite/extmail/tmp SYS_UPLOAD_TMPDIR = /var/www/extsuite/extmail/tmp SYS_AUTHLIB_SOCKET = /usr/local/authlib/var/spool/authdaemon/socket4.3 Apache的配置[root@mail ~]#vi /etc/httpd/conf/httpd.conf 末尾添加--> include conf/vhost_*.conf [root@mail ~]#vi /etc/httpd/conf/vhost_extmail.conf # VirtualHost for ExtMail Solution <VirtualHost *:80> ServerName mail2.servyou- 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/ #Alias /phpldapadmin/var/www/extsuite/phpldapadmin/htdocs/ #Suexec config #SuexecUserGroup vmail vmail </VirtualHost> 配置完成之后就可以启动httpd服务了。 [root@mail ~]#service httpdstart4.4 Postfix虚拟用户的配置一般情况下,邮件服务器都不会直接用系统帐号户用户提供邮件服务,所以我们需要用到虚拟用户这个功能,将用户的信息保存在后台数据库中,这里我们采用ldap的方式保存用户数据,接下来将详细介绍为Postfix添加虚拟用户支持,具体配置如下: 1、Postfix主配置文件main.cf的配置 [root@mail ~]#vi /etc/Postfix/main.cf 添加如下内容--> #extmail config here virtual_mailbox_base = /home/domains 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 virtual_transport = maildrop smtpd_sender_login_maps = ldap:/etc/Postfix/ldap_virtual_sender_maps.cf, ldap:/etc/Postfix/ldap_virtual_alias_maps.cf 2、配置Postfix的ldap列表 [root@mail ~]#cp /var/www/extsuite/extman/docs/ldap*/etc/postfix/ [root@mail ~]#postfix reload5防病毒反垃圾系统的安装与配置Postfix本身采用了body_checks和header_checks的方法对邮件内容进行,但是这种机制将检查经过Postfix的每一份邮件,而且一次只能对比对一行文字。如果设置了复杂的过滤规则,将严重降低Postfix的效率,消耗大量的服务器运算资源。另外该模式只提供拒收和接收两种动作,所以,我们一般只用它来实现简单的过滤操作。 Postfix一般采用外界程序来实现对邮件进行病毒和垃圾扫描。这里我采用Amavisd-new来调用ClamAV和SpamAssassin的组合套件来实现对病毒邮件扫描和垃圾邮件过滤。5.1 clamav的安装与配置ClamAV 是一个Unix 系统平台上的开源反病毒工具,它是特地为在邮件网关上进行邮件扫描而设计的。整套软件提供了许多的实用工具,包括一个可伸缩和可升级的多线程守护进程、一个命令行扫描工具和病毒库自动升级工具。5.1.1 ClamAV的安装[root@mail data]#tarzxvf clamav-0.97.1.tar.gz [root@mail data] #cdclamav-0.97.1 [root@mail clamav-0.97.1]#./configure --prefix=/usr/local/clamav --with-dbdir=/usr/local/share/clamav --disable-zlib-vcheck --sysconfdir=/etc/clamav make make install5.1.2 ClamAV的配置[root@mail data]#mkdir /var/log/clamav [root@mail data]#chmod -R 744 /var/log/clamav [root@mail data]#chmod -R amavis:amavis /var/log/clamav [root@mail data]#chown -R amavis:amavis /var/log/clamav [root@mail data]#chown -R amavis:amavis /usr/local/share/clamav [root@mail data]#mkdir /var/run/clamav [root@mail data]#chmod 700 /var/run/clamav [root@mail data]#chown -R clamav:clamav /var/run/clamav [root@mail data]#mv /etc/clamav/clamd.conf /etc/clamav/clamd.conf.old [root@mail data]#vi/etc/clamav/clamd.conf [root@mail data]#mv/etc/clamav/freshclam.conf /etc/clamav/freshclam.conf.old [root@mail data]#vi /etc/clamav/freshclam.conf [root@mail data]#find /-name "clamav-milter" [root@mail data]#cpclamd/clamd /etc/rc.d/init.d/clamd5.2 SpamAssassin的安装与配置是目前最好的、最流行的开源反垃圾邮件软件之一。它是一个邮件过滤器,使用了多种反垃圾邮件技术,如:文本分析、贝叶斯过滤、DNS 黑名单和分布式协同过滤数据库等。 1、 基础配置 在安装系统的时候,sapmassassin组件就默认安装了,这里只要做简单的配置即可,sapmassassin的配置文件位于/etc/mail/spamassassin/目录下。 [root@mail data]#vi/etc/mail/spamassassin/local.cf # These values can be overridden by editing ~/.spamassassin/user_prefs.cf # (see spamassassin(1) for details) # These should be safe assumptions and allow for simple visual sifting # without risking lost emails. #required_hits 5 #report_safe 0 #rewrite_header Subject [SPAM] required_hits 10.0 #rewrite_subject 1 required_score 5.0 rewrite_header Subject *****SPAM***** report_safe 1 use_bayes 1 bayes_auto_learn 1 skip_rbl_checks 1 use_razor2 0 use_pyzor 0 ok_locales all 2、 增加Chinese_rules.cf 支持 Chinese_rules.cf 是教育科研网的反垃圾邮件小组对大量垃圾邮件和正常邮件进行分析后得出的一个关键字/分数规则集,用于处理中文(简体)垃圾邮件。这里我们通过如下命令增加到系统: #wget -N -P /usr/share/spamassassin http://www./spam/sa/Chinese_rules.cf5.3 Amavisd-new的安装与配置Amavisd-new 是一个连接MTA 和内容检测工具(诸如病毒扫描工具和SpamAssassin)的高性能接口程序,使用perl 语言写成。它一般通过SMTP、ESMTP 或者LMTP 和MTA 进行通讯,当然也可以借助于其它外部程序进行。同Postfix(MTA)协同工作时表现尤佳。当它呼叫SpamAssassin 进行内容过滤时,对于一封邮件只需要呼叫一次,而不管这封邮件将发往多少个收件人;同时,它亦会尽力保证实现每一位收件人的偏好设置,如接收/拒绝,检测/不检测,垃圾邮件级别等;它还会在邮件头部分插入spam 相关信息。5.3.1 amavisd-new的安装[root@mail data]#tarzxvf amavisd-new-2.6.1.tar.gz [root@mail data]#cdamavisd-new-2.6.1 [root@mail data]#mkdir -p /var/amavis /var/amavis/tmp /var/amavis/var /var/amavis/db [root@mail data]#chown -R amavis:amavis /var/amavis [root@mail data]#chmod-R750 /var/amavis [root@mail data]#cp amavisd /usr/local/sbin/ [root@mail data]#chown root /usr/local/sbin/amavisd [root@mail data]#chown 755 /usr/local/sbin/amavisd5.3.2配置及调试[root@mail data]#cpamavisd.conf /etc/ [root@mail data]#chown root /etc/amavisd.conf [root@mail data]#chmod 644 /etc/amavisd.conf [root@mail data]#mkdir /var/virusmails [root@mail data]#vi/etc/amavisd.conf [root@mail data]#/usr/local/sbin/amavisd debug 根据调试命令的结果来安装所需要的perl模块,默认情况下,需要安装的perl组件有: MIME::Base64 DB_File Net::SMTP Mail::SPF IP::Country::Fast Net::Ident IO::Socket::INET6 IO::Socket::SSL Compress::Zlib Time::HiRes Mail::DKIM Mail::DomainKeys DBI *and* DBD driver/modules Encode::Detect Apache::Test Razor2 安装方法如下: [root@mail data]#perl -MCPAN -e shell cpan> install Digest::SHA1 ………………5.4 Spam Locker的安装与配置SpamAssassin 是基于"邮件内容"来进行判别的垃圾邮件过滤系统,而Spam Locker 是基于邮件"发送行为"来进行判别的垃圾邮件过滤系统。两种模式的垃圾邮件过滤系统孰优孰劣在此不做评判,请安装者自行选择。两个过滤系统可分别安装,也可以并存运行。Spam Locker 简称slockd,下载地址:/download/5.4.1安装Spam Locker1、环境要求Spam Locker 要用到的perl 模块: Net::NS Digest::MD5 Digest::SHA1 Digest::HMAC Net::IP 2、locker的安装 [root@mail data]# tar -zxvf slockd-0.10.tar.gz [root@mail data]# mv slockd-0.10 slockd [root@mail data]# mv slockd /usr/local/5.4.2配置slockd进入/usr/local/slockd 目录,编辑config/main.cf 配置文件,每个配置参数都有简短的注释,如果要修改的话,请仔细阅读注释后方可修改。默认情况下,slockd 将只监听127.0.0.1(localhost)的10030 端口,公网是无法访问这一服务的,这样做是为了安全起见,防止被其他有心人利用来做坏事。默认的日志将在标准的输出和标准错误输出(STDERR)显示。将如下行去掉注释: setsid 1 使之以后台的方式运行。接下来,可以配置slockd 的日志路径和pid 文件路径,默认配置为: log_file /var/log/slockd.log pid_file /var/run/slockd.pid 启动slockd: [root@mail data]# /usr/local/slockd/slockd-init start 添加开机时自动执行 [root@mail data]#echo "/usr/local/slockd/slockd-init start" >> /etc/rc.local 进入/usr/local/slockd/tools 目录,输入: [root@mail data]#perl policy_sig -h localhost -p 10030 --helo FOOBAR \ --ip 192.168.2.180 --from zhufg@servyou- --to test@servyou- 此时,程序应该返回如下错误信息: action=504 <FOOBAR>: rejected, see /cgi/why?fqdn 这表示slockd 初步的正常工作了。 配置MTA: [root@mail data]# vi /etc/Postfix/main.cf 将“check_policy_service inet:127.0.0.1:10030”记录增加到smtpd_recipient_restrictions 里, 一个建议的配置如下: ########## slockd ########## smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_hostname, check_policy_service inet:127.0.0.1:10030 ########## slockd end ########## 配置完毕后,重新启动Postfix。 注意的是,上面的配置是将slockd 的查询放到最后,这也是进一步提高资源利用率的办法, 因为有部分功能Postfix 已实现了,所以就先由Postfix 检测,如果检测不到再由slockd 完成。6邮件性能测试工具的安装与配置6.1 Postal邮件测试工具介绍Postal是邮件服务器压力测试工具。6.2 postal邮件测试工具的安装postal需要gnutls的支持,而gnutls需要nettle和p11-kit的支持,所以在安装该软件之前,要先安装这三个组件。6.2.1安装nettle[root@mail ~]#cd/data [root@mail data]#tarzxvf nettle-2.4.tar.gz [root@mail data]#cdnettle-2.4 [root@mail nettle-2.4]#./configure [root@mail nettle-2.4]#make [root@mail nettle-2.4]#make install6.2.23、安装p11-kit[root@mail data]#tarzxvf p11-kit-0.7.tar.gz [root@mail data]#cdp11-kit-0.7 [root@mail p11-kit-0.7]#./configure [root@mail p11-kit-0.7]#make [root@mail p11-kit-0.7]#make install6.2.3 gnutls的安装开始安装gnutls之前请将系统自带的gnutls删除,因为系统自带的版本为1.4.1比较低。而postal至少要求1.4.3 [root@mail data]#rpm -e --nodeps gnutls [root@mail data]#rpm -e --nodeps gnutls-utils [root@mail data]#rpm -e --nodeps gnutls-devel [root@mail data]#rpm-e --nodeps --allmatches gnutls (x64) [root@mail data]#rpm-e --nodeps --allmatches gnutls-devel (x64) [root@mail data]#rpm-e --nodeps --allmatches gnutls-utils (x64) [root@mail data]#tarjxvf gnutls-2.2.4.tar.bz2 [root@mail data]#cdgnutls-2.2.4 [root@mail gnutls-2.2.4]#./configure [root@mail gnutls-2.2.4]# make [root@mail gnutls-2.2.4]# make install [root@mail gnutls-2.2.4]#cd /usr/local/lib/ [root@mail lib]#cplibgnutls.so.26 /usr/lib64 (x64) #将postal运行时需要的动态连接库复制到/usr/lib目录下,方便调用。 [root@mail lib]#cplibgnutls.so.26 /usr/lib [root@mail lib]#strings libgnutls.so.26.1.5 |grep GNUTLS_1 GNUTLS_1_4 注意:在选择postal的时候一定选择比较新的软件包,我选择安装的是0.70版本,低版本的postal要求必须为GNUTLS_1_3,这样就会导致postal不能正常运行。6.2.4安装postal[root@mail data]#tarzxvfpostal-0.70.gz [root@mail data]#cdpostal-0.70 [root@mail postal-0.70]#cp/bin/uname /usr/bin/uname [root@mail postal-0.70]#./configure [root@mail postal-0.70]#make [root@mail postal-0.70]#makeinstall [root@mail postal-0.70]#postal Usage: postal [-m maximum-message-size] [-M minimum-message-size] [-t threads] [-c messages-per-connection] [-r messages-per-minute] [-a] [-b [no]netscape] [-p port] [-[z|Z] debug-file] [-s ssl-percentage] [-l local-address] [-f sender-file] smtp-server user-list-filename Postal Version: 0.70 看见上述输出就代表postal已经可以正常运行了。6.3 postal邮件测试工具的使用postal工具的参数说明 [-m maximum-message-size] 邮件的最大size [-M minimum-message-size] 邮件的最小size [-t threads] 发送邮件的线程数 [-c messages-per-connection] 每个链接发送多少个邮件 [-r messages-per-minute] [-a] 一分钟发送多少封邮件 [-b [no]netscape] [-p port] 邮件服务器的端口 [-[z|Z] debug-file] 将调试结果写入文件 [-s ssl-percentage] SSL链接 [-l local-address] 本地地址 [-f sender-file] 发送附件 smtp-server 邮件服务器的地址 user-list-filename用户列表,用户必须在系统中存在,postal会随机从一个地址发送到另一个地址。7 Postfix邮件服务器的集群部署任何稳定的系统都有系统down机的时候,如何保证邮件系统系统高可用性呢。下面将描述Postfix的集群部署方案,如下图所示: 说明: 1、Postfix集群方案中,采用双机主备部署模式,主要分为业务(包括MTA、MAA、MDA、WEB)、邮件存储、用户认证三个某块; 2、其中业务模块采用HA的方式虚拟出一个VIP(服务器IP地址),对外提供服务。正常情况下VIP守护在主服务器上为用户提供服务,当主服务器出现故障的时候,VIP将守护在从服务器上提供服务。有关heartBeat的资料请参考《基于heartbeat技术实施CTI服务高可用性的技术实现方案》 3、对于邮件服务器来,还有一个比较重要的就是用户数据,在这里不论是mysql还是LDAP都可以采用主备同步的技术来实现用户数据的同步。有关ldap的集群部署请参考《OpenLDAP安装与部署手册》 4、邮件服务器会暂时把用户的邮件保存在服务器上,直到用户利用客户端工具将该邮件收下或者删除,所以邮件的存储也在集群方案中必须要考虑的。在Postfix的集群方案中,我们采用MFS分布式存储技术,将用户的邮件分为两个副本保存在两台不同的服务器上。有关MFS的资料请参考《Linux MFS安装手册》8其它配置信息8.1 FastCGI的安装与配置为Extmail 增加FCGI 的支持,主要是为了获得优异的WEB效能,克服CGI 不能应付大量访问及低效率的缺陷。据说,FCGI 的页面效率是CGI 模式的十倍以上。mod_fastcgi 是针对Apache Web 服务器的FCGI 支持模块,下载地址/dist/mod_fastcgi-2.4.6.tar.gz8.1.1安装mod_fastcgi[root@mail data]# tar -zxvf mod_fastcgi-2.4.6.tar.gz [root@mail data]#cd mod_fastcgi-2.4.6 [root@mail mod_fastcgi-2.4.6]# cp Makefile.AP2 Makefile [root@mail mod_fastcgi-2.4.6]# make top_dir=/usr/local/apache install 除了Apache 需要FCGI 的支持外,extmail 也需要相应的perl-FCGI 模块。下载地址/rpm/packages/perl-FCGI/info.html 用以下命令安装: [root@mail data]# rpm -ivh perl-FCGI-0.67-1.2.el5.rf.i386.rpm (请安装跟你的操作系统版本对应的安装包)8.1.2 Apache FastCGI的配置在Apache 的配置文件的Extmail 虚拟主机部分,添加如下内容: vi LoadModule fastcgi_module modules/mod_fastcgi.so <Ifmodule mod_fastcgi.c> FastCgiExternalServer /var/www/extsuite/extmail/dispatch.fcgi -host 127.0.0.1:8888 </Ifmodule> 同时,去掉如下行: 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 改为: Alias /extmail/cgi/ /var/www/extsuite/extmail/dispatch.fcgi/ Alias /extmail /var/www/extsuite/extmail/html Alias /extman/cgi/ /var/www/extsuite/extmail/dispatch.fcgi/ Alias /extman /var/www/extsuite/extman/html <Location "/extmail/cgi"> SetHandler fastcgi-script </Location> <Location "/extman/cgi"> SetHandler fastcgi-script </Location> 然后编辑/var/www/extsuite/extmail/dispatch-init 文件,修改如下: SU_UID=vmail SU_GID=vmail BASE=/var/www/extsuite/extmail 启动fastcgi server: # /var/www/extsuite/extmail/dispatch-init start 如果没有意外将启动5 个dispatch.fcgi 守护进程. 添加自启动: # echo "/var/www/extsuite/extmail/dispatch-init start" >> /etc/rc.d/rc.local 重启apache # /usr/local/apache/bin/apachectl restart8.2 DNS缓存工具的安装与配置发送邮件时,系统必须到DNS 服务器上进行查询,如果自己有DNS 服务器或者DNS 缓存,会大大加快域名查询速度。这里安装的是djbdns,如果你装有bind 的话,就不要装这个了。进入本安装包install-djbdns-rpm 目录(见附件),运行install.sh 安装,注:install.sh 最后两行的ip 地址是广西电信的DNS 服务器地址,运行前请修改为你所在区域的dns 服务器地址。 (你也可以自己去下载djbdns 的源码来编译安装,下载地址及安装教程 http://cr.yp.to/djbdns.html,这个貌似很麻烦~~) 1、启动 # /etc/init.d/djbdns start 启动正常的话会在53 端口监听 2、验证djbdns 是否起作用: # dig / (别的网站域名也可以) 再执行一次上述命令,应该能感觉到第二次运行时的响应速度明显比第一次快。 3、刷新DNS 缓存 有时候互联网上的DNS 记录已经发生改变了,而你的DNS 缓存还是旧的,可用如下命令来刷新 # /usr/bin/svc -t /service/dnscache 你也可以将上述命令写个脚本添加到crontab 进行定期刷新: # vi /root/flush_dns.sh-->添加下行 /usr/bin/svc -t /service/dnscache # chmod 755 /root/flush_dns.sh # crontab -e 添加下行 1 1 * * * /root/flush_dns.sh (这个本不应属于Postfix 邮件服务器的一部分的,加进来只是为了方便一点。如果你的邮件数量不是很多的话,作DNS 缓存的意义不大;如果你经常往外大量群发邮件,就比较有用了。)9常见问题在整个邮件系统安装完成之后,在调试的过程中,经常会出现这样或者那样的问题,下面列举一些比较常见的问题及解决的方法,希望对大家有所帮助。问题1:temporary failure. Command output: /usr/bin/maildrop: Invalid home directory permissions - world writable. ) [root@Mail ~]# echo "test" | maildrop -V 10 -d lian@ maildrop: authlib: groupid=1000 maildrop: authlib: userid=1000 maildrop: authlib: logname=lian@,home=/home/domains//lian, mail=/home/domains//lian/Maildir/ maildrop: Changing to /home/domains//lian maildrop: Invalid home directory permissions - world writable. 出现这样的问题是/home /domails文件的权限不能设高777 755恢复问题2:Mar 18 15:38:08 Mail Postfix/smtpd[31796]: warning: SASL authentication failure: cannot connect to Courier authdaemond: Permission denied Mar 18 15:38:08 Mail Postfix/smtpd[31796]: warning: Mail[127.0.0.1]: SASL login authentication failed: generic failure 此类问题最多的是几个问题 /usr/lib/sasl2/smtpd.conf 配置问题文件的权限问题 /var/spool/authdaemon 文件的权限问题 /etc/authlib/authdaemon 配置问题 1、关于很多日志报拒绝情况下,检查权限的问题,多数情况 是SELinux搞的鬼,将SELinux关闭,重新启动机器再看一切运行正常 2、连不上数据的问题最好将默认的localhost改为127.0.0.1 ============================================================================= 3、extmail 与extman web界面打开提示DBI连接数据库的问题,是因为缺少perl-DBD-MySQL包 提示连接不上数据库是因为webman里面的数据库设置问题 没有那个邮件地址目录的,拒绝是因为权限的设置无法写入比如: drwxr-xr-x 5 vuser vgroup 4096 03-18 15:43 问题3:Feb 23 23:32:45 mail-bk Postfix/smtpd[2799]: NOQUEUE: reject: RCPT from [192.168.0.37]: 554 5.7.1 <[192.168.0.37]>: Client host rejected: Access denied; from=<hufy@> to=<joe@> proto=ESMTP helo=<xmerp> 确认以上日志为客户机访问拒绝,无中继的权限。 1、检查mynetworks是否有列出192.168.0.37这台服务器。 经确认存在。(这里有异常,等下在说,但现在我们就认是正常的) 2、检查POSTFIX中的几个restriction确认是否有存在permit_mynetworks列出。 smtpd_restriction_classes=allow_send_alluser,only_send_localdomain allow_send_alluser = check_sender_access hash:/etc/Postfix/s2all_sender.txt,reject only_send_localdomain=check_recipient_access hash:/etc/Postfix/onlysend_localdomain_maps.txt,reject smtpd_recipient_restrictions=check_recipient_access hash:/etc/Postfix/send2allclass,check_sender_access, mysql:/etc/Postfix/mysql_virtual_localdomain_class_maps.cf, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unauth_pipelining, reject smtpd_sender_restrictions= permit_mynetworks, reject_sender_login_mismatch, reject_authenticated_sender_login_mismatch, reject_unauthenticated_sender_login_mismatch, smtpd_sender_login_maps= mysql:/etc/Postfix/mysql_virtual_sender_maps.cf, mysql:/etc/Postfix/mysql_virtual_alias_maps.cf smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_sender, reject_unauth_pipelining, reject_unauth_destination, reject mynetworks =127.0.0.1 192.168.0.8 192.168.0.11 193.168.0.37 192.168.0.17 192.168.0.6 192.168.0.3192.168.0.16 192.168.0.15 192.168.9.49 192.168.0.39 192.168.0.19 192.168.0.202 192.168.0.144 ###MASTER文件

submission inet n - n - - smtpd -o smtpd_tls_security_level=may -o smtpd_sasl_auth_enable=yes -o smtpd_sasl_type=dovecot -o smtpd_sasl_path=private/auth -o smtpd_sasl_security_options=noanonymous -o smtpd_sasl_local_domain=$mydomain -o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject 确认以下设置都没有问题,没办法开启POSTFIX的DEBUG 在main.cf文件中增加以下内容: debug_peer_list = 192.168.0.37 #运行Postfix reload问题4:extman后台管理系统控制没有信息输出的解决方法[root@KangTa daemon]# pwd /var/www/extsuite/extman/daemon [root@KangTa daemon]# ./cmdserver --daemon loaded ok Found an server instance pid=15259 is running, abort.. [root@KangTa daemon]# ps -eaf | grep 15259 root 15259 1 0 21:31 ? 00:00:00 /usr/bin/perl -w ./cmdserver –daemon root 15485 10403 0 21:36 pts/1 00:00:00 grep 15259 [root@KangTa daemon]# kill 15259问题5:编译courier-imap 出错checking for courierauthconfig... no configure: WARNING: === Courier authentication library not found. configure: WARNING: === You need to download and install configure: WARNING: === http://www.courier-/download.php#authlib first. configure: WARNING: === If courier-authlib is installed in a non-default configure: WARNING: === directory, set the COURIERAUTHCONFIG environment configure: WARNING: === variable to the full path to the courierauthconfig configure: WARNING: === binary and rerun this configure script. configure: WARNING: configure: error: courierauthconfig not found 解决方法: [root@mail courier-imap-4.8.0.0628]# export COURIERAUTHCONFIG=/usr/local/authlib/bin/courierauthconfig问题6:maildrop编译出错configure: error: pcre.h not found - install PCRE from 解决方法: [root@ivon maildrop-2.5.0]# yum install pcre-devel问题7:安装courier-imap时报错解决方法: 我用的4.8的换成4.5时安装顺利完成。 courier-imap-4.5.1.tar.bz2问题8:extman验证码不显示解决方法

支持范围:后台登陆和帐户注册模块。需要GD的支持,详细请到cpan上搜索GD并安装即可。注意的是默认webman.cf里打开了该功能的自持,如果需要关闭校验码,请将SYS_CAPTCHA_ON = 0即可关闭。 [root@ivon daemon]# perl -MCPAN -e shell Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.7602) ReadLine support available (try 'install Bundle::CPAN') cpan> install GD 参数介绍: SYS_CAPTCHA_ON = 1 | 0 如果为0则关闭此功能 SYS_CAPTCHA_KEY 该参数非常重要,设置的是您的校验key,强烈建议安装extman后修改此参数,否则非法分子可以利用默认的key来伪造请求!!请设置一个复杂、不易猜测的key值。 SYS_CAPTCHA_LEN 校验码的长度,默认是6位。 校验码使用了ttf字库,如果您的操作系统没有freetype等ttf库,请删除 extman/addon/font.ttf这个软链接,这样校验码就会用gd默认的字体来显示。 问题9:启动Postfix时报错Postfix: fatal: /etc/Postfix/main.cf, line 50: missing '=' after attribute name: "reject_non_fqdn_hostname," 解决方法: 修改/etc/Postfix/main.cf smtpd_recipient_restrictions = 后面的选项都不能有空格。 #====================SASL======================== broken_sasl_auth_clients = yes smtpd_recipient_restrictions= permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname, reject_non_fqdn_hostname, reject_unknown_sender_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_pipelining, reject_unauth_destination,permit问题10:extman后台管理不能登录了,提示如下Can't open /tmp/extman//sid_26da75f9aec35f2cbc6b4fa425ab525e, No such file or directory 解决方法: 修改,/var/www/extsuite/extman/webmail.cf文件里面的配置 # sys_sess_dir, the session dir

SYS_SESS_DIR = /tmp/extman/ 改为:SYS_SESS_DIR = /var//tmp/extman/还有一种常见错误就是提示 Can't open /tmp/extman//sid_89b33ec5ce0b5903f24035aa4ad76d15, Permission denied 这个是因为extman 那个临时目录的权限不对。 可以设置为777就ok了问题11:点extman后台图像日志报错:Can't locate RRDs.pm in @INC (@INC contains: /var/www/extsuite/extman/libs /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /var/www/extsuite/extman/libs/Ext/GraphLog.pm line 23. BEGIN failed--compilation aborted at /var/www/extsuite/extman/libs/Ext/GraphLog.pm line 23. Compilation failed in require at /var/www/extsuite/extman/libs/Ext/MgrApp/ViewLog.pm line 22. BEGIN failed--compilation aborted at /var/www/extsuite/extman/libs/Ext/MgrApp/ViewLog.pm line 22. Compilation failed in require at /var/www/extsuite/extman/cgi/viewlog.cgi line 18.解决方法:安装rrdtool包 [root@hmg2 src]#tar -zxvf rrdtool-1.3.1.tar.gz [root@hmg2 src]#./configure --prefix=/usr/local/rrdtool && make && make install cp -rp /usr/local/rrdtool/lib/perl/5.8.8/x86_64-linux-thread-multi/* /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/ 运行rrdtool –v测试安装成功没有: [root@hmg2 src]#rrdtool -v //可以看到RRDTool的用法以及版本信息问题12:extman后台图形日志红叉解决方法:[root@mail lib]#wget /authors/id/M/MG/MGRABNAR/File-Tail-0.99.3.tar.gz [root@mail lib]# tar zxvf File-Tail-0.99.3.tar.gz [root@mail lib]# cd File-Tail-0.99.3 [root@mail lib]# perl Makefile.PL [root@mail lib]# make [root@mail lib]# make install [root@ivon lib]# /usr/local/mailgraph_ext/mailgraph-init start 引用: /usr/local/mailgraph_ext/mailgraph-init start 将这2句复制到/etc/rc.d/rc.local(linux)或/etc/rc.conf(bsd)便于系统重启动后自动启动相关进程。过一段时间看/var/lib下是否产生了mailgraph_**.rr

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。