亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 12475 | 回復(fù): 8
打印 上一主題 下一主題

[Mail] RHEL5上安裝Postfix+dovecot+MailScanner+spamassassin+f-prot+SquirrelMail [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2007-08-28 16:40 |只看該作者 |倒序?yàn)g覽
作者:LEO  http://zqli.cublog.cn/

概要:

本文講述在安裝了RHEL5上,配置一臺Postfix郵件服務(wù)器的過程。實(shí)現(xiàn)虛擬域、虛擬用戶、POP3、POP3S、SMTP、SMTPS、IMAP、IMAPS、防毒、防SPAM、網(wǎng)頁郵件功能。



涉及的軟件

1.        Red Hat Enterprise Linux Server release 5 (Tikanga)

2.        MySQL

系統(tǒng)自帶

用于存儲虛擬域、虛擬用戶等信息。

3.        Apache

系統(tǒng)自帶

運(yùn)行網(wǎng)頁郵件SquirrelMail和PostfixAdmin時(shí)使用。

4.        PHP

系統(tǒng)自帶

運(yùn)行網(wǎng)頁郵件SquirrelMail和PostfixAdmin時(shí)使用。

5.        Cyrus-sasl

系統(tǒng)自帶

實(shí)現(xiàn)帶驗(yàn)證的SMTP時(shí)使用。

6.        Courier authentication library

http://download.chinaunix.net/下載

實(shí)現(xiàn)帶驗(yàn)證的SMTP時(shí)使用。

7.        Postfix

http://www.postfix.org 下載

一個(gè)MTA,雖然RHEL 4 自帶Postfix,但因?yàn)槠洳恢С諷SL及Mysql,所以我們需要自行編譯。

8.        PostfixAdmin

http://www.postfixadmin.com/ 下載

虛擬域、虛擬用戶等信息是放在Mysql內(nèi)的,安裝PostfixAdmin后,就可以用瀏覽器管理這些信息。

9.        SquirrelMail

系統(tǒng)自帶或從http://www.squirrelmail.org/download.php下載

一個(gè)基于IMAP的Webmail客戶端。

10.        Dovecot

系統(tǒng)自帶

提供POP3,POP3S,IMAP,IMAPS功能。

11.        F-prot

http://www.f-prot.com 下載,Linux workstation 版?zhèn)人使用是免費(fèi)的

提供殺毒功能,據(jù)說速度和病毒庫比開源的Clamav好。

12.        SpamAssassin

系統(tǒng)自帶

提供過濾垃圾郵件功能。

13.        MailScanner

http://www.mailscanner.info/ 下載

Postfix 是使用MailScanner 調(diào)用f-prot 與SpamAssassin,或者其它調(diào)用方法效率更好,但MailScanner配置比較直觀。



作者:LEO  http://zqli.cublog.cn/

配置過程

1.        基本軟件安裝

默認(rèn)方式安裝RHEL5,不選中任何類型服務(wù)器(如WEB服務(wù)器,開發(fā)服務(wù)器,虛擬服務(wù)器等),安裝上文中提及“系統(tǒng)自帶”的軟件。

下載其它需要的軟件。



安裝MySQL

[root@rhel5 Server]# rpm -ivh mysql-5.0.22-2.1.i386.rpm

[root@rhel5 Server]# rpm -ivh mysql-server-5.0.22-2.1.i386.rpm

[root@rhel5 Server]# chkconfig mysqld on



安裝Apache

[root@rhel5 Server]# rpm -ivh httpd-2.2.3-6.el5.i386.rpm

[root@rhel5 Server]# rpm -ivh httpd-manual-2.2.3-6.el5.i386.rpm

[root@rhel5 Server]# chkconfig httpd on



安裝PHP

[root@rhel5 Server]# rpm -ivh php-common-5.1.6-5.el5.i386.rpm

[root@rhel5 Server]# rpm -ivh php-pdo-5.1.6-5.el5.i386.rpm

[root@rhel5 Server]# rpm -ivh php-mysql-5.1.6-5.el5.i386.rpm

[root@rhel5 Server]# rpm -ivh php-cli-5.1.6-5.el5.i386.rpm

[root@rhel5 Server]# rpm -ivh php-5.1.6-5.el5.i386.rpm



安裝Cyrus-sasl

[root@rhel5 Server]# rpm –ivh cyrus-sasl-2.1.22-4.i386.rpm



安裝squirrelmail

[root@rhel5 Server]# rpm -ivh squirrelmail-1.4.8-4.el5.noarch.rpm



安裝dovecot

[root@rhel5 Server]# rpm -ivh dovecot-1.0-1.2.rc15.el5.i386.rpm



安裝spamassassin

[root@rhel5 Server]# rpm -ivh perl-IO-Zlib-1.04-4.2.1.noarch.rpm

[root@rhel5 Server]# rpm -ivh perl-Archive-Tar-1.30-1.fc6.noarch.rpm

[root@rhel5 Server]# rpm -ivh perl-Digest-SHA1-2.11-1.2.1.i386.rpm

[root@rhel5 Server]# rpm -ivh perl-Socket6-0.19-3.fc6.i386.rpm

[root@rhel5 Server]# rpm -ivh perl-IO-Socket-INET6-2.51-2.fc6.noarch.rpm

[root@rhel5 Server]# rpm -ivh perl-Net-SSLeay-1.30-4.fc6.i386.rpm

[root@rhel5 Server]# rpm -ivh perl-IO-Socket-SSL-1.01-1.fc6.noarch.rpm

[root@rhel5 Server]# rpm -ivh perl-Digest-HMAC-1.01-15.noarch.rpm

[root@rhel5 Server]# rpm -ivh perl-Net-IP-1.25-2.fc6.noarch.rpm

[root@rhel5 Server]# rpm -ivh perl-Net-DNS-0.59-1.fc6.i386.rpm

[root@rhel5 Server]# rpm -ivh spamassassin-3.1.7-4.el5.i386.rpm



[root@rhel5 ~]# tar xvf postfixadmin-2.1.0.gz

[root@rhel5 ~]# mv postfixadmin-2.1.0 /var/www/html/pa

[root@rhel5 ~]# service mysqld start

[root@rhel5 ~]# mysql -uroot < /var/www/html/pa/DATABASE_MYSQL.TXT

[root@rhel5 ~]# cp /var/www/html/pa/config.inc.php.sample /var/www/html/pa/config.inc.php

打開瀏覽器訪問 http://IP/pa,然后按提示增加兩個(gè)虛擬域名mailidc.cn 和 zqli.com,增加兩個(gè)虛擬用戶leo@mailidc.cn,zqli@zqli.com



[root@rhel5 ~]# vi /etc/httpd/conf/httpd.conf

加入以下內(nèi)容,加強(qiáng)安全性,要不每個(gè)人不經(jīng)認(rèn)證都可以用postfixadmin

<Directory "/var/www/html/pa" >

Options FollowSymLinks

DirectoryIndex index.php

AllowOverride None

AuthType Basic

authname Private

authuserfile /var/phpaccess/leo

require valid-user

Order allow,deny

Allow from all

</Directory>



注意/var/phpaccess/leo是我的密碼文件名

[root@rhel5 ~]# mkdir /var/phpaccess

[root@rhel5 ~]# touch /var/phpaccess/leo

[root@rhel5 ~]# cd /var/phpaccess/

[root@rhel5 phpaccess]# htpasswd -c leo leo  #添加用戶leo

New password:

Re-type new password:

Adding password for user leo



然后我們就可以打開網(wǎng)頁瀏覽器來訪問了

http://ip/pa

至此postfixadmin配置完畢。在這里我推薦對mysql比較了解的人更改默認(rèn)的postfix連接密碼:默認(rèn)數(shù)據(jù)名為postfix,用戶名密碼都是postfix。我們下面的配置還是用回默認(rèn)的用戶名和密碼。



作者:LEO  http://zqli.cublog.cn/

安裝postfix所依賴的包

[root@rhel5 Server]# rpm -ivh db4-devel-4.3.29-9.fc6.i386.rpm

[root@rhel5 Server]# rpm -ivh e2fsprogs-devel-1.39-8.el5.i386.rpm

[root@rhel5 Server]# rpm -ivh krb5-devel-1.5-17.i386.rpm

[root@rhel5 Server]# rpm -ivh zlib-devel-1.2.3-3.i386.rpm

[root@rhel5 Server]# rpm -ivh openssl-devel-0.9.8b-8.3.el5.i386.rpm

[root@rhel5 Server]# rpm -ivh mysql-devel-5.0.22-2.1.i386.rpm

[root@rhel5 Server]# rpm -ivh cyrus-sasl-devel-2.1.22-4.i386.rpm



編譯、配置Postfix

先刪除sendmail

[root@rhel5 ~]# rpm -e sendmail –nodeps

[root@rhel5 ~]# groupadd postfix

[root@rhel5 ~]# groupadd postdrop

[root@rhel5 ~]# useradd postfix -g postfix -c "Postfix user" -d /dev/null -s /sbin/nologin

[root@rhel5 ~]# tar zxvf postfix-2.4.3.tar.gz

[root@rhel5 postfix-2.4.3]# make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_TLS -DUSE_CYRUS_SASL -DUSE_SASL_AUTH -I/usr/include/sasl' 'AUXLIBS=-L/usr/lib/mysql -lmysqlclient -lz -lm -L/usr/lib -lssl -lcrypto -lsasl2'

[root@rhel5 postfix-2.4.3]# make

[root@rhel5 postfix-2.4.3]# make install

注:“make install”命令后的所有問題都直接敲回車鍵即可。



編輯/etc/postfix/main.cf 為以下內(nèi)容

#=====================BASE=========================

myhostname = mail.mailidc.cn

mydomain = mailidc.cn

myorigin = $mydomain

mydestination = $myhostname localhost localhost.$mydomain

mynetworks = 192.168.1.0/24 127.0.0.0/8

inet_interfaces = all

#=====================Vritual 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:501

virtual_gid_maps = static:502

virtual_transport = virtual

maildrop_destination_recipient_limit = 1

maildrop_destination_concurrency_limit = 1

#====================QUOTA========================

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 try again later.

virtual_overquota_bounce = yes

#====================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

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_sasl_security_options = noanonymous

smtpd_sasl_application_name = smtpd

smtpd_banner=$myhostname ESMTP "Version not Available"



readme_directory = no

sample_directory = /etc/postfix

sendmail_path = /usr/sbin/sendmail

html_directory = no

setgid_group = postdrop

command_directory = /usr/sbin

manpage_directory = /usr/local/man

daemon_directory = /usr/libexec/postfix

newaliases_path = /usr/bin/newaliases

mailq_path = /usr/bin/mailq

queue_directory = /var/spool/postfix

mail_owner = postfix



編輯/etc/postfix/mysql_virtual_alias_maps.cf 為以下內(nèi)容

user = postfix

password = postfix

hosts = localhost

dbname = postfix

table = alias

select_field = goto

where_field = address



編輯/etc/postfix/mysql_virtual_domains_maps.cf 為以下內(nèi)容

user = postfix

password = postfix

hosts = localhost

dbname = postfix

table = domain

select_field = description

where_field = domain



編輯/etc/postfix/mysql_virtual_mailbox_limit_maps.cf 為以下內(nèi)容

user = postfix

password = postfix

hosts = localhost

dbname = postfix

table = mailbox

select_field = quota

where_field = username



編輯/etc/postfix/mysql_virtual_mailbox_maps.cf 為以下內(nèi)容

user = postfix

password = postfix

hosts = localhost

dbname = postfix

table = mailbox

select_field = maildir

where_field = username



配置SMTP 認(rèn)證

編輯 /usr/lib/sasl2/smtpd.conf 為以下內(nèi)容

pwcheck_method: authdaemond

log_level: 3

mech_list: plain login

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket



安裝Courier authentication library

[root@rhel5 ~]# tar jxvf courier-authlib-0.58.tar.bz2

[root@rhel5 ~]# cd courier-authlib-0.58

[root@rhel5 courier-authlib-0.58]# ./configure --prefix=/usr/local/courier-authlib --without-authpam --without-authldap --without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql  --with-authmysql --with-mysql-libs=/usr/lib/mysql --with-mysql-includes=/usr/include/mysql --with-redhat  --with-authmysqlrc=/usr/local/courier-authlib/etc/authmysqlrc  --with-authdaemonrc=/usr/local/courier-authlib/etc/authdaemonrc CFLAGS="-march=i686 -O2 -fexpensive-optimizations" CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"



[root@rhel5 courier-authlib-0.58]# make

[root@rhel5 courier-authlib-0.58]# make install

[root@rhel5 courier-authlib-0.58]# chmod 755 /usr/local/courier-authlib/var/spool/authdaemon/

[root@rhel5 courier-authlib-0.58]# cp /usr/local/courier-authlib/etc/authdaemonrc.dist /usr/local/courier-authlib/etc/authdaemonrc



修改/usr/local/courier-authlib/etc/authdaemonrc 文件

authmodulelist="authmysql"

authmodulelistorig="authmysql"

daemons=10



編輯/usr/local/courier-authlib/etc/authmysqlrc 為以下內(nèi)容,其中501,502 為postfix 用戶的UID和GID。

MYSQL_SERVER         localhost

MYSQL_USERNAME       postfix

MYSQL_PASSWORD       postfix

MYSQL_SOCKET         /var/lib/mysql/mysql.sock

MYSQL_DATABASE       postfix

MYSQL_USER_TABLE     mailbox

MYSQL_CRYPT_PWFIELD   password

MYSQL_UID_FIELD       '501'

MYSQL_GID_FIELD       '502'

MYSQL_LOGIN_FIELD     username

MYSQL_HOME_FIELD     concat('/var/spool/mail/',maildir)

MYSQL_MAILDIR_FIELD   concat('/var/spool/mail/',maildir)

MYSQL_NAME_FIELD     name



[root@rhel5 courier-authlib-0.58]# cp courier-authlib.sysvinit /etc/init.d/courier-authlib

[root@rhel5 courier-authlib-0.58]# chkconfig --level 35 courier-authlib on

[root@rhel5 courier-authlib-0.58]# chmod 755 /etc/init.d/courier-authlib

[root@rhel5 courier-authlib-0.58]# service courier-authlib start



此時(shí)你已經(jīng)擁有一臺帶驗(yàn)證的SMTP 服務(wù)器,用Outlook 、Foxmail測試一下吧,用戶名采用usename@domainName.com 形式。到了這一步,可以正常地發(fā)信了。



作者:LEO  http://zqli.cublog.cn/

增加SSL功能,配置SMTPS服務(wù)

在/etc/postfix/main.cf 增加以下內(nèi)容

smtp_use_tls = yes

smtpd_use_tls = yes

smtp_tls_note_starttls_offer = yes

smtpd_tls_key_file = /etc/ssl/smtpd.pem

smtpd_tls_cert_file = /etc/ssl/smtpd.pem

smtpd_tls_CAfile = /etc/ssl/smtpd.pem

smtpd_tls_loglevel = 1

smtpd_tls_received_header = yes

smtpd_tls_session_cache_timeout = 3600s

tls_random_source = dev:/dev/urandom



生成證書

# mkdir /etc/ssl

# cd /etc/ssl

# openssl req -new -x509 -nodes -out smtpd.pem -keyout smtpd.pem -days 3650



重新啟動(dòng)postfix

# postfix reload



這時(shí)SMTPS功能應(yīng)該能正常工作了。有能力測試的網(wǎng)友們請驗(yàn)證一下這功能。



配置Dovecot,增加IMAP,IMAPS,POP3,POP3S功能

由于Dovecot 是系統(tǒng)自帶的,配置兩個(gè)文件,再生成證書就可以了。



編輯 /etc/dovecot.conf 為以下內(nèi)容

base_dir = /var/run/dovecot/

protocols = imap imaps pop3 pop3s

listen = *

ssl_disable = no

ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem

ssl_key_file = /etc/pki/dovecot/private/dovecot.pem

login_dir = /var/run/dovecot/login

default_mail_env = maildir:/var/spool/mail/%u/

auth default {

mechanisms = plain login digest-md5 cram-md5

  passdb sql {

    args = /etc/dovecot-mysql.conf

    }

  userdb sql {

    args = /etc/dovecot-mysql.conf

  }

}

first_valid_uid = 501





編輯 /etc/dovecot-mysql.conf 為以下內(nèi)容

driver = mysql

connect = host=/var/lib/mysql/mysql.sock dbname=postfix user=postfix password=postfix

default_pass_scheme = CRYPT

password_query = SELECT password FROM mailbox WHERE username = '%u'

user_query = SELECT maildir, 501 AS uid, 502 AS gid FROM mailbox WHERE username = '%u'





生成證書

[root@rhel5 ssl]# mkdir /etc/ssl/certs

[root@rhel5 ssl]# mkdir /etc/ssl/private

[root@rhel5 ssl]# cd /usr/share/doc/dovecot-1.0/examples

[root@rhel5 examples]# sh mkcert.sh



啟動(dòng)Dovecot 服務(wù)

[root@rhel5 ~]# chown postfix /var/spool/mail/

# service dovecot start

# chkconfig --level 35 dovecot on



順利的話,此時(shí)SMTP、SMTPS、POP3、POP3S已經(jīng)配置完成。

作者:LEO  http://zqli.cublog.cn/

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2008-02-16 16:14 |只看該作者
謝謝了,很詳細(xì),有時(shí)間試驗(yàn)一下。

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2008-03-11 16:58 |只看該作者
收藏,謝過!

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2008-03-11 21:49 |只看該作者
用 MySQL 的話不妨試試 Roundcubemail.

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2008-06-26 10:30 |只看該作者
樓主前面的部分寫得很好,但后面有關(guān)認(rèn)證,殺毒,過濾部分沒有具體測試,有點(diǎn)遺憾。
但是按你的配置還是可以收發(fā)郵件了,還不錯(cuò)啊,頂了,我一般不頂人的.

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2008-10-12 20:07 |只看該作者
清淅明了,建議這篇加精
我在CentOs5U2的的系統(tǒng)上安裝的, SASL2還是無法使用,只得使用源碼包安裝,其本上安裝postfix沒有一篇文單可以完全照抄完成的。

在安裝這個(gè)的時(shí)候需要注意一點(diǎn),cyrus-lib的rpm包勿必要安裝,否則會(huì)遇到postfix 的N多問題 ;pam-devel也要安裝,否則dovecot無法啟動(dòng)

論壇徽章:
8
綜合交流區(qū)版塊每周發(fā)帖之星
日期:2015-12-02 15:03:53數(shù)據(jù)庫技術(shù)版塊每日發(fā)帖之星
日期:2015-10-02 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-10-02 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-09-14 06:20:00金牛座
日期:2014-10-10 11:23:34CU十二周年紀(jì)念徽章
日期:2013-10-24 15:41:34酉雞
日期:2013-10-19 10:17:1315-16賽季CBA聯(lián)賽之北京
日期:2017-03-06 15:12:44
7 [報(bào)告]
發(fā)表于 2008-10-14 08:59 |只看該作者
謝謝分享

論壇徽章:
0
8 [報(bào)告]
發(fā)表于 2009-04-27 14:58 |只看該作者

回復(fù) #7 ruochen 的帖子

按照你的方案做了
但發(fā)現(xiàn)無法登錄,SMTP好像是沒有問題,用戶驗(yàn)證不了
不知道是何道里如:
telnet localhost 110
user user1
顯示OK
pass 111
顯示認(rèn)證出錯(cuò)

論壇徽章:
0
9 [報(bào)告]
發(fā)表于 2009-05-26 12:21 |只看該作者

回復(fù) #8 cyclonical 的帖子

我的也是
不知道你的解決了沒有?
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP