|
DovecotによるSASL化
概要: † メールアカウントのパスワードとシステムアカウントのパスワードを別々に設定できるようにします。メールアカウントのパスワードが外部に漏れてもシステムアカウントとしてシステムにアクセスできないのでセキュリティーが向上します。PostfixとDovecotでパスワードを一元管理するためにDovecotのSMTP-Auth機能をPostfixとDovecotで使用するように設定します。 前提: †1. saslauthdの停止(起動していた場合) †# /etc/rc.d/init.d/saslauthd stop ← saslauthd停止 saslauthd を停止中: [ OK ] # chkconfig saslauthd off ← saslauthd自動起動設定の取消し 2.Postfix †2.1 main.cfの設定 †# vi /etc/postfix/main.cf :
(省略)
:
### SASL設定 ###
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_type = dovecot ← 追加
smtpd_sasl_path = private/auth ← 追加
:
(省略)
:
2.2 Postfix再起動 †# service postfix restart ← Postfix再起動 Stopping postfix: [ OK ] Starting postfix: [ OK ] 3.Dovecot †3.1 10-master.confの設定 †# cd /etc/dovecot/conf.d # vi 10-master.conf :
(省略)
:
service auth {
# auth_socket_path points to this userdb socket by default. It's typically
# used by dovecot-lda, doveadm, possibly imap process, etc. Its default
# permissions make it readable only by root, but you may need to relax these
# permissions. Users that have access to this socket are able to get a list
# of all usernames and get results of everyone's userdb lookups.
unix_listener auth-userdb {
#mode = 0600
#user =
#group =
}
# Postfix smtp-auth
#unix_listener /var/spool/postfix/private/auth {
# mode = 0666
#}
↓ 次のように2行を追加してコメントを外す。
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
# Auth process is run as this user.
#user = $default_internal_user
}
:
(省略)
:
3.2 10-auth.confの設定 †# cd /etc/dovecot/conf.d # vi 10-auth.conf :
(省略)
:
# Space separated list of wanted authentication mechanisms:
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey
# gss-spnego
# NOTE: See also disable_plaintext_auth setting.
auth_mechanisms = plain login
↓ 次のようにcram-md5を追加する。
auth_mechanisms = cram-md5 plain login
:
(省略)
:
# User database specifies where mails are located and what user/group IDs
# own them. For single-UID configuration use "static" userdb.
#
# <doc/wiki/UserDatabase.txt>
#!include auth-deny.conf.ext
#!include auth-master.conf.ext
!include auth-system.conf.ext
↓ コメントアウトする。
#!include auth-system.conf.ext
#!include auth-sql.conf.ext
#!include auth-ldap.conf.ext
#!include auth-passwdfile.conf.ext
↓ コメントアウトを外す。
!include auth-passwdfile.conf.ext
#!include auth-checkpassword.conf.ext
#!include auth-vpopmail.conf.ext
#!include auth-static.conf.ext
3.3 auth-passwdfile.conf.extの設定 †パスワードを設定するファイルを設定します。ここでは/etc/dovecot/passwdとしています。ファイル名は適当に設定して下さい。 # cd /etc/dovecot/conf.d # vi auth-passwdfile.conf.ext # Authentication for passwd-file users. Included from auth.conf.
#
# passwd-like file with specified location.
# <doc/wiki/AuthDatabase.PasswdFile.txt>
passdb {
driver = passwd-file
# args = scheme=CRYPT username_format=%u /etc/dovecot/users ← コメントアウトする。
args = /etc/dovecot/passwd ← 追加する。
}
userdb {
driver = passwd-file
# args = username_format=%u /etc/dovecot/users ← コメントアウトする。
args = /etc/dovecot/passwd ← 追加する。
}
3.4 アカウントのパスワードの設定 †上記auth-passwdfile.conf.extに設定したパスワードファイルにメールアカウントとパスワードを設定します。
3.5 Dovecot再起動 †# service dovecot restart ← Dovecot再起動 Stopping dovecot Imap : [ OK ] Starting dovecot Imap : [ OK ] Last-modified: 2014-03-11 (火) 02:00:03 (4268d)
|