Sun Java System Web Server 7.0 Update 3 管理员指南

配置 Solaris 加密框架

本节介绍如何配置用于 Web Server 的 Solaris 加密。

Procedure配置 Solaris 加密

  1. 使用以下命令从计算机中删除 ./sunw 目录:

    %rm -rf $HOME/.sunw

  2. 使用以下命令设置新的 PIN:

    % pktool setpin Enter new PIN:<type the pin here>

    Re-enter new PIN:<retype the pin again>

  3. 使用以下命令禁用 pkcs11_kernel.sopkcs11_softtoken.so 文件中的机制:

    #cryptoadm disable provider=/usr/lib/security/$ISA/pkcs11_kernel.so mechanism=CKM_SSL3_PRE_MASTER_KEY_GEN,CKM_SSL3_MASTER_KEY_DERIVE,CKM_SSL3_KEY AND_MAC_DERIVE,CKM_SSL3_MASTER_KEY_DERIVE_DH,CKM_SSL3_MD5_MAC,CKM_SSL3_SHA1_MAC

    #cryptoadm disable provider=/usr/lib/security/$ISA/pkcs11_softtoken.so mechanism=CKM_SSL3_PRE_MASTER_KEY_GEN,CKM_SSL3_MASTER_KEY_DERIVE,CKM_SSL3_KEY AND_MAC_DERIVE,CKM_SSL3_MASTER_KEY_DERIVE_DH,CKM_SSL3_MD5_MAC,CKM_SSL3_SHA1_MAC


    注 –

    确保禁用 pkcs11_softtoken_extra.so 文件(如果使用)中的机制。


Procedure注册 PKCS#11 库文件

  1. 键入以下命令,将 Solaris 加密框架添加到 config 目录下的网络安全服务 (Network Security Services, NSS) 中:

    $ cd <install-dir>/<instance-dir>/lib/modutil -dbdir <install-dir>/<instance-dir>/config -nocertdb -add "scf" -libfile /usr/lib/libpkcs11.so -mechanisms RSA

  2. 使用以下命令验证注册:

    $ cd <install-dir>/<instance-dir>/lib/modutil -dbdir <install-dir>/<instance-dir>/config -nocertdb -list

    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
    
       2. scf
             library name: /usr/lib/libpkcs11.so
              slots: 1 slot attached
             status: loaded
    
              slot: Sun Crypto Softtoken
             token: Sun Software PKCS#11 softtoken
    
       3. Root Certs
             library name: libnssckbi.so
              slots: There are no slots attached to this module
             status: Not loaded

    有关创建服务器证书的更多信息,请参见请求证书

    如果 NSS 数据库中存在证书,则可以使用以下 pk12util 命令导出或导入证书:

    $pk12util -o server.pk12 -d . -n <server-cert>

    $pk12util -i server.pk12 -d . -h "Sun Software PKCS#11 softtoken"


    注 –

    默认情况下,certutil/pk12util 在数据库中搜索 cert8.dbkey3.db。对于 Web Server,请添加前缀 -P,该服务器使用替代名称 https-instance-hostname-cert8.dbhttps-instance-hostname-key3.db


Procedure启用和绕过 PKCS#11 令牌

  1. 在主页中单击“配置”选项卡

  2. 在“配置”页中,单击要启用 PKCS#11 和“允许绕过”选项的配置

  3. 单击“证书”选项卡

  4. 单击“PKCS#11 令牌”子选项卡

  5. 在“常规设置”中,选中相应的复选框以启用 PKCS#11 和“允许绕过”

  6. 单击“保存”按钮

    请参见 CLI 参考 set-pkcs11-prop(1)

使用 CLI 创建自签名证书并启用 SSL

从安装目录中启动 wadm 并执行以下步骤:

$wadm --user=admin
Please enter admin-user-password>enter the administration serverpassword

$wadm>list-tokens --config=test.sun.com

internal
Sun Software PKCS#11 softtoken

$wadm>create-selfsigned-cert --config=test.sun.com --server-name=test.sun.com --nickname=MyCert 
--token="Sun Software PKCS#11 softtoken"
Please enter token-pin>enter the password

CLI201 Command 'create-selfsigned-cert' ran successfully

$wadm>set-ssl-prop --config=test.sun.com --http-listener=http-listener-1 enabled=true 
server-cert-nickname="Sun Software PKCS#11 softtoken:MyCert"
CLI201 Command 'set-ssl-prop' ran successfully

$wadm>deploy-config test.sun.com
CLI201 Command 'deploy-config' ran success

现在,启动 Administration Server。

$ cd <install-dir>/<instance-dir>/bin/startserv
Sun Java System Web Server 7.0 Update 3

Please enter the PIN for the "Sun Software PKCS#11 softtoken" token:enter the password
info: HTTP3072: http-listener-1: https://test.sun.com:2222 ready to accept requests
info: CORE3274: successful server startup