Translated message

A translation of this page exists in English.

Warning message

This translation is outdated. For the most up-to-date information, please refer to the English version.

Sendmail で SMTP AUTH を設定してテストする

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL)
  • Sendmail

Issue

  • Sendmail で SMTP AUTH を設定してテストするには

Resolution

1. SMTP AUTH を設定します。

  • yum コマンドまたは update コマンドを実行して以下のパッケージをインストールします。
        cyrus-sasl-gssapi
        cyrus-sasl-md5
        cyrus-sasl
        cyrus-sasl-plain
        cyrus-sasl-devel
  • "saslauthd" サービスを起動します。
        # service saslauthd start
        # chkconfig saslauthd on
  • /etc/mail/sendmail.mc で、以下の行のコメント化を解除します。

TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'')dnl define(`confAUTH_MECHANISMS'', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'')dnl
  • m4 コマンドを実行して、sendmail.cf ファイルを再構築します。
        # cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.orig
        # cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.orig
        # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
  • sendmail および saslauthd を再起動します。
        # service saslauthd restart
        Stopping saslauthd:                                        [  OK  ]
        Starting saslauthd:                                        [  OK  ]
        # service sendmail restart
        Shutting down sendmail:                                    [  OK  ]
        Shutting down sm-client:                                   [  OK  ]
        Starting sendmail:                                         [  OK  ]
        Starting sm-client:                                        [  OK  ]

2. SMTP AUTH のテスト

  • コマンドラインから SMTP AUTH をテストするには、有効なユーザー名およびパスワードが必要になります。以下のコマンド例では、ユーザー名 "test" とパスワード "redhat" が使用されています。

  • ユーザー名とパスワードに対して base64 エンコードの文字列を生成します。

       # echo -ne "\0test\0redhat" | base64
       AHRlc3QAcmVkaGF0
  • Telnet で上述のエンコード文字列を使用して SMTP AUTH をテストします。

# telnet 127.0.0.1 25 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is ''^]''. 220 dhcp.redhat.com ESMTP Sendmail 8.12.10/8.12.10; Wed, 24 Mar 2004 13:03:57 -0500 hello test 250-dhcp.redhat.com Hello localhost.localdomain [127.0.0.1], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 250-DSN 250-ETRN 250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN 250-DELIVERBY 250 HELP auth plain AHRlc3QAcmVkaGF0 235 2.0.0 OK Authenticated quit 221 2.0.0 dhcp.redhat.com closing connection Connection closed by foreign host.
  • 注意: RHEL 5 以降を使用している場合は pam_stack.so モジュールを削除してください。

/etc/pam.d/smtp の場合:

#%PAM-1.0
auth       include      password-auth
account    include      password-auth

Diagnostic Steps

可能性のある問題としては、postfix もインストールされた場合 (既知のバグ)、postfix は必要な pam smtp 認証ファイルを削除します。そして、そのファイルがないと sendmail の SMTP-AUTH が失敗します。以下のファイルが存在するかどうか、その中に以下のデータがあるかどうかを確認します。 (システムに postfix をインストールしており、検証時、そしてこれを認識するためのテスト時に、この問題を修正する必要がありました。)

# cp /etc/pam.d/smtp.postfix /etc/pam.d/smtp
# cat /etc/pam.d/smtp
#%PAM-1.0
auth       required     pam_stack.so service=system-auth
account    required     pam_stack.so service=system-auth
#

この問題に対応するために以下の bugzilla が作成されました。

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109313

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments