mailx: nss-config-dir=/etc/pki/nssdb/: そのファイルやディレクトリはありません。

mailx: nss-config-dir=/etc/pki/nssdb/: そのファイルやディレクトリはありません。

mailx以下を使用して電子メールを送信します。リモートSMTPサーバー(私の場合はoffice365 SMTPサーバー)。

これはコマンドです:

# echo "THis is the Body of the email"  | mailx -v -s "This is email subject" -S smtp-use-starttls -S ssl-verify=ignore  -S smtp-auth=login -S smtp=smtp://smtp.office365.com:587 -S [email protected] -S [email protected] -S smtp-auth-password=user_password [email protected] -S nss-config-dir="/etc/pki/nssdb/"

次のエラーで失敗します。

nss-config-dir=/etc/pki/nssdb/: No such file or directory
"/root/dead.letter" 11/339
Resolving host smtp.office365.com . . . done.
Connecting to 132.245.80.146 . . . connected.
220 BY2PR02CA0047.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 5 Nov 2014 10:08:22 +0000
>>> EHLO ip-10-0-1-10.us-west-2.compute.internal
250-BY2PR02CA0047.outlook.office365.com Hello [54.201.139.35]
250-SIZE 78643200
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250 CHUNKING
>>> STARTTLS
220 2.0.0 SMTP server ready
Missing "nss-config-dir" variable.
"/root/dead.letter" 11/339
. . . message not sent.

だから本当のエラーはnss-config-dir=/etc/pki/nssdb/: No such file or directory

nss-config-dirこれで、次の必須証明書とキーを含む素晴らしいディレクトリが作成されました。

# ls -ld /etc/pki/nssdb/
drwxr-xr-x. 2 root root 4096 Aug 13  2013 /etc/pki/nssdb/

# ls -ltr /etc/pki/nssdb/
total 124
-rw-r--r--. 1 root root 65536 Jan 12  2010 cert8.db
-rw-r--r--. 1 root root 16384 Jan 12  2010 secmod.db
-rw-r--r--. 1 root root  9216 Jan 12  2010 cert9.db
-rw-r--r--. 1 root root 11264 Jan 12  2010 key4.db
-rw-r--r--. 1 root root 16384 Jan 12  2010 key3.db
-rw-r--r--. 1 root root   451 Jan  9  2013 pkcs11.txt

nss-config-dirに関する情報は次のとおりですman mailx

      A  directory  that contains the files certN.db to retrieve certificates, keyN.db to retrieve private keys, and secmod.db, where N is a digit.
      These are usually taken from Mozilla installations, so an appropriate value might be  ‘~/.mozilla/firefox/default.clm’.   Mailx  opens  these
      files  read-only  and  does  not  modify  them.   However,  if the files are modified by Mozilla while mailx is running, it will print a ‘Bad
      database’ message.  It may be necessary to create copies of these files that are exclusively used by mailx then.  Only applicable  if  S/MIME
      and SSL/TLS support is built using Network Security Services (NSS).

私にもSElinux障害があります:

# sestatus
SELinux status:                 disabled

質問:

mailxコマンドが言う理由は何ですか?nss-config-dir=/etc/pki/nssdb/: No such file or directory必要なディレクトリとキー/証明書ファイルが必要なのはなぜですか?

私の環境情報は次のとおりです。

# uname -a
Linux ip-10-0-1-10.us-west-2.compute.internal 2.6.32-358.14.1.el6.x86_64 #1 SMP Mon Jun 17 15:54:20 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux

# lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 6.4 (Santiago)
Release:        6.4
Codename:       Santiago

# rpm -qa | grep mailx
mailx-12.4-6.el6.x86_64

ベストアンサー1

失敗の根本原因は-S nss-config-dir="/etc/pki/nssdb/"設定を添付したためであることを示唆しています。後ろに受信者の配送先住所なので、ファイルベースの配送先とみなされます。

strace答えに提供された出力でこれを確認できます。

stat("nss-config-dir=/etc/pki/nssdb/", 0x7fff7073a310) = -1 ENOENT (No such file or directory)

ディレクトリではなくstatファイル名にアクセスしようとしています。nss-config-dir=/etc/pki/nssdb//etc/pki/nssdb/

以下のように、リストの最後に受信者アドレスを入力してください。

echo "This is the body of the email" |
mailx -v -s "This is email subject" \
    -S smtp-use-starttls \
    -S ssl-verify=ignore \
    -S smtp-auth=login \
    -S smtp=smtp://smtp.office365.com:587 \
    -S [email protected] \
    -S [email protected] \
    -S smtp-auth-password=user_password \
    -S nss-config-dir="/etc/pki/nssdb/" \
    [email protected]

おすすめ記事