postfix配置.docx
- 文档编号:2471161
- 上传时间:2023-05-03
- 格式:DOCX
- 页数:36
- 大小:40.69KB
postfix配置.docx
《postfix配置.docx》由会员分享,可在线阅读,更多相关《postfix配置.docx(36页珍藏版)》请在冰点文库上搜索。
postfix配置
Postfix配置
测试环境:
操作系统:
centos5
软件:
postfix-2.3.3-2.el5.centos.mysql_pgsql.i386.rpm
cyrus-sasl-lib-2.1.22-4
cyrus-sasl-devel-2.1.22-4
cyrus-sasl-sql-2.1.22-4
cyrus-sasl-plain-2.1.22-4
cyrus-sasl-2.1.22-4
cyrus-sasl-md5-2.1.22-4
cyrus-sasl-ntlm-2.1.22-4
cyrus-sasl-gssapi-2.1.22-4
mysql-server-5.0.22-2.1
courier-authlib-mysql-0.57-1hzq
mysql-bench-5.0.22-2.1
libdbi-dbd-mysql-0.8.1a-1.2.2
postfix-2.3.3-2.el5.centos.mysql_pgsql
mysql-devel-5.0.22-2.1
mysql-test-5.0.22-2.1
mysql-5.0.22-2.1
mysql-connector-odbc-3.51.12-2.2
libtool-libs-1.5.6-4.EL4.1.c4.3
courier-authlib-mysql-0.57-1hzq
courier-authlib-devel-0.57-1hzq
courier-authlib-0.57-1hzq
maildrop-2.0.1-1hzq
maildrop-man-2.0.1-1hzq
mod_perl-2.0.2-6.1
perl-5.8.8-10
perl-URI-1.35-3
perl-Convert-ASN1-0.20-1.1
perl-HTML-Parser-3.55-1.fc6
perl-Net-IP-1.25-2.fc6
perl-XML-LibXML-Common-0.13-8.2.2
perl-BSD-Resource-1.28-1.fc6.1
perl-DBD-MySQL-3.0007-1.fc6
perl-LDAP-0.33-3.fc6
perl-SGMLSpm-1.03ii-16.2.1
perl-XML-Grove-0.46alpha-29.1.1
perl-Time-HiRes-1.72-1hzq
perl-Net-Server-0.93-1hzq
perl-BerkeleyDB-0.31-1.el5.rf
perl-Convert-TNEF-0.17-1hzq
perl-Compress-Zlib-1.42-1.fc6
perl-DBI-1.52-1.fc6
perl-XML-NamespaceSupport-1.09-1.2.1
perl-IO-Zlib-1.04-4.2.1
perl-Digest-SHA1-2.11-1.2.1
perl-HTML-Tagset-3.10-2.1.1
perl-libwww-perl-5.805-1.1.1
perl-libxml-perl-0.08-1.2.1
perl-Net-SSLeay-1.30-4.fc6
perl-Socket6-0.19-3.fc6
perl-Archive-Tar-1.30-1.fc6
perl-Bit-Vector-6.4-2.2.2.1
perl-Crypt-SSLeay-0.51-11.el5
perl-DateManip-5.44-1.2.1
perl-DBD-Pg-1.49-1.fc6
perl-IO-String-1.08-1.1.1
perl-Net-DNS-0.59-1.fc6
perl-NKF-2.07-1.1.fc6
perl-String-CRC32-1.4-2.fc6
perl-XML-Dumper-0.81-2.fc6
perl-XML-LibXML-1.58-5
perl-XML-Twig-3.26-1.fc6
perl-IO-Multiplex-1.08-1hzq
perl-Unix-Syslog-0.100-1hzq
perl-MailTools-1.67-1hzq
perl-Convert-BinHex-1.119-1hzq
perl-MIME-Base64-3.05-1hzq
perl-Convert-UUlib-1.051-1hzq
perl-Carp-Clan-5.3-1.2.1
perl-XML-SAX-0.14-5
perl-Digest-HMAC-1.01-15
perl-XML-Parser-2.34-6.1.2.2.1
perl-IO-Socket-SSL-1.01-1.fc6
perl-Archive-Zip-1.16-1.2.1
perl-Date-Calc-5.4-1.2.2.1
perl-IO-Socket-INET6-2.51-2.fc6
perl-Net-Telnet-3.03-5
perl-suidperl-5.8.8-10
perl-XML-Simple-2.14-4.fc6
perl-IO-stringy-2.110-1hzq
perl-TimeDate-1.16-1hzq
perl-MIME-tools-5.418-1hzq
clamav-db-0.91.2-1.el5.rf
clamd-0.91.2-1.el5.rf
clamav-0.91.2-1.el5.rf
以上都是用RPM安装
php-5.2.4.tar.bz2
courier-imap-4.2.1.tar.bz2
postfixadmin.tar.gz
httpd-2.2.4.tar.gz
squirrelmail-1.4.11.tar.gz
slockd-0.083#源码安装
安装:
首先要安装DNS。
最好通过webmin安装
接着安装postfix
rpm-ivhRPMS/postfix-2.3.3-2.el5.centos.mysql_pgsql.i386.rpm
把配置文件修改成以下内容:
Vi/etc/postfix/main.cf
broken_sasl_auth_clients=yes
command_directory=/usr/sbin
config_directory=/etc/postfix
content_filter=smtp:
[127.0.0.1]:
10024#集成amavisd-new
daemon_directory=/usr/libexec/postfix
debug_peer_level=2
html_directory=no
inet_interfaces=all
mail_name=Postfix-by
mail_owner=postfix
mailq_path=/usr/bin/mailq
manpage_directory=/usr/local/man
message_size_limit=14336000
mydomain=
myhostname=
mynetworks=192.168.10.0/24,127.0.0.0/8
myorigin=$mydomain
newaliases_path=/usr/bin/newaliases
queue_directory=/var/spool/postfix
readme_directory=no
receive_override_options=no_address_mappings#receive_override_options这里必须增加,禁止地址展开/影射,否则如果遇到别名的时候会引起冗余邮件的产生
sample_directory=/etc/postfix
sendmail_path=/usr/sbin/sendmail
setgid_group=postdrop
smtpd_banner=$myhostnameESMTP$mail_name
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,check_policy_serviceinet:
127.0.0.1:
10030
#配置postfix以使其打开对slockd的支持
smtpd_sasl_auth_enable=yes
smtpd_sasl_security_options=noanonymous
#SMTP验证
unknown_local_recipient_reject_code=550
virtual_alias_domains=
virtual_alias_maps=mysql:
/etc/postfix/mysql/mysql_virtual_alias_maps.cf
virtual_gid_maps=static:
1000#maildrop创建的组ID
virtual_mailbox_base=/home/domains/
virtual_mailbox_domains=mysql:
/etc/postfix/mysql/mysql_virtual_domains_maps.cf
virtual_mailbox_limit=20971520
virtual_mailbox_maps=mysql:
/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
#支持mysql存储虚拟用户
virtual_transport=maildrop:
virtual_uid_maps=static:
1000#maildrop创建的用户ID
创建支持虚拟用户的mysql配置文件
mkdir/etc/postfix/mysql
1、vi/etc/postfix/mysql/mysql_virtual_alias_maps.cf
user=postfix
password=postfix
hosts=localhost
dbname=postfix
table=alias
select_field=goto
where_field=address
2、vi/etc/postfix/mysql/mysql_virtual_domains_maps.cf
user=postfix
password=postfix
hosts=localhost
dbname=postfix
table=domain
select_field=description
where_field=domain
#additional_conditions=andbackupmx='0'andactive='1'
3、vi/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
user=postfix
password=postfix
hosts=localhost
dbname=postfix
table=mailbox
select_field=maildir
where_field=username
#additional_conditions=andactive='1'
4、vi/etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf
user=postfix
password=postfix
hosts=localhost
dbname=postfix
table=mailbox
select_field=quota
where_field=username
#additional_conditions=andactive='1'
/etc/init.d/postfixstart
安装Courier-Authlib
rpm-ivhlibtool-libs-1.5.6-4.EL4.1.c4.3.i386.rpm
rpm-ivhcourier-authlib-0.57-1hzq.i386.rpm
rpm-ivhcourier-authlib-devel-0.57-1hzq.i386.rpm
rpm-ivhcourier-authlib-mysql-0.57-1hzq.i386.rpm
修改配置文件:
改成如下内容
vi/etc/authlib/authmysqlrc
MYSQL_SERVERlocalhost
MYSQL_USERNAMEpostfix
MYSQL_PASSWORDpostfix
MYSQL_SOCKET/var/lib/mysql/mysql.sock
MYSQL_DATABASEpostfix
MYSQL_USER_TABLEmailbox
MYSQL_CRYPT_PWFIELDpassword
DEFAULT_DOMAIN
MYSQL_UID_FIELD'1000'
MYSQL_GID_FIELD'1000'
MYSQL_LOGIN_FIELDusername
MYSQL_HOME_FIELD'/home/domains/'
MYSQL_NAME_FIELDname
MYSQL_MAILDIR_FIELDmaildir
MYSQL_QUOTA_FIELDconcat(quota,'S')
MYSQL_WHERE_CLAUSEactive='1'
注意:
确认在这个文件中不能用空格键(包括行尾),只能用tab键。
确认只使用单引号,比如:
'/home/domains/','UID','GID'(本文为'1000')
localhost不能用单引号
确认你的/etc/hosts文件中有localhost
编译时如果支持Ipv6可能导致错误
MYSQL_GID_FIELD和MYSQL_UID_FIELD是maildrop的UID和GID,而不是MySQL的
修改authdaemonsocket目录权限
如果该目录权限不正确修改,maildrop及postfix等将无法正确获取用户的信息及密码认证:
chmod755/var/spool/authdaemon/
启动:
/etc/init.d/Courier-Authlibstart
StartingCourierauthenticationservices:
authdaemond
出现这个证明安装配置成功了
chkconfig--addcourier-authlib#开机启动
安装Courier-IMAP
Tarxjvfcourier-imap-4.2.1.tar.bz2
cdcourier-imap-4.2.1
./configure\
--prefix=/usr/local/imap\
--with-redhat\
--disable-root-check\
--enable-unicode=utf-8,iso-8859-1,gb2312,gbk,gb18030,big5\
--with-trashquota\
--with-dirsync
make
makeinstall-strip(先install-strip,如果失败,再makeinstall)
makeinstall-configure
#vi/usr/local/imap/etc/imapd
IMAPDSTART=YES
让imap自启动:
返回安装目录
cpcourier-imap.sysvinit/etc/rc.d/init.d/courier-imap
chmod755/etc/rc.d/init.d/courier-imap
chkconfig--addcourier-imap
安装maildrop
注意事项:
1.如果您需要重新编译maildrop软件包,首先必须获得其源码rpm包,其次必须先装好courier-authlib及其devel软件包,否则编译maildrop之后将无法打开authlib支持。
2.maildropRPM包安装时,会自动创建vuser用户及vgroup用户组,专门用于邮件的存储,vuser:
vgroup的uid/gid都是1000,这与一般的邮件文档中提及用postfix用户存邮件不一样。
因为postfix用户的uid一般都低于500,而Suexec模块编译时对UID/GID的要求是要大于500,因此显然用postfix用户不能满足,会导致报错。
其次,如果用maildrop作为投递(MDA),以postfix身份投递的话,postfixmta也会报错的。
rpm-ivhmaildrop-2.0.1-1hzq.i386.rpm
rpm-ivhmaildrop-man-2.0.1-1hzq.i386.rpm
它会自动创建两个用户:
vuser和vgroupID为1000
配置master.cf
为了使Postfix支持Maildrop,必须修改/etc/postfix/master.cf文件,注释掉原来的maildrop的配置内容,并改为:
maildropunix-nn--pipe
#flags=DRhuuser=vmailargv=/usr/local/bin/maildrop-d${recipient}
flags=DRhuuser=vuserargv=maildrop-w90-d${user}@${nexthop}${recipient}${user}${extension}{nexthop}
配置main.cf
由于maildrop不支持一次接收多个收件人,因此必须在main.cf里增加如下参数:
maildrop_destination_recipient_limit=1
由于maildrop没有建立及删除maildir的功能,因此由脚本实现
创建文件:
vi/usr/sbin/maildirmake.sh
#vi/usr/sbin/maildirmake.sh
#!
/bin/bash
set-e
if[!
-d/home/domains/$1]
then
mkdir/home/domains/$1
fi
chown-Rvuser:
vgroup/home/domains/$1
cd"/home/domains/$1"
/usr/local/imap/bin/maildirmake$2
chown-R1000:
89/home/domains/$1/$2
chmod-Rg=s/home/domains/$1/$2
删除文件:
vi/usr/sbin/maildirdel.sh
#vi/usr/sbin/maildirdel.sh
#!
/bin/bash
rm-rf/home/domains/$1/$2
给运行权限:
chmod755/usr/sbin/maildirmake.sh
chmod755/usr/sbin/maildirdel.sh
chmoda+w/etc/sudoers
vi/etc/sudoers
vmailALL=NOPASSWD:
/usr/sbin/maildirmake.sh,/usr/sbin/maildirdel.sh
最后重新启动postfix即可
安装apache,php
Tarxzvfhttpd-2.2.4.tar.gz
Tarxjvfphp-5.2.4.tar.bz2
Cdhttpd-2.2.4
./configure–prefix=/usr/local/apache&&make&&makeinstall
Cdphp-5.2.4
./configure–with-apxs2=/usr/local/apache/bin/apxs–with-mysql&&make&&makeinstall
安装postfixadmin.tar.gz
直接解压到htdocs的目录下,然后做如下配置:
#mvpostfixadmin-2.1.0/www/postfixadmin
更改权限,假定运行apache的用户和组为vmail
#chown-Rvuser:
vgroup/www/postfixadmin
#cd/www/postfixadmin
#chmod640*.php*.css
#cd/www/postfixadmin/admin/
#chmod640*.php.ht*
#cd/www/postfixadmin/images/
#chmod640*.png
#cd/www/postfixadmin/languages/
#chmod640*.lang
#cd/www/postfixadmin/templates/
#chmod640*.tpl
#cd/www/postfixadmin/users/
#chmod640*.php
建立mysql表
建立PostfixAdmin所需的MySQL数据库,在建立数据库之前需要修改DATABASE_MYSQL.TXT文件,其中第27行的“Postfixuser&password”应当与你安装Postfix时的MySQL用户名和密码相同,为了安全你也应当修改postfixadmin用户的密码。
#cdpostfixadmin
#mysql-uroot 由于我架上去之后,一直不能再domain_admins添加记录,所以只能手工添加,不然界面获取不到域名 在数据库里添加一条语句: insertintodomain_admins(username,domain,created)values('admin@','',NOW()); #cpconfig.inc.php.sampleconfig.inc.php #viconfig.inc.php 本例中的配置如
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- postfix 配置
文档标签
- 配置LACP
- H3Cdot1x配置
- Dell2950Raid配置
- HMC配置
- log4j配置
- SANBOOT配置BOOT配置
- DNSWB配置
- MTKGmodem配置
- ruckus7372配置
- H3CRRPP配置S5500RRPP配置
- 64Windows7IIS配置
- WebBIOS配置
- SessionFactory配置
- Axis2配置
- 07VLAN配置
- 配置SRXDyamicVPNversion2
- freenas911配置
- 配置OpenCV320ViSP301VSCommunity
- H3CTrack配置S5500Track配置
- IPFIX配置
- vlanhybrid端口配置
- 05配置LACPMyPowerS4330V10
- 手册DES3624系列配置
- 配置ESXi端口聚合
- 配置ESXi的端口聚合配置ESXi
- AN3517配置MCF5445x系列
- 各个手机配置
- ALCATEL+交换机配置手册ALCATEL交换机配置