yum -y groupinstall Development Libraries Development Tools
yum install -y httpd httpd-devel php php-mysql mysql mysql-server mysql-devel openssl-devel dovecot perl-DBD-MySQL tcl tcl-devel libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-devel expect db4 db4-devel cyrus-sasl-* dovecot-mysql perl-CGI
rpm -ivh ftp://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/perl-Unix-Syslog-1.1-1.el6.rf.x86_64.rpm
wget ftp://rpmfind.net/linux/dag/redhat/el6/en/x86_64/extras/RPMS/perl-GD-2.45-1.el6.rfx.x86_64.rpm(perl-GD 下载好后使用 yum localinstall 安装)
#service sendmail stop
#chkconfig sendmail off
#yum remove postfix
#userdel postfix
#groupdel postfix
[root@mail ]# groupadd -g 2525 postfix
[root@mail ]# useradd -g postfix -u 2525 -s /sbin/nologin -M postfix
[root@mail ]# groupadd -g 2526 postdrop
[root@mail ]# useradd -g postdrop -u 2526 -s /bin/false -M postdrop
tar -zxvf postfix-2.6.5.tar.gz
cd postfix-2.6.5
make makefiles CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib64/sasl2 -lsasl2 -lssl -lcrypto
make && make install
#newaliases
tempdir: [/home/soft/postfix-2.6.5]
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.postfix]
manpage_directory: [/usr/share/man]
newaliases_path: [/usr/bin/newaliases.postfix]
queue_directory: [/var/spool/postfix]
readme_directory: [/usr/share/doc/postfix-2.6.6/README_FILES]
sendmail_path: [/usr/sbin/sendmail.postfix]
setgid_group: [postdrop]
vim /etc/postfix/main.cf
mynetworks = 127.X.X.1
# postconf -a
cyrus <---- 出现此提示说明支持 sasl 认证
dovecot
#vim /etc/postfix/main.cf
############################CYRUS-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
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!
vim /usr/lib/sasl2/smtpd.conf
pwcheck_method: authdaemond
log_level: 3
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket
#!/bin/bash
#
# postfix Postfix Mail Transfer Agent
#
# chkconfig: 2345 80 30
# description: Postfix is a Mail Transport Agent, which is the program
# that moves mail from one machine to another.
# processname: master
# pidfile: /var/spool/postfix/pid/master.pid
# config: /etc/postfix/main.cf
# config: /etc/postfix/master.cf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ $NETWORKING = "no" ] && exit 3
[ -x /usr/sbin/postfix ] || exit 4
[ -d /etc/postfix ] || exit 5
[ -d /var/spool/postfix ] || exit 6
RETVAL=0
prog="postfix"
start() {
# Start daemons.
echo -n $"Starting postfix: "
/usr/bin/newaliases >/dev/null 2>&1
/usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure $"$prog start"
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/postfix
echo
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down postfix: "
/usr/sbin/postfix stop 2>/dev/null 1>&2 && success || failure $"$prog stop"
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/postfix
echo
return $RETVAL
}
reload() {
echo -n $"Reloading postfix: "
/usr/sbin/postfix reload 2>/dev/null 1>&2 && success || failure $"$prog reload"
RETVAL=$?
echo
return $RETVAL
}
abort() {
/usr/sbin/postfix abort 2>/dev/null 1>&2 && success || failure $"$prog abort"
return $?
}
flush() {
/usr/sbin/postfix flush 2>/dev/null 1>&2 && success || failure $"$prog flush"
return $?
}
check() {
/usr/sbin/postfix check 2>/dev/null 1>&2 && success || failure $"$prog check"
return $?
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
abort)
abort
;;
flush)
flush
;;
check)
check
;;
status)
status master
;;
condrestart)
[ -f /var/lock/subsys/postfix ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart}"
exit 1
esac
exit $?
[root@mail postfix]# chmod +x /etc/init.d/postfix
[root@mail postfix]# chkconfig --add postfix
[root@mail postfix]# chkconfig postfix on
[root@mail postfix]# chown postfix.postfix -R /var/lib/postfix/
[root@mail postfix]# chown postfix.postfix /var/spool/ -R
#wget http://jaist.dl.sourceforge.net/project/courier/authlib/0.70.0/courier-authlib-0.70.0.tar.bz2
# tar xf courier-authlib-0.70.0.tar.bz2
# cd courier-authlib-0.70.0
# ./configure
--prefix=/usr/local/courier-authlib
--sysconfdir=/etc
--without-authpam
--without-authshadow
--without-authvchkpw
--without-authpgsql
--with-authmysql
--with-mysql-libs=/usr/lib64/mysql
--with-mysql-includes=/usr/include/mysql
--with-redhat
--with-authmysqlrc=/etc/authmysqlrc
--with-authdaemonrc=/etc/authdaemonrc
--with-mailuser=postfix
# make && make install
# chmod 755 /usr/local/courier-authlib/var/spool/authdaemon
# cp /etc/authdaemonrc.dist /etc/authdaemonrc
# cp /etc/authmysqlrc.dist /etc/authmysqlrc
# vim /etc/authdaemonrc
authmodulelist="authmysql" # 会支持很多认证方式,只保留authmysql即可。
authmodulelistorig="authmysql"
daemons=10 # 开户认证的进程数,也可以不用改,根据自己的情况。
[root@mail ~]# vim /etc/authmysqlrc
[root@mail ~]# cat /etc/authmysqlrc|grep -v "^#"|grep -v "^$"
MYSQL_SERVER localhost
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfix
MYSQL_PORT 3306
MYSQL_OPT 0
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
DEFAULT_DOMAIN ebarafoodssh.cn
MYSQL_UID_FIELD 2525
MYSQL_GID_FIELD 2525
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat(/var/mailbox/,homedir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat(/var/mailbox/,homedir)
# cd /home/soft/courier-authlib-0.66.1/
# cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib
# chmod 755 /etc/init.d/courier-authlib
# chkconfig --add courier-authlib
# chkconfig --level 2345 courier-authlib on
# echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf.d/courier-authlib.conf
# ldconfig -v
# service courier-authlib start (启动服务)
# chkconfig courier-authlib on
# mkdir –p /var/mailbox
# chown -R postfix /var/mailbox
# vi /usr/lib64/sasl2/smtpd.conf
pwcheck_method: authdaemond
log_level: 3
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket
# vim /etc/postfix/main.cf
########################Virtual Mailbox Settings########################
virtual_mailbox_base = /var/mailbox
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:2525
virtual_gid_maps = static:2525
virtual_transport = virtual
maildrop_destination_recipient_limit = 10
maildrop_destination_concurrency_limit = 10
##########################QUOTA Settings########################
message_size_limit = 14336000
virtual_mailbox_limit = 20971520
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the users maildir has overdrawn his diskspace quota, please Tidy your mailbox and try again later.
virtual_overquota_bounce = yes
# vim /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp
disable_plaintext_auth = no
# vim /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:/var/mailbox/%d/%n/Maildir
# cp /etc/dovecot/conf.d/auth-sql.conf.ext /etc/dovecot/conf.d/auth-sql.conf
# vim /etc/dovecot/conf.d/auth-sql.conf
passdb {
driver = sql
args = /etc/dovecot-mysql.conf
}
userdb {
driver = sql
args = /etc/dovecot-mysql.conf
}
# vim /etc/dovecot-mysql.conf
driver = mysql
connect = host=localhost dbname=postfix user=postfix password=postfix
default_pass_scheme = CRYPT
password_query = SELECT username AS user,password AS password FROM mailbox WHERE username = %u
user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox WHERE username = %u
# service dovecot start
# chkconfig dovecot on
# tar zxvf extmail-1.2.tar.gz
# mkdir -p /var/www/extsuite
# mv extmail-1.2 /var/www/extsuite/extmail
# cp /var/www/extsuite/extmail/webmail.cf.default /var/www/extsuite/extmail/webmail.cf
# vim /var/www/extsuite/extmail/webmail.cf
部分修改选项的说明:
SYS_SESS_DIR = /tmp/extmail 用户的session保存的位置。
SYS_UPLOAD_TMPDIR = /tmp/extmail/upload
SYS_USER_LANG = en_US
SYS_USER_LANG = zh_CN
SYS_MIN_PASS_LEN = 7 最短密码长度
SYS_MAILDIR_BASE = /home/domains
SYS_MAILDIR_BASE = /var/mailbox
SYS_MYSQL_USER = db_user
SYS_MYSQL_PASS = db_pass
SYS_MYSQL_USER = postfix
SYS_MYSQL_PASS = postfix
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
SYS_MYSQL_HOST = localhost
SYS_MYSQL_TABLE = mailbox
SYS_MYSQL_ATTR_USERNAME = username
SYS_MYSQL_ATTR_DOMAIN = domain
SYS_MYSQL_ATTR_PASSWD = password
SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket
SYS_AUTHLIB_SOCKET = /usr/local/courier-authlib/var/spool/authdaemon/socket
# mkdir -p /tmp/extmail/upload
# chown postfix.postfix -R /tmp/extmail/
# vim /etc/httpd/conf/httpd.conf
User postfix
Group postfix
#LoadModule suexec_module modules/mod_suexec.so # 注释掉,关闭suexec
#DocumentRoot "/var/www/html" # 关闭中心主机,开户虚拟主机
# vim /etc/httpd/conf.d/extmail.conf
80 >
ServerName mail.ebarafoodssh.cn
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
# service httpd restart
# chkconfig httpd on
# tar zxvf extman-1.1.tar.gz
# mv extman-1.1 /var/www/extsuite/extman
# cp /var/www/extsuite/extman/webman.cf.default /var/www/extsuite/extman/webman.cf
# vim /var/www/extsuite/extman/webman.cf
SYS_MAILDIR_BASE = /home/domains
SYS_MAILDIR_BASE = /var/mailbox
SYS_DEFAULT_UID = 1000
SYS_DEFAULT_GID = 1000
SYS_DEFAULT_UID = 2525
SYS_DEFAULT_GID = 2525
SYS_MYSQL_USER = webman
SYS_MYSQL_PASS = webman
SYS_MYSQL_USER = postfix
SYS_MYSQL_PASS = postfix
SYS_MYSQL_DB = postfix
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
# chown -R postfix.postfix /var/www/extsuite/extman/cgi/
# chown -R postfix.postfix /var/www/extsuite/extmail/cgi/
# cd /var/www/extsuite/extman/docs
# sed -i "s/extmail/postfix/" mysql_virtual_*
# service mysqld start
# p
# mysql -u root -p < extmail.sql
# mysql -u root -p < init.sql
# cp mysql_virtual_* /etc/postfix/
# mysql -u root -p
mysql> GRANT all privileges on postfix.* TO postfix@localhost IDENTIFIED BY postfix;
mysql> GRANT all privileges on postfix.* TO postfix@% IDENTIFIED BY postfix;
# mkdir /tmp/extman
# chown postfix.postfix -R /tmp/extman/
admin
extmail*123*
# yum install cairo-devel libxml2-devel pango-devel pango
libpng-devel freetype freetype-devel libart_lgpl-devel
rrdtool* perl-Time-HiRes.x86_64 perl-File-Tail(见下一步)
yum -y install perl-ExtUtils-MakeMaker
tar -zxvf File-Tail-1.2.tar.gz
cd File-Tail-1.2
perl Makefile.PL
make test
make install
# cp -r /var/www/extsuite/extman/addon/mailgraph_ext/ /usr/local/mailgraph_ext/
# /usr/local/mailgraph_ext/mailgraph-init start
# /var/www/extsuite/extman/daemon/cmdserver -daemon
# echo "/usr/local/mailgraph_ext/mailgraph-init start" >> /etc/rc.d/rc.local
# echo "/var/www/extsuite/extman/daemon/cmdserver -v -d" >> /etc/rc.d/rc.local
# vim /etc/logrotate.d/maillog
/var/log/maillog {
daily
missingok
compress
rotate 365
nocompress
copytruncate
notifempty
create 0600 root root
olddir /data/maillog/
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
perl -e use MIME::Base64; print encode_base64("test@ebarafood.com")
perl -e use MIME::Base64; print encode_base64(" Abcd1234")
telnet mail.zzc.com 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is ^].
220 Welcome to our mail.zzc.com ESMTP,Warning: Version not Available!
ehlo mail.zzc.com
250-mail.zzc.com
250-PIPELINING
250-SIZE 14336000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth login
334 VXNlcm5hbWU6
emhvdXp1bmNoaUB6emMuY29t
334 UGFzc3dvcmQ6
MTIzcXdlIQ==
235 2.7.0 Authentication successful (提示成功)
# ln -sv /usr/local/courier-authlib/bin/courierauthconfig /usr/bin
# ln -sv /usr/local/courier-authlib/include/* /usr/include
# tar jxvf pcre-7.3.tar.bz2
# cd pcre-7.3
# ./configure
# make
# make check
# make install
# tar jxvf maildrop-2.0.2.tar.bz2
# cd maildrop-2.0.2
# ./configure --enable-sendmail=/usr/sbin/sendmail --enable-trusted-users=root vuser --enable-syslog=1 --enable-maildirquota --enable-maildrop-uid=1000 --enable-maildrop-gid=1000 --with-trashquota --with-dirsync
# make
# make install
# maildrop -v
maildrop 2.0.2 Copyright 1998-2005 Double Precision, Inc.
GDBM extensions enabled.
Courier Authentication Library extension enabled.
Maildir quota extension enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.
# vi /etc/maildroprc
logfile "/var/log/maildrop.log"
# touch /var/log/maildrop.log
# chown vuser.vgroup /var/log/maildrop.log
# vi /etc/postfix/master.cf
maildrop unix - n n - - pipe
flags=DRhu user=vuser argv=/usr/local/bin/maildrop -d ${recipient}
# echo "/usr/sbin/postfix start">>/etc/rc.local
Undefined subroutine &Ext::Utils::sort2name called at
/var/www/extsuite/extmail/libs/Ext/App/Folders.pm line 387.
[root@node1 Ext]# cd /var/www/extsuite/extmail/libs/Ext
[root@node1 Ext]# cp Utils.pm /var/www/extsuite/extman/libs/
[root@node1 Ext]# cd /var/www/extsuite/extman/libs/Ext
[root@node1 Ext]# mv Utils.pm ManUtils.pm
[root@node1 Ext]# /var/www/extsuite/extmail/dispatch-init stop
[root@node1 Ext]# /var/www/extsuite/extmail/dispatch-init start
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/129437.html
摘要:打包工具是众多的开发工具之一,下面千锋重庆的小编来进行打包工具的介绍打包工具的介绍开源是一个安装程序制作工具,能够制作一些简单的安装程序。是全球领先的安装开发解决方案。通过上述介绍相信大家对打包工具已经有所了解 Java打包工具是众多的Java开发工具之一,下面千锋重庆Java的小编来进行Java打包工具的介绍:Java打...
摘要:安装包老是失败,今天发现一个更好的包安装工具,可以用这个来管理我们的包。是最近发布的一款依赖包安装工具。在官方介绍里有这么一句话关键意思就是,快速安全可靠。如同声称,快速,可靠,安全。原文地址的安装与使用详细介绍 npm安装包老是失败,今天发现一个更好的包安装工具Yarn,可以用这个来管理我们的包。不知道大家有没有觉察到Facebook近年大招频出。Yarn是Facebook最近发布的...
摘要:相关链接官方文档安装推荐使用安装,命令如下运行完毕之后即可完成的安装。上一篇文章网络爬虫实战数据库的安装下一篇文章网络爬虫实战库的安装 上一篇文章:Python3网络爬虫实战---4、数据库的安装:MySQL、MongoDB、Redis下一篇文章:Python3网络爬虫实战---6、Web库的安装:Flask、Tornado 在前面一节我们介绍了几个数据库的安装方式,但这仅仅是用来存...
摘要:介绍说明的包管理器,用于插件管理包括安装卸载管理依赖等使用安装插件命令提示符执行插件名称。总结安装新建文件全局和本地安装安装插件新建文件通过命令提示符运行任务。 showImg(https://segmentfault.com/img/remote/1460000010873466); 前言 众所周知目前比较火的工具就是gulp和webpack,但webpack和gulp却有所不同,本...
阅读 1247·2023-01-11 13:20
阅读 1555·2023-01-11 13:20
阅读 1008·2023-01-11 13:20
阅读 1675·2023-01-11 13:20
阅读 3968·2023-01-11 13:20
阅读 2510·2023-01-11 13:20
阅读 1305·2023-01-11 13:20
阅读 3474·2023-01-11 13:20