Postfix SMTP身份验证完整方案解析
出处:www.extmail.org/forum 作者:zhqfdn 时间:2007-3-14 20:02:05
实现的功能:
------------------------------------------------------------------------------------------------
来源 目的 条件
------------------------------------------------------------------------------------------------
From: 本地域 To: 任何地址 必须认证且验证用户和From:必须一致
From: 任何非本地地址 To: 本地地址 无需认证
From: 任何非本地 To: 任何地址 拒绝
------------------------------------------------------------------------------------------------
打开 main.cf (注意加粗部分的参数设置)
------------------------------------------------------------------------------------------------
###################BASE##################
myhostname=_HOSTNAME_
mydomain = _DOMAIN_
mydestination = $myhostname
local_recipient_maps =
command_directory = /usr/local/sbin
#local_transport = virtual
smtpd_banner = _DOMAIN_ ESMTP Mail System
message_size_limit = 14680064
#mailbox_size_limit = 512000000
#################MySQL################
virtual_alias_maps =mysql:/usr/local/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:125
virtual_uid_maps = static:125
#virtual_minimum_uid = 125
virtual_mailbox_base = /home/data/domains
virtual_mailbox_domains = mysql:/usr/local/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/usr/local/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_transport = virtual
################Quota################
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/usr/local/etc/postfix/mysql_virtual_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry,the user's Maildir has overdrawn his diskspace quota ,please tray again later.
virtual_overquota_bounce = yes
##############SASL####################
smtpd_sasl_auth_enable = yes
smtpd_sasl2_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unknown_sender_domain,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
reject_unauth_destination,
permit
#列出本地用户的列表,以便验证 From: 本地域 To: 本地域
smtpd_sender_login_maps =
mysql:/usr/local/etc/postfix/mysql_virtual_sender_maps.cf,
mysql:/usr/local/etc/postfix/mysql_virtual_alias_maps.cf
smtpd_reject_unlisted_sender = yes
#本地域向本地域发信也需要SMTP身份验证
smtpd_sender_restrictions =
reject_sender_login_mismatch,
reject_authenticated_sender_login_mismatch,
reject_unauthenticated_sender_login_mismatch
content_filter = smtp-amavis:[127.0.0.1]:10024
readme_directory = no
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
html_directory = no
setgid_group = maildrop
manpage_directory = /usr/local/man
daemon_directory = /usr/local/libexec/postfix
newaliases_path = /usr/local/bin/newaliases
mailq_path = /usr/local/bin/mailq
queue_directory = /var/spool/postfix
mail_owner = postfix
------------------------------------------------------------------------------------------------
通过MYSQL查询获得本地接收的邮件地址列表。
mysql:/etc/postfix/mysql_virtual_alias_user_maps.cf
mysql:/etc/postfix/mysql_virtual_user_maps.cf
------------------------------------------------------------------------------------------------
mysql_virtual_alias_maps.cf
------------------------------------------------------------------------------------------------
user = extmail
password = _PASSWD_
hosts = localhost
dbname = extmail
table = alias
select_field = goto
where_field = address
additional_conditions = AND active = '1'
------------------------------------------------------------------------------------------------
mysql_virtual_sender_maps.cf
------------------------------------------------------------------------------------------------
user = extmail
password = _PASSWD_
hosts = localhost
dbname = extmail
table = mailbox
select_field = username
where_field = username
additional_conditions = AND active = '1'
以上文章也是参考了网上的一些文章后完成的一些设置,希望对你有点帮助!