SSL 证书自生成(OpenSSL 生成)
• 生成秘钥
openssl genrsa -out ca.key 1024
• 生成证书请求文件
openssl req -new -key ca.key -out ca.csr
• 生成CA根证书 (公钥证书)
openssl x509 -req -days 3650 -in ca.csr -signkey ca.key -out ca_public.crt
• 生成秘钥(服务器秘钥)
openssl genrsa -out server_private.key 1024
• 根据服务器私钥生成公钥文件
openssl rsa -in server_private.key -pubout -out server_public.pem
• 服务器向CA机构申请签名证书,申请前自己的证书签名请求文件
openssl req -new -key server_private.key -out server.csr
• 最终颁发一个CA签名证书服务器端
openssl x509 -req -days 3650 -CA ca_public.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt
--------------------------- 方法二(无法指定到期时间) ---------------------------
wget http://files.freeswitch.org/downloads/ssl.ca-0.1.tar.gz
tar zxfv ssl.ca-0.1.tar.gz
cd ssl.ca-0.1/
perl -i -pe 's/md5/sha256/g' *.sh
perl -i -pe 's/1024/4096/g' *.sh
./new-root-ca.sh
./new-server-cert.sh self.bkw.org
./sign-server-cert.sh self.bkw.org
cat self.bkw.org.crt self.bkw.org.key > /usr/local/freeswitch/certs/wss.pem
--------------------- 部署到Apache --------------------
SSLCertificateFile /usr/local/freeswitch/certs/wss.pem
SSLCertificateKeyFile /usr/local/freeswitch/certs/wss.pem
SSLCertificateChainFile /usr/local/freeswitch/certs/wss.pem