用浏览器
下产生的,我是能够使用密钥工具导入证书:
- 等级:sb1.geolearning.com
- 文件类型:DER编码二进制,单一证书
对于后人,这里是用来导入命令:
sudo keytool -import -keystore /opt/jrun4/jre/lib/security/cacerts -alias "sb1.geolearning.com (Thawte SSL CA)" -storepass changeit -noprompt -trustcacerts -file ~/Downloads/sb1.geolearning.com
没有浏览器
下面是我在做什么,这些天(在流浪供应方)。在这个脚本中,密钥库是硬编码的,因为我现在只用于Lucee;然而,密钥库的路径可以很容易地被参数化。此外,runfile
相关的代码就是这样,Vagrant不会多次运行该脚本;如果你不使用代码作为流浪者配置器,那么这些代码就是多余的。
真正与上述解决方案区别的唯一一件事是,它通过openssl s_client
(并通过sed
清除它)通过浏览器手动获取证书。
#!/usr/bin/env bash
set -e
description="Add cert to Lucee's keystore."
while :
do
case $1 in
--provisioned-dir=*)
provisioned_dir=${1#*=} # Delete everything up till "="
shift
;;
--runfile-name=*)
runfile_name=${1#*=} # Delete everything up till "="
shift
;;
--site-host-name=*)
site_host_name=${1#*=} # Delete everything up till "="
shift
;;
-*)
echo "WARN: Unknown option (ignored): $1" >&2
shift
;;
*) # no more options. Stop while loop
break
;;
esac
done
runfile="${provisioned_dir}/${runfile_name}"
if [ -f "${runfile}" ]; then
echo "${description}: Already run."
exit 0
fi
echo "add cert to keystore"
echo -n | \
openssl s_client -connect ${site_host_name}:443 \
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
> /tmp/${site_host_name}.cert
/opt/lucee/jdk/jre/bin/keytool \
-import \
-keystore /opt/lucee/lib/lucee-server/context/security/cacerts \
-alias "${site_host_name} (self-signed)" \
-storepass changeit \
-file /tmp/${site_host_name}.cert \
-noprompt \
|| true
touch "${runfile}"