Sun ONE Directory Server 5.2 安裝和調整指南 |
本附錄提供有關結合使用 Directory Server 與 Sun Crypto 加速板,以增強連線效能的指令,此連線使用的是基於憑證之驗證的安全通訊端階層 (SSL) 協定。
開始前
表 B-1 所涵蓋的項目,必須在嘗試使用 Sun Crypto 加速板以增強 SSL 連線效能之前完成。
請參閱「Sun ONE Server Console Server 管理指南」中有關 SSL 協定本身和 SSL 憑證的討論,以及如何結合使用協定與支援 Sun ONE Server Console 管理之 Sun ONE 伺服器的指令。
建立代表字
Directory Server 使用代表字和密碼來存取加速板上的適當密碼金鑰資料。代表字採用 user@realm 的格式,其中 user 是使用加速板形式的使用者 (密碼金鑰資料的擁有者),而 realm 是使用加速板形式的範圍 (使用者及其金鑰資料的邏輯分割區)。加速板 user 不需與系統上的使用者帳戶有任何關係。此變數只供介面卡使用。如需使用者和範圍的進一步說明,請參照加速板產品說明文件。
您可以使用系統所提供介面卡適用的 secadm(1M) 公用程式來建立代表字的使用者和範圍。加速板也允許建立多個 slots 來管理多個應用程式的 代表字。此處假設因為效能的緣故,您將主機指定給 Directory Server 並因此只使用了一個插槽 (預設值)。如需使用配備多個軟體應用程式之介面卡的詳細資訊,請參閱加速板產品說明文件。
請執行下列步驟建立代表字的使用者與範圍以存取預設的插槽。
- 啟動 secadm 公用程式。
$ CryptoPath/bin/secadm
預設的 CryptoPath 為 /opt/SUNWconn/crypto。
- 建立代表字的範圍。
secadm> create realm=dsrealm
必須以系統管理員登入
登入:super-user
密碼:
範圍 dsrealm 建立成功。
- 設定要建立使用者的範圍。
secadm> set realm=dsrealm
secadm{dsrealm}> su
系統管理員必須登入
登入:super-user
密碼:
secadm{root@dsrealm}#
- 建立使用者 nobody 為使用預設的插槽,並在重新啟動已設定 SSL 的 Directory Server 時輸入密碼。
secadm{root@dsrealm}# create user=nobody
初始密碼:password
確認密碼:password
使用者 nobody 建立成功。
secadm{root@dsrealm}# exit此時您已經建立代表字 nobody@dsrealm 的使用者和範圍,並提供重新啟動 Directory Server 時所要使用的密碼。
產生介面卡的繫結
加速板繫結必須使用您所產生的外部安全模組形式,這樣 Directory Server 才能與介面卡繫結。請執行下列步驟,使外部安全模組與可支援多個 SSL 演算法之 Directory Server 憑證資料庫之間產生繫結。
- 使用 modutil 之前,請設定 LD_LIBRARY_PATH。
$ set LD_LIBRARY_PATH=ServerRoot/lib ; export LD_LIBRARY_PATH
- 建立安全模組資料庫 (如果沒有的話)。
$ cd ServerRoot/shared/bin
$ ./modutil -create -dbdir ../../alias -dbprefix "slapd-serverID"
- 將外部安全模組加入安全模組資料庫中。
$ ./modutil -add "Crypto Mod" -dbdir ../../alias -nocertdb \
-libfile CryptoPath/lib/libpkcs11.so \
-mechanisms "RSA:DSA:RC4:DES" -dbprefix "slapd-serverID"
預設的 CryptoPath 為 /opt/SUNWconn/crypto。
- 列出安全模組以確定加入成功。
$ ./modutil -list -dbdir ../../alias -dbprefix "slapd-serverID"
您應該會看到在步驟 3 中所加入之 Crypto Mod 的項目。
- 將外部安全模組設定成 RSA、DSA、RC4 和 DES 的預設值。
$ ./modutil -default "Crypto Mod" -dbdir ../../alias \
-mechanisms "RSA:DSA:RC4:DES" -dbprefix "slapd-serverID"
這應該會成功地變更預設的安全模組。
此時,您已經產生加速板的繫結並且可以匯入憑證。
匯入憑證
在設定 SSL 之前,您必須匯入所取得的伺服器以及 CA 憑證,如表 B-1 中所述。執行下列步驟以匯入憑證。
- 匯入伺服器憑證 .p12 檔。
$ cd ServerRoot/shared/bin
$ ./pk12util -i ServerCert.p12 -d ../../alias -P "slapd-serverID" \
-h "nobody@dsrealm"
輸入 "nobody@dsrealm" 的密碼或個人識別碼:password
輸入 PKCS12 檔的密碼:password
- 匯入 CA 憑證。
$ ./certutil -A -n "Crypto CA Cert" -t CT -i CACert.txt \
-d ../../alias -P "slapd-serverID" -h "nobody@dsrealm"
- 列出與代表字相關的憑證以確定匯入成功。
$ ./certutil -L -d ../../alias -P "slapd-serverID" \
-h "nobody@dsrealm"此時您已經匯入憑證,並且可以設定 Directory Server 以聆聽 SSL 連線。
設定 SSL
利用您建立的代表字和密碼、在外部安全模組和 Directory Server 憑證資料庫之間產生的繫結以及所匯入的憑證,便可以將 Directory Server 設定為成在安全模式中啟動。執行這些步驟來設定 SSL 並在安全模式中重新啟動 Directory Server。
- 建立修改的 ssl.ldif 檔,變更與 SSL 相關的 Directory Server 組態項目。
程式碼範例 B-1    修改為使用介面卡來啟用 SSL (ssl.ldif)
dn:cn=RSA,cn=encryption,cn=config
changetype:add
objectclass:top
objectclass:nsEncryptionModule
cn:RSA
nsSSLToken:nobody@dsrealm
nsSSLPersonalitySSL:ServerCertNickname1
nsSSLActivation:on
dn:cn=encryption,cn=config
changetype:modify
replace:nsSSL3
nsSSL3:on
-
replace:nsSSLClientAuth
nsSSLClientAuth:allowed
-
replace:nsSSL3Ciphers
nsSSL3Ciphers:-rsa_null_md5,+rsa_rc4_128_md5,+rsa_rc4_40_md5,
+rsa_rc2_40_md5,+rsa_des_sha,+rsa_fips_des_sha,+rsa_3des_sha,
+rsa_fips_3des_sha,+fortezza,+fortezza_rc4_128_sha,
+fortezza_null,+tls_rsa_export1024_with_rc4_56_sha,
+tls_rsa_export1024_with_rc4_56_sha,
+tls_rsa_export1024_with_des_cbc_sha
-
replace:nsCertfile
nsCertfile:alias/slapd-serverID-cert7.db
-
replace:nsKeyFile
nsKeyFile:alias/slapd-serverID-key3.db
dn:cn=config
changetype:modify
replace:nsslapd-secureport
nsslapd-secureport:port
-
replace:nsslapd-security
nsslapd-security:on
此處的 port 是 nsslapd-secureport 的值,為 Directory Server 在安全模式中啟動後聆聽 SSL 連線的連接埠。
- 套用修改以變更 Directory Server 組態。
$ ldapmodify -p currPort -D "cn=directory manager" -w password -f ssl.ldif
其中 currPort 為 Directory Server 目前聆聽用戶端要求的連接埠號碼。
- 在安全模式中重新啟動 Directory Server。
$ ServerRoot/slapd-serverID/restart-slapd
輸入 nobody@dsrealm 的個人識別碼:password
此處的 password 為建立代表字 nobody@dsrealm 時提供給 nobody 的使用者密碼。
此時,Directory Server 透過您指定的連接埠聆聽 SSL 流量。您可以設定 Sun ONE Administration Server 和用戶端應用程式以透過該連接埠存取有 SSL 機制的 Directory Server。詳細資料請參閱「Sun ONE Directory Server 管理指南」。