この手順では、サンプルデータを使用して、sendmail が TLS を使用できるようにする証明書を設定する方法を示します。詳細については、sendmail の version 8.13 で TLS を使用して SMTP を実行するためのサポートを参照してください。
始める前に
証明書を作成するには、次の情報を指定する必要があります。
国名
都道府県名
地域名
組織名
組織単位名
Common Name (システムの完全修飾ホスト名)。詳細は、check-hostname(1M) のマニュアルページを参照してください。
電子メールアドレス
詳細は、Oracle Solaris 11.3 でのユーザーとプロセスのセキュリティー保護 の 割り当てられている管理権利の使用を参照してください。
# svcadm disable -t network/smtp:sendmail
# cd /etc/mail # mkdir -p certs/CA # cd certs/CA # mkdir certs crl newcerts private # echo "01" > serial # cp /dev/null index.txt # cp /etc/openssl/openssl.cnf .
次のコマンド例は対話型テキストを生成します。
# openssl req -new -x509 -keyout private/cakey.pem -out cacert.pem -days 365 \ -config openssl.cnf Generating a 1024 bit RSA private key .....................................++++++ .....................................++++++ writing new private key to 'private/cakey.pem' Enter PEM pass phrase: Verifying - Enter PEM pass phrase: ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) []:US State or Province Name (full name) []:California Locality Name (eg, city) []:Menlo Park Organization Name (eg, company) [Unconfigured OpenSSL Installation]:Oracle Organizational Unit Name (eg, section) []:Solaris Common Name (eg, YOUR name) []:somehost.somedomain.example.com Email Address []:someuser@example.com
証明書要求を作成し、処理します。
新しい証明書要求を生成します。
自己署名付き証明書を作成します。
新しく作成された秘密鍵のファイル名として private/cakey.pem を割り当てます。
出力ファイルとして cacert.pem を割り当てます。
証明書を 365 日間証明します。デフォルト値は 30 です。
構成ファイルとして openssl.cnf を指定します。
例:
# cd /etc/mail/certs/CA # openssl req -nodes -new -x509 -keyout newreq.pem -out newreq.pem -days 365 \ -config openssl.cnf Generating a 1024 bit RSA private key ..............++++++ ..............++++++ writing new private key to 'newreq.pem' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) []:US State or Province Name (full name) []:California Locality Name (eg, city) []:Menlo Park Organization Name (eg, company) [Unconfigured OpenSSL Installation]:Oracle Organizational Unit Name (eg, section) []:Solaris Common Name (eg, YOUR name) []:somehost.somedomain.example.com Email Address []:someuser@example.com
このコマンドでは、手順 3c で指定した情報と同じ情報を指定する必要があります。
この例では、証明書と秘密鍵はファイル newreq.pem 内にあります。
例:
# cd /etc/mail/certs/CA # openssl x509 -x509toreq -in newreq.pem -signkey newreq.pem -out tmp.pem Getting request Private Key Generating certificate request # openssl ca -config openssl.cnf -policy policy_anything -out newcert.pem -infiles tmp.pem Using configuration from openssl.cnf Enter pass phrase for /etc/mail/certs/CA/private/cakey.pem: Check that the request matches the signature Signature ok Certificate Details: Serial Number: 1 (0x1) Validity Not Before: Jun 23 18:44:38 2005 GMT Not After : Jun 23 18:44:38 2006 GMT Subject: countryName = US stateOrProvinceName = California localityName = Menlo Park organizationName = Oracle organizationalUnitName = Solaris commonName = somehost.somedomain.example.com emailAddress = someuser@example.com X509v3 extensions: X509v3 Basic Constraints: CA:FALSE Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: 93:D4:1F:C3:36:50:C5:97:D7:5E:01:E4:E3:4B:5D:0B:1F:96:9C:E2 X509v3 Authority Key Identifier: keyid:99:47:F7:17:CF:52:2A:74:A2:C0:13:38:20:6B:F1:B3:89:84:CC:68 DirName:/C=US/ST=California/L=Menlo Park/O=Oracle/OU=Solaris/\ CN=someuser@example.com/emailAddress=someuser@example.com serial:00 Certificate is to be certified until Jun 23 18:44:38 2006 GMT (365 days) Sign the certificate? [y/n]:y 1 out of 1 certificate requests certified, commit? [y/n]y Write out database with 1 new entries Data Base Updated # rm -f tmp.pem
この例では、ファイル newreq.pem には未署名の証明書と秘密鍵が含まれています。ファイル newcert.pem には署名済みの証明書が含まれています。
証明書の情報を表示し、証明書をさまざまな形式に変換し、証明書要求に署名します。
さまざまな形式の証明書要求に署名し、CRL (Certificate Revocation List) を生成します
define(`confCACERT_PATH', `/etc/mail/certs')dnl define(`confCACERT', `/etc/mail/certs/CAcert.pem')dnl define(`confSERVER_CERT', `/etc/mail/certs/MYcert.pem')dnl define(`confSERVER_KEY', `/etc/mail/certs/MYkey.pem')dnl define(`confCLIENT_CERT', `/etc/mail/certs/MYcert.pem')dnl define(`confCLIENT_KEY', `/etc/mail/certs/MYkey.pem')dnl
詳細は、TLS を使用して SMTP を実行するための構成ファイルのオプションを参照してください。
詳細は、sendmail 構成を変更するを参照してください。
# cd /etc/mail/certs # ln -s CA/cacert.pem CAcert.pem # ln -s CA/newcert.pem MYcert.pem # ln -s CA/newreq.pem MYkey.pem
# chmod go-r MYkey.pem
# C=CAcert.pem # ln -s $C `openssl x509 -noout -hash < $C`.0
host.domain を、ほかのホストの完全指定のホスト名に置き換えます。
# C=host.domain.cert.pem # ln -s $C `openssl x509 -noout -hash < $C`.0
host.domain を、ほかのホストの完全指定のホスト名に置き換えます。
# svcadm enable network/smtp:sendmail
次に、TLS を使用したセキュアなメールの Received: ヘッダーの例を示します。
Received: from his.example.com ([IPv6:2001:db8:3c4d:15::1a2f:1a2b]) by her.example.com (8.13.4+Sun/8.13.4) with ESMTP id j2TNUB8i242496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <janepc@her.example.com>; Tue, 29 Mar 2005 15:30:11 -0800 (PST) Received: from her.example.com (her.city.example.com [192.168.0.0]) by his.example.com (8.13.4+Sun/8.13.4) with ESMTP id j2TNU7cl571102 version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <janepc@her.example.com>; Tue, 29 Mar 2005 15:30:07 -0800 (PST)
verify の値が OK である、つまり認証が成功したことに注意してください。詳細は、TLS を使用して SMTP を実行するためのマクロを参照してください。