時(shí)間:2015-06-28 00:00:00 來(lái)源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評(píng)論(2)
八、為postfix開(kāi)啟基于cyrus-sasl的認(rèn)證功能
使用以下命令驗(yàn)正postfix是否支持cyrus風(fēng)格的sasl認(rèn)證,如果您的輸出為以下結(jié)果,則是支持的:
# /usr/local/postfix/sbin/postconf -a
cyrus
dovecot
#vi /etc/postfix/main.cf
添加以下內(nèi)容:
############################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!
#vi /usr/local/lib/sasl2/smtpd.conf
添加如下內(nèi)容:
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
讓postfix重新加載配置文件
#/usr/local/postfix/sbin/postfix reload
九、讓postfix支持虛擬域和虛擬用戶
1、編輯/etc/postfix/main.cf,添加如下內(nèi)容:
########################Virtual Mailbox Settings########################
virtual_mailbox_base = /var/spool/mail
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 = 1
maildrop_destination_concurrency_limit = 1
##########################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 user's maildir has overdrawn his diskspace quota, please Tidy your mailbox and try again later.
virtual_overquota_bounce = yes
2、添加為支持虛擬域和虛擬用戶所用到的配置文件
編輯/etc/postfix/mysql_virtual_alias_maps.cf ,添加如下內(nèi)容:
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = alias
select_field = goto
where_field = address
#p#副標(biāo)題#e#
編輯/etc/postfix/mysql_virtual_domains_maps.cf ,添加如下內(nèi)容:
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = domain
select_field = description
where_field = domain
編輯/etc/postfix/mysql_virtual_mailbox_limit_maps.cf ,添加如下內(nèi)容:
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = quota
where_field = username
編輯/etc/postfix/mysql_virtual_mailbox_maps.cf ,添加如下內(nèi)容:
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = maildir
where_field = username
說(shuō)明:
1、這里用到的數(shù)據(jù)庫(kù)及用戶的建立可以后文中的extmail說(shuō)明部分來(lái)實(shí)現(xiàn),您可以參照那一部分來(lái)理解這里指定的數(shù)據(jù)庫(kù)及其用戶名等;
2、以上新建文件亦可以從extman安裝文件中獲得,您也可以由此不用手動(dòng)輸入;
3、虛擬用戶郵箱目錄我這里沿用了/var/spool/mail,你可以指定為別的目錄,比如常見(jiàn)到的/var/mailbox,或者/home/domains等;但如果這里做了修改,請(qǐng)?jiān)诤笪闹杏玫綍r(shí)作了相應(yīng)的修改;
十、安裝Courier authentication library
http://jaist.dl.sourceforge.net/sourceforge/courier/courier-authlib-0.59.3.tar.bz2
# tar jxvf courier-authlib-0.59.3.tar.bz2
# cd courier-authlib-0.59.3
./configure \
--prefix=/usr/local/courier-authlib \
--sysconfdir=/etc \
--without-authpam \
--without-authldap \
--without-authpwd \
--without-authshadow \
--without-authvchkpw \
--without-authpgsql \
--with-authmysql \
--with-mysql-libs=/usr/local/mysql/lib/mysql \
--with-mysql-includes=/usr/local/mysql/include/mysql \
--with-redhat \
--with-authmysqlrc=/etc/authmysqlrc \
--with-authdaemonrc=/etc/authdaemonrc \
CFLAGS="-march=i686 -O2 -fexpensive-optimizations" \
CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"
# make
# make install
# chmod 755 /usr/local/courier-authlib/var/spool/authdaemon
# cp /etc/authdaemonrc.dist /etc/authdaemonrc
# cp /etc/authmysqlrc.dist /etc/authmysqlrc
修改/etc/authdaemonrc 文件
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
#p#副標(biāo)題#e#
編輯/etc/authmysqlrc 為以下內(nèi)容,其中2525,2525 為postfix 用戶的UID和GID。
MYSQL_SERVER localhost
MYSQL_PORT 3306 (指定你的mysql監(jiān)聽(tīng)的端口,這里使用默認(rèn)的3306)
MYSQL_USERNAME extmail????? (這時(shí)為后文要用的數(shù)據(jù)庫(kù)的所有者的用戶名)
MYSQL_PASSWORD extmail? (密碼)
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD '2525'
MYSQL_GID_FIELD '2525'
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat('/var/spool/mail/',maildir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat('/var/spool/mail/',maildir)
# cp courier-authlib.sysvinit /etc/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
# ldconfig -v
# service courier-authlib start?? (啟動(dòng)服務(wù))
# netstat -antl|grep :25
tcp? 0????? 0 0.0.0.0:25???? 0.0.0.0:* LISTEN
十一、安裝Courier-IMAP-4.1.3
http://nchc.dl.sourceforge.net/sourceforge/courier/courier-imap-4.1.3.tar.bz2
# tar jxvf courier-imap-4.1.3.tar.bz2
# cd courier-imap-4.1.3
# ./configure \
--prefix=/usr/local/courier-imap \
--with-redhat \
--enable-unicode \
--disable-root-check \
--with-trashquota \
--without-ipv6 \
CPPFLAGS='-I/usr/local/ssl/include/openssl -I/usr/local/courier-authlib/include' \
LDFLAGS='-L/usr
關(guān)鍵詞標(biāo)簽:linux,postfix,郵件服
相關(guān)閱讀
熱門文章 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 Tomcat9.0如何安裝_Tomcat9.0環(huán)境變量配置方法 多種操作系統(tǒng)NTP客戶端配置 Linux操作系統(tǒng)修改IP
人氣排行 Linux下獲取CPUID、硬盤序列號(hào)與MAC地址 dmidecode命令查看內(nèi)存型號(hào) linux tc實(shí)現(xiàn)ip流量限制 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 linux下解壓rar文件 lcx.exe、nc.exe、sc.exe入侵中的使用方法 Ubuntu linux 關(guān)機(jī)、重啟、注銷 命令 查看linux服務(wù)器硬盤IO讀寫負(fù)載