UltraSPARC T1 プロセッサ搭載のシステム上での Sun Java System Messaging Server 6.3 および Solaris Cryptographic Framework の構成
Durga Tirunagari、2006 年 12 月
この記事では、SSL および Solaris Cryptographic Framework (SCF) で UltraSPARC T1 プロセッサの Cryptographic Accelerator を使用できるように、Sun Java System Messaging Server 6.3 を構成する方法を説明します。この処理は、SSL 用の Messaging Server の構成 (省略可能)、Solaris Cryptographic Framework (SCF) の構成、および SCF 使用のための Messaging Server の構成、という 3 つのステップからなります。
この記事で取り扱うコンポーネントの説明
ここでは、この記事で取り扱うコンポーネントを説明します。
Sun Java System Messaging Server の概要
Sun Java System Messaging Server は高性能で安全性の高いメッセージングプラットフォームです。数千人から数百万人のユーザーまでのスケーラビリティを持つ Messaging Server は、電子メールサーバーの統合や通信インフラストラクチャーの総所有コストの削減を目指す企業やサービスプロバイダに適しています。また、この Messaging Server には、ユーザー認証やセッション暗号化を使用して通信の安全性を確保する豊富なセキュリティー機能と、スパムやウィルスの防止に役立つ強力なコンテンツフィルタリング機能があります。セキュリティーはメッセージングサーバーの非常に重要な側面です。メッセージングサーバーと他の通信関連製品の詳細は、http://www.sun.com/bigadmin/hubs/comms を参照してください。
Solaris Cryptographic Framework の概要
Solaris Cryptographic Framework (SCF) には、暗号化要件に対処するための汎用的な PKCS#11 ライブラリとアルゴリズムが格納されています。PKCS#11 ライブラリは、RSA Security Inc. が策定した暗号化規格、PKCS#11 Cryptographic Token Interface (Cryptoki) に基づいて実装されています。詳細は、『Solaris Security for Developers Guide』の「Chapter 8, Introduction to the Solaris Cryptographic Framework」および参考資料を参照してください。Solaris Cryptographic Framework は、Solaris 10 オペレーティングシステムと Solaris Express リリースで利用できます。
CA 署名の証明書を取得する手順は、使用する CA に応じて異なります。たとえば、一部の商用 CA は、証明書を自動的にダウンロードするための Web サイトを提供しています。他の CA はリクエストベースで証明書を電子メールで送信します。CSR を CA に送信したあと、CA から証明書が返送されてくるのを待ってください。
# SSL configuration
#
# Enable SSL from client to MMP with this:
default:SSLEnable yes
default:SSLPorts 993
default:SSLCertNicknames Server-Cert
# Password File for SSL server keys:
default:SSLKeyPasswdFile <Messaging_Server_Root>/config/sslpassword.conf
# Where SSL session cache, secmod, cert, and key files are located:
default:SSLCacheDir <Messaging_Server_Root>/config
# Customizable SSL security module database file name:
default:SSLSecmodFile secmod.db
# Customizable SSL cert7.db and key3.db file prefixes:
default:SSLCertPrefix ""
default:SSLKeyPrefix ""
# Use SSL on this port when talking to the backend server (0 = don't use SSL)
default:SSLBacksidePort 993
default:ServiceList /opt/SUNWmsgsr/lib/ImapProxyAService@1143|1993
/opt/SUNWmsgsr/lib/PopProxyAService@1110|1995
SSL と POP を有効にするために、PopProxyAService.cfg ファイルを編集し、該当する SSL 設定のコメントを解除します。
AService.cfg ファイルを編集します。SSL と POP については、ServiceList 設定の 1110 のあとに |1995 を追加します。 For SSL and IMAP, add |1993 after 1143.
Solaris Cryptographic Framework (SCF) ソフトウェアトークンには非公開情報が含まれているため、pktool(1) コマンドを使用してトークンにパスワードを設定します。このコマンドは、アプリケーション所有者 (Messaging Server ユーザー) としてシステムにログインすることで、ユーザーのデフォルトキーストアを初期化します。
SCF ソフトウェアトークンのピンを設定する手順
pktool setpin コマンドを実行すると、$HOME/.sunw/pkcs11_softtoken/ ディレクトリ内のソフトウェアトークンデータストアが初期化されます。これらのファイルは、その内容を保護するために、所有者だけがアクセスできるように作成されます。つまり、ユーザーが妥当なデータストアにアクセスできるように、Messaging Server を実行しているのと同じ mailsrv ユーザーとして初期化を実行する必要があります。
mailsrv ユーザーになります。
su mailsrv
id コマンドを実行します。
$ id
uid=207023(mailsrv) gid=6(mail)
pktool コマンドを実行します。
$ pktool setpin
新しいパスフレーズを作成します。(パスフレーズは画面には表示されません。)
このパスフレーズを使用して、証明書と鍵のペアを SCF トークンにインポートします。
パスフレーズを再入力します。(パスフレーズは画面には表示されません。)
パスフレーズが変更されたというメッセージが表示されます。
/export/mailsrv ディレクトリに移動します。
cd /export/mailsrv
アクセス権をチェックします。
$ ls -alrR
..:
total 6
drwx------ 3 mailsrv mail 512 Nov 16 17:21 .sunw
drwxr-xr-x 4 root sys 512 Oct 31 12:31 ..
drwxrwxrwx 3 root root 512 Nov 16 17:21 .
../.sunw:
total 6
drwx------ 4 mailsrv mail 512 Nov 16 17:21 pkcs11_softtoken
drwxrwxrwx 3 root root 512 Nov 16 17:21 ..
drwx------ 3 mailsrv mail 512 Nov 16 17:21 .
../.sunw/pkcs11_softtoken:
total 10
drwx------ 2 mailsrv mail 512 Nov 16 17:21 public
drwx------ 2 mailsrv mail 512 Nov 16 17:21 private
-rw------- 1 mailsrv mail 103 Nov 16 17:21 objstore_info
drwx------ 3 mailsrv mail 512 Nov 16 17:21 ..
drwx------ 4 mailsrv mail 512 Nov 16 17:21 .
../.sunw/pkcs11_softtoken/public:
total 4
drwx------ 4 mailsrv mail 512 Nov 16 17:21 ..
drwx------ 2 mailsrv mail 512 Nov 16 17:21 .
../.sunw/pkcs11_softtoken/private:
total 4
drwx------ 4 mailsrv mail 512 Nov 16 17:21 ..
drwx------ 2 mailsrv mail 512 Nov 16 17:21 .
cryptoadm を使用して Solaris Cryptographic Framework を管理する手順
# cryptoadm list -p provider=/usr/lib/security/'$ISA'/pkcs11_softtoken.so
/usr/lib/security/$ISA/pkcs11_softtoken.so: all mechanisms are enabled,
except CKM_SSL3_SHA1_MAC,CKM_SSL3_MD5_MAC,CKM_SSL3_MASTER_KEY_DERIVE_DH,
CKM_SSL3_KEY_AND_MAC_DERIVE,CKM_SSL3_MASTER_KEY_DERIVE,
CKM_SSL3_PRE_MASTER_KEY_GEN. random is enabled.
#./modutil -dbdir ../config -nocertdb -list
Using database directory ../config...
Listing of PKCS #11 Modules
-----------------------------------------------------------
1. NSS Internal PKCS #11 Module
slots: 2 slots attached
status: loaded
slot: NSS Internal Cryptographic Services
token: NSS Generic Crypto Services
slot: NSS User Private Key and Certificate Services
token: NSS Certificate DB
デフォルトの NSS ソフトウェアトークンの内容を表示します。
sslpassword ファイルには、証明書データベースへのパスワードが保存されています。
# ./msgcert list-certs -W Messaging-Server-Root/config/sslpassword
Alias Valid from Expires on Self-signed?Issued by Issued to
Server-Cert 2006/11/15 23:02 2007/11/15 23:02 n
CN=CA,OU=test,O=authority,ST=California,C=US
CN=foobar.siroe.com,OU=comms,O=Dev,L=Santaclara,ST=California,C=us
SolCrypto-Framework 2006/11/16 00:14 2007/11/16 00:14 n
CN=CA,OU=test,O=authority,ST=California,C=US
CN=SCF,OU=comms,O=Dev,L=Santaclara,ST=California,C=us
2 certificates found
Solaris Cryptographic Framework をサービスプロバイダとして追加する手順
Messaging Server は、NSS 組み込み型ソフトウェアトークンを暗号化に使用するように構成されています。NSS 組み込み型ソフトウェアトークンでは、PKCS#11 を使用して暗号にアクセスします。Solaris Cryptographic Framework のユーザーレベル暗号化フレームワークを使用するように、Messaging Server の構成を変更することができます。その方法は簡単で、/usr/lib/libpkcs11.so ライブラリにリンクして、PKCS#11 の機能に直接アクセスするだけです。つまり、Solaris Cryptographic Framework を PKCS#11 モジュールとして登録します。
PKCS#11 ライブラリ /usr/lib/libpkcs11.so を Messaging Server ソフトウェアに登録し、Sun Metaslot というスロットを有効にします。
# ./modutil -dbdir ../config/ -nocertdb -add "Solaris Crypto Framework" -libfile
/usr/lib/libpkcs11.so -mechanisms RSA
WARNING: Performing this operation while the browser is running could cause corruption
of your security databases. If the browser is currently running,
you should exit browser before continuing this operation. Type 'q <enter>' to abort,
or <enter> to continue:
Using database directory ../config...
Module "Solaris crypto Framework" added to database.
次の手順に進みます。
Sun Metaslot スロットを有効にする手順
次の modutil コマンドを実行します。
# ./modutil -dbdir ../config/ -nocertdb -disable "Solaris Crypto Framework"
WARNING: Performing this operation while the browser is running
could cause corruption of your security databases.
If the browser is currently running,
you should exit browser before continuing this operation.
Type 'q <enter>' to abort, or <enter> to continue:
Using database directory ../config...
Slot "Sun Metaslot" disabled.
Slot "ncp/0 Crypto Accel Asym 1.0" disabled.
次の modutil コマンドを実行します。
# ./modutil -dbdir ../config/ -nocertdb -enable "Solaris Crypto Framework" -slot "Sun Metaslot"
WARNING: Performing this operation while the browser is running
could cause corruption of your security databases.
If the browser is currently running,
you should exit browser before continuing this operation.
Type 'q <enter>' to abort, or <enter> to continue:
Using database directory ../config...
Slot "Sun Metaslot" enabled.
$ ./pk12util -i /tmp/Server-Certpk12 -d ../config/ -h "Sun Metaslot"
Enter Password or Pin for "Sun Metaslot":
{ This is the same password you entered, when running pktool setpin )
Enter password for PKCS12 file:
{PKCSpassword : password used to export certificates from the Internal Software Token }
pk12util: PKCS12 IMPORT SUCCESSFUL
次の pk12util コマンドを実行します。
$ ./pk12util -i /tmp/SCFpk12 -d ../config/ -h "Sun Metaslot"
Enter Password or Pin for "Sun Metaslot":
{ This is the same password you entered, when running pktool setpin )
Enter password for PKCS12 file:
{PKCSpassword : password used to export certificates from the Internal Software Token }
pk12util: PKCS12 IMPORT SUCCESSFUL
次の手順に進みます。
証明書と鍵のペアが正常にインポートされたことを確認する手順
この手順では、証明書と鍵のペアがトークンに正常にインポートされたことを確認します。必ず mailsrv (つまり、Messaging Server ユーザー) としてログインしてください。
次の certutil コマンドを実行します。
$ ./certutil -L -d ../config/ -h "Sun Metaslot"
Enter Password or Pin for "Sun Metaslot":
( This is the same password you entered, when running pktool setpin. )
Sun Metaslot:Server-Cert u,u,u
Sun Metaslot:SolCrypto-Framework u,u,u
次の certutil コマンドを実行します。
$ ./certutil -K -d ../config/ -h "Sun Metaslot"
Enter Password or Pin for "Sun Metaslot":
( This is the same password you entered, when running pktool setpin. )
<0> Server-Cert
<1> SolCrypto-Framework
次のセクションに進んで、Messaging Server を構成します。
外部トークンを使用するように Messaging Server を構成する
このセクションでは、外部トークンを使用するようにさまざまな Messaging Server プロセスを構成する手順を説明します。
"Sun Metaslot" はパスワードによって保護されています。サーバーを起動するたびに、パスワードの入力を求められます。パスワードを毎回入力する代わりに、Messaging Server は Messaging-Server-Root/config ディレクトリにある sslpassword.conf ファイルからパスワードを読み取ります。このファイルを次のように編集します。
# cat Messaging-Server-Root/data/config/sslpassword.conf
Sun Metaslot:secret
( "secret" : This is the same password you entered, when running pktool setpin )
Messaging Server サービスを起動してデバッグする手順
ここでは、Messaging Server サービスの再起動方法、エラーの存在チェック方法、SCF 環境の動作状態の確認方法を説明します。
Messaging Server サービスを再起動します。
# Messaging-Server-Root/sbin/start-msg
Connecting to watcher ...
Launching watcher ... 27351
Starting ens server ... 27352
Starting store server .... 27353
Checking store server status .... ready
Starting imap server .... 27354
Starting pop server .... 27355
Starting http server .... 27356
Starting sched server ... 27357
Starting dispatcher server .... 27359
Starting job_controller server .... 27365