欢迎使用CSDN-markdown编辑器

来源:互联网 发布:映射网络驱动器 密码 编辑:程序博客网 时间:2024/06/01 22:19

postfix+saslauthd安装

  • 系统环境:centos6.4

安装postfix:

  • yum install postfix

配置postfix:

  • #邮箱域名
    myhostname = mail.XXX.com
  • #根域名
    mydomain = XXX.com
  • #指明发件人所在的域名
    myorigin = $mydomain
  • #指定postfix系统监听的网络接口
    inet_interfaces = all
    mynetworks_style = class
    mydestination = myhostname,localhost.mydomain, localhost,$mydomain

    relay_domains = $mydestination
    -指定你所在的网络的网络地址
    mynetworks = 192.168.1.1
    home_mailbox = Maildir/

    smtpd_banner = $myhostname ESMTP unknown

  • #服务器使用SMTP认证 ,启用sasl验证
    smtpd_sasl_auth_enable = yes

  • #指定SMTP认证的本地域名(主机名)
    smtpd_sasl_local_domain = $myhostname
    smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
    smtpd_client_restrictions = permit_sasl_authenticated
  • #容许接收不守规定的行为
    broken_sasl_auth_clients = yes
    smtpd_sasl_path = smtpd
  • #不允许匿名的方式认证
    smtpd_sasl_security_options = noanonymous
  • #从头信息查找用户名
    smtpd_sasl_authenticated_header = yes
  • #规定邮件最大r容量为15MB
    message_size_limit = 15728640

  • service postfix start 启动

  • chkconfig postfix on 开机启动

安装cyrus-sase

  • yum -y install cyrus-sasl
  • yum -y install cyrus-sasl-plain

编辑SMTP认证的配置文件 :

/usr/lib/sasl2/smtpd.conf

方式一:

saslauthd的配置方式:
编辑SMTP认证的配置文件 没有则新建
vi /usr/lib64/sasl2/smtpd.conf
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN

vi /etc/sysconfig/saslauthd
MECH=shadow
FLAGS=

方式二:

auxprop的配置方式

vi /usr/lib64/sasl2/smtpd.conf
pwcheck_method: auxprop
auxprop_plugin: sasldb
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
vi /etc/sysconfig/saslauthd
- #MECH=
FLAGS=sasldb
建议使用第二种方式

service saslauthd start 启动
chkconfig saslauthd on 开机启动
mkdir /etc/skel/Maildir 在用户模板下建立用户邮箱目录
chmod 700 /etc/skel/Maildir 设置用户邮箱目录属性为700

添加邮箱账号,只有选择auxprop的方式的时候,这里才需要设置

saslpasswd2 -c -u ‘xxx.com’ test 执行之后输入2次密码就可以了
sasldblistusers2 查看添加的用户
saslpasswd2 -d “test@xxx.com” 删除用户
- 将数据库用户改为postfix
chown postfix /etc/sasldb2
- 将数据库用户组改为postfix
chown :postfix /etc/sasldb2
chmod 640 /etc/sasldb2

Telnet 测试:

测试之前先把编码后的账号和密码记录下来:
perl -e “use MIME::Base64;print encode_base64(‘test@xxxx.com’)”生成编码后的账号
dGVzdEB0ZXN0LmNvbQ==
perl -e “use MIME::Base64;print encode_base64(‘123456’)” 生成编码后的密码
MTIzNDU2

telnet 测试

telnet 192.168.1.1. 25
auth login

0 0
原创粉丝点击