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

配置 Solaris 加密架構

本節說明如何配置用於 Web 伺服器的 Solaris 加密。

Procedure配置 Solaris 加密

  1. 使用下列指令移除機器中的 ./sunw 目錄。

    %rm -rf $HOME/.sunw

  2. 使用下列指令設定新的 pin:

    % pktool setpin Enter new PIN:<在此處鍵入 pin>

    Re-enter new PIN:<再次鍵入 pin>

  3. 使用下列指令停用 pkcs11_kernel.so pkcs11_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 加密架構增加至配置目錄中的網路安全服務 (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。請將 -P 增加為使用替代名稱 https-instance-hostname-cert8.db https-instance-hostname-key3.db 之 Web 伺服器的前綴。


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

此時,請啟動管理伺服器。

$ 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