在此过程中,从头配置 Apache 2.2 Web 服务器并将 SSL 内核代理 配置为主 SSL 会话处理机制。如果客户机提供的 SSL 加密算法集合不包含 SSL 内核代理 提供的加密算法,则 Apache 2.2 Web 服务器将用作回退机制。此过程可实现Figure 3–2 中所示的复杂方案。
开始之前
您必须承担 root 角色。有关更多信息,请参见在 Oracle Solaris 11.2 中确保用户和进程的安全 中的使用所指定的管理权限。
以下命令为 SSL 内核代理生成 CSR 及关联的私钥:
# cd /root # openssl req \ > -x509 -new \ > -subj "/C=CZ/ST=Prague region/L=Prague/CN=`hostname`" \ > -newkey rsa:2048 -keyout webkey.pem \ > -out webcert.pem Generating a 2048 bit RSA private key .+++ ........+++ writing new private key to 'webkey.pem' Enter PEM pass phrase: JohnnyCashIsCool Verifying - Enter PEM pass phrase: JohnnyCashIsCool # # chmod 440 /root/webcert.pem ; chown root:webservd /root/webcert.pem
有关更多信息,请参见 openssl(5) 手册页。
# echo "RefrigeratorsAreCool" > /root/kssl.pass # chmod 440 /root/kssl.pass; chown root:webservd /root/kssl.pass
# cat /root/webcert.pem /root/webkey.pem > /root/webcombo.pem
# ksslcfg create -f pem -i /root/webcombo.pem -x 8443 -p /root/kssl.pass 443
在 /etc/apache2/2.2/httpd.conf 文件中编辑 Listen 行。
# pfedit /etc/apache2/2.2/httpd.conf ... ## Listen 80 Listen 8443
# cp /etc/apache2/2.2/samples-conf.d/ssl.conf /etc/apache2/2.2/ssl.conf
该模块为加密连接添加侦听端口 443。
# pfedit /root/put-passphrase.sh #!/usr/bin/ksh -p ## Reads SSL 内核代理 passphrase /usr/bin/cat /root/kssl.pass
# chmod 500 /root/put-passphrase.sh # chown webservd:webservd /root/put-passphrase.sh
# pfedit /etc/apache2/2.2/ssl.conf ... ## SSLPassPhraseDialog builtin SSLPassPhraseDialog exec:/root/put-passphrase.sh
ssl.conf 文件中的 SSLCertificateFile 和 SSLCertificateKeyFile 参数值包含预期的位置和名称。您可以将证书复制或链接到正确位置。
# ln -s /root/webcert.pem /etc/apache2/2.2/server.crtSSLCertificateFile default location # ln -s /root/webkey.pem /etc/apache2/2.2/server.keySSLCertificateKeyFile default location
# svcadm enable apache22
使用 openssl s_client 和 kstat 命令查看包。
# openssl s_client -cipher RC4-SHA -connect web-server:443
kstat 计数器 kssl_full_handshakes 增加 1 可确认 SSL 内核代理 已对 SSL 会话进行处理。
# kstat -m kssl -s kssl_full_handshakes
# openssl s_client -cipher CAMELLIA256-SHA -connect web-server:443
kstat 计数器 kssl_fallback_connections 增加 1 可确认包已到达,但 Apache Web 服务器已对 SSL 会话进行处理。
# kstat -m kssl -s kssl_fallback_connections
以下命令将为使用 pem 密钥格式的 SSL 内核代理创建一个服务实例:
# ksslcfg create -f pem -i cert-and-key.pem -p kssl.pass -x 8443 443