postfix+sasl+dovecot
包安装postfix+sasl+dovecotdovecot:
Development tools 开发库
server platform Development 服务器端
Desktop platform Development 桌面端
Development Libraries
MySQL:
rpm:
mysql-server
mysql-devel
sasl:
cyrus-sasl-devel.x86_64
cyrus-sasl.x86_64
httpd:
openssl-devel
RHEL自身提供的rpm包
头文件:/usr/include
库文件:/lib,/usr/lib
第三方提供的rpm包:
/usr/local,/opt
/usr/include, /usr/local/include
/etc/ld.so.conf/local.conf
# yum -y install mysql-server mysql-devel
# service mysqld start
# chkconfigmysqld on
# groupadd -g 2525 postfix
# useradd -g 2525 -u 2525 -s /sbin/nologin -M postfix
# groupadd -g 2526 postdrop
# useradd -g 2526 -u 2526 -s /sbin/nologin -M postdrop
# hwclock -s
#make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -I/usr/lib64/sasl2/ -DUSE_TLS' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib64/sasl2 -lsasl2 -lssl -lcrypto'
make
make install
# vim /etc/init.d/postfix
#!/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 $?
# END
# chmod +x /etc/init.d/postfix
# chkconfig --add postfix
# chkconfig postfix on
# newaliases
# ls /etc/aliases.db
/etc/aliases.db
# vim /etc/postfix/main.cf
myhostname = mail.mylinux.com
mydomain = mylinux.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 192.168.1.0/24, 127.0.0.0/8
-----------------------------------------
# yum -y install dovecot
# vim /etc/dovecot/dovecot.conf
protocols = pop3
# service dovecot start
Starting Dovecot Imap:
# netstat -tnulp |grep 110
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 23639/dovecot
tcp 0 0 :::110 :::* LISTEN 23639/dovecot
# yum install mutt -y
mutt:邮件收发
mutt -f pop://admin@mail.mylinux.com
i返回主界面
r恢复
d删除
q退出
y发送
muut -f PROTOCOL ://username@mylinux.com@192.168.1.51到哪台主机上以哪个用户收发邮件
SASL: cyrus-sasl
saslauthd服务脚本
postfix要使用此脚本需要配置/usr/lib/sasl2/smtpd.conf
添加如下内容:
log_level: 3 (测试才用)
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
# vim /etc/sysconfig/saslauthd
MECH=shadow
# service saslauthd start
# chkconfig saslauthd on
# vim /etc/postfix/main.cf
mynetworks =127.0.0.0/8
############################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_path = smtpd
smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!
邮件服务器, 域名,admin@mylinux.com
物理服务器:
一台服务器为多个域收发邮件
mydestination = 所有域
#mydomain =需要注释掉
使用查找表
myorigin =
虚拟域:
用户别名:
用户帐号:虚拟帐号
页:
[1]