BigAdmin 专题文章:在使用 UltraSPARC T1 处理器的系统上配置 Sun Java System Messaging Server 6.3 和 Solaris 加密框架
在使用 UltraSPARC T1 处理器的系统上配置 Sun Java System Messaging Server 6.3 和 Solaris 加密框架
Durga Tirunagari,2006 年 12 月
本文介绍如何为 SSL 配置 Sun Java System Messaging Server 6.3 以及如何配置 Solaris 加密框架 (Solaris Cryptographic Framework, SCF),以使用 UltraSPARC T1 处理器的加密加速器。此过程分为三步:为 SSL 配置 Messaging Server(可选)、配置 Solaris 加密框架以及配置 Messaging Server 以使用 SCF。
本文中讨论的组件简介
本部分介绍本文中讨论的组件。
关于 Sun Java System Messaging Server
Sun Java System Messaging Server 是一个高性能、高安全性的消息传送平台。Messaging Server 用户从数千个到数百万个不等,它适用于对合并电子邮件服务器和降低通信基础结构的总拥有成本感兴趣的服务提供者和企业。Messaging Server 还提供了大量安全性功能,这些功能通过用户验证、会话加密以及相应内容过滤(有助于防范垃圾邮件和病毒)来帮助确保通信的完整性。安全性是 Messaging Server 非常重要的一个方面。有关 Messaging Server 和其他 Communications Suite 产品的详细信息,请参见 http://www.sun.com/bigadmin/hubs/comms。
# 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
配置 Solaris 加密框架 (Solaris Cryptographic Framework, SCF)
由于 Solaris 加密框架软件令牌包含私人信息,因此应使用 pktool(1) 命令在该令牌上设置口令。此命令可以初始化用户的缺省密钥库,方法是作为应用程序所有者(Messaging Server 用户)登录系统。
设置 SCF 软件令牌 Pin
运行 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 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 加密框架作为服务提供程序进行添加
可以将 Messaging Server 配置为使用 NSS 内置软件令牌来满足其加密需要,它使用 PKCS#11 访问加密功能。通过链接到 /usr/lib/libpkcs11.so 库获取对 PKCS#11 功能的直接访问,可以修改 Messaging Server 配置以使用 Solaris 加密框架的全新用户级加密框架。也就是说,将 Solaris 加密框架注册为 PKCS#11 模块。
在 Messaging Server 软件中注册 /usr/lib/libpkcs11.so PKCS#11 库并启用名为 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
"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