閉じる

SASL認証(SMTP認証)の設定方法

この設定を行うことによって、外部にメールを送信することが出来るようになります。

[root@server1 ~]# dnf -y install cyrus-sasl ← cyrus-sasl をインストールします。


[root@server1 ~]# systemctl start saslauthd ← saslauthdを起動します。


[root@server1 ~]# systemctl enable saslauthd ← saslauthdを自動的に起動するように設定します。

[root@server1 ~]# vi /etc/sasl2/smtpd.conf ← smtpd.conf ファイルを編集します。

以下のように編集します。

#pwcheck_method: saslauthd
#pwcheck_method: auxprop
pwcheck_method: saslauthd
mech_list: plain login

[root@server1 ~]# vi /etc/sysconfig/saslauthd ← saslauthd ファイルを編集します。

以下のように編集します。

# Directory in which to place saslauthd's listening socket, pid file, and so
# on.  This directory must already exist.
SOCKETDIR=/run/saslauthd

START=yes ← 追加します。

# Mechanism to use when checking passwords.  Run "saslauthd -v" to get a list
# of which mechanism your installation was compiled with the ablity to use.
# MECH=pam
MECH=ldap ← このように編集します。
# MECH=shadow

# Additional flags to pass to saslauthd on the command line.  See saslauthd(8)
# for the list of accepted flags.
FLAGS="-r -O /etc/saslauthd.conf" ← このように編集します。
↑ ※ -r が無いと、認証エラーになってメールを送信出来ません。

[root@server1 ~]# vi /etc/saslauthd.conf ← saslauthd.conf ファイルを編集します。

ldap_servers: ldaps://server1.zoah.lan/ ← 各自のLDAPサーバー名を指定します。
ldap_search_base: ou=People,dc=zoah,dc=lan ← 各自の環境に合わせて設定して下さい。
ldap_filter: (&(mail=%u)(objectClass=posixAccount))
↑ メールアドレスをログインIDとして使用します。その為、LDAPサーバーには各々のユーザーアカウントにメールアドレスを登録する必要があります。

[root@server1 ~]# systemctl restart saslauthd ← saslauthd を再起動します。

© 2025 Linuxで自宅サーバー(ホームサーバー)-構築・設定方法- | WordPress テーマ: CrestaProject の Annina Free