LoginSignup
21
35

More than 5 years have passed since last update.

SASLの設定

Last updated at Posted at 2017-02-28

前提知識

SASL

  • Simple Authentication and Security Layerの略。
  • コネクション型のプロトコルに対して認証機能を提供する。

Base64

  • 64種類の印字可能な英数字のみを用いるエンコード方式
  • MIMEによって規定されている
  • 7ビットのデータしか扱うことの出来ない電子メールにて広く利用されている
# Base64でエンコードしたユーザー名とパスワードを生成
$ printf "{user name}@{my domain}\0{user name}@{my domain}\0{password}" | openssl base64 -e

手順

cyrus-saslがインストールされているか確認

$ yum list installed | grep sasl

cyrus-sasl.x86_64                 2.1.23-13.el6_3.1                    installed
cyrus-sasl-lib.x86_64             2.1.23-13.el6_3.1                    installed

不足しているパッケージがあるので、インストールする。

$ sudo yum install cyrus-sasl-md5
$ sudo yum install cyrus-sasl-plain
$ sudo yum install cyrus-sasl-devel

$ yum list installed | grep sasl
cyrus-sasl.x86_64                 2.1.23-15.el6_6.2                    @base
cyrus-sasl-devel.x86_64           2.1.23-15.el6_6.2                    @base
cyrus-sasl-lib.x86_64             2.1.23-15.el6_6.2                    @base
cyrus-sasl-md5.x86_64             2.1.23-15.el6_6.2                    @base
cyrus-sasl-plain.x86_64           2.1.23-15.el6_6.2                    @base

SASL認証用アカウントの作成

# 新規ユーザー作成
$ sudo /usr/sbin/saslpasswd2 -c -u {my domain} {user name}
# ユーザー一覧表示
$ sudo /usr/sbin/sasldblistusers2
# パスワード変更
$ sudo /usr/sbin/saslpasswd2 -u {my domain} {user name}
# ユーザー削除
$ sudo /usr/sbin/saslpasswd2 -u {my domain} -d {user name}

postfixがSASLのDBを参照できるように設定

/etc/sasldb2のgroupをpostfixに変更する。

# 設定変更
$ sudo chgrp postfix /etc/sasldb2

# 設定後
$ ls -l /etc/sasldb2
-rw-r----- 1 root postfix 12288  2月 28 22:27 2017 /etc/sasldb2

SASL認証方式の設定

  • pwcheck_methodの設定
    • saslauthd ・・・ PAMやshadowを使用
    • auxprop ・・・ SASL独自のパスワードDBを使用
  • mech_listの設定
$ sudo vi /etc/sasl2/smtpd.conf

#pwcheck_method: saslauthd
pwcheck_method: auxprop
mech_list: plain login DIGEST-MD5 CRAM-MD5

SASL再起動

$ sudo /etc/init.d/saslauthd restart

参考資料

21
35
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
35