当前位置: 首页 > 知识库问答 >
问题:

使用certbot安装Glassfish ssl

郎星汉
2023-03-14

我是新来的玻璃鱼和SSL。我使用ubuntu 14.04服务器和下载certbot。由于certbot自动化不支持glassfish服务器,我安装了certbot自动独立,并获得了我的新证书文件(cert1.pemchain1.pemfullchain1.pemprivkey1.pem)。我在网上看到了一些关于在glassfish上安装ssl的教程,但没有与certbot. pem证书相关的内容。有没有一个好的教程或说明安装glassfish ssl与生成lets加密(. pem)证书,我可以遵循。

提前谢谢

共有2个答案

贲铭
2023-03-14

下面是一个关于Let's Encrypt、Glassfish和AWS EC2的好教程。

要突出显示关键点(如果中的链接不再有效):

它遵循他们网站上描述的certbot文档,直到

certbot certonly --manual -d example.com

然后是w.r.t.玻璃鱼的重要部分

Glassfish有一个名为keystore.jks的文件,您需要在其中添加以前创建的证书和密钥。文件应位于:

<AS_HOME>/domains/domain1/config/keystore.jks

它的默认密码是“changeit”

将两个文件添加到keystore是一个两步过程:将目录更改为glassfish配置目录

cd <AS_HOME>/domains/domain1/config/

从2个文件创建密钥库

创建一个。包含完整链和私钥的pkcs12文件

openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out pkcs.p12 -name letsencryptcrt

您将为此文件设置一个密码,您需要在下一步(STORE_PASS)指定该密码。

将PKCS12转换为密钥库

  keytool -importkeystore -deststorepass PASSWORD_STORE -destkeypass PASSWORD_KEYPASS -destkeystore letsencrypt.jks -srckeystore pkcs.p12 -srcstoretype PKCS12 -srcstorepass STORE_PASS -alias letsencryptcrt

我建议将所有这些密码(PASSWORD_STORE、PASSWORD_KEYPASS和STORE_PASS)设置为与原始密钥库相同。jks的密码,因为在下一点上,源密钥库和目标密钥库的密码必须相同。

将创建的密钥库导入Glassfish的密钥库

keytool -importkeystore -srckeystore letsencrypt.jks -destkeystore keystore.jks

当然,在运行所有这些命令时,考虑到当前目录,确保所有引用文件的路径正确。

现在一切都设置好了,只需登录Glassfish管理控制台并设置适当的HTTP侦听器。

Glassfish有3个预定义的HTTP侦听器

配置

http-listener-2是用于HTTPS的。需要进行以下两项设置:

Set the port to 443 (HTTPS port)
In the SSL tab, set the Certificate NickName to letsencryptcrt and the Key Store to keystore.jks

单击“保存”,重新启动Glassfish实例,就完成了。现在,您应该可以通过https://example.com/...

江煜
2023-03-14

关于certbot glassfish问题,解决方案如下:用适当的值替换所有[##]并保存批处理文件,然后运行它

#!/bin/sh

#replace [##] with the correct value

#Alias of the certificate
NAME=[##]
#The current domain registered in letsencrypt
DOMAIN=[##]
#The keystore password, default is (changeit)
KEYSTOREPW=[##]
#Glassfish server location e.g. /home/glassfish/domains/domain1
GFDOMAIN=[##]
LIVE=/etc/letsencrypt/live/$DOMAIN

mkdir etc
cd etc

sudo openssl pkcs12 -export -in $LIVE/cert.pem -inkey $LIVE/privkey.pem -out cert_and_key.p12 -name $NAME -CAfile $LIVE/chain.pem -caname root -password pass:$KEYSTOREPW
sudo keytool -importkeystore -destkeystore keystore.jks -srckeystore cert_and_key.p12 -srcstoretype PKCS12 -alias $NAME -srcstorepass $KEYSTOREPW -deststorepass $KEYSTOREPW -destkeypass $KEYSTOREPW
sudo keytool -import -noprompt -trustcacerts -alias root -file $LIVE/chain.pem -keystore keystore.jks -srcstorepass $KEYSTOREPW -deststorepass $KEYSTOREPW -destkeypass $KEYSTOREPW

sudo openssl pkcs12 -export -in $LIVE/fullchain.pem -inkey $LIVE/privkey.pem -out pkcs.p12 -name glassfish-instance -password pass:$KEYSTOREPW
sudo keytool -importkeystore -destkeystore keystore.jks -srckeystore pkcs.p12 -srcstoretype PKCS12 -alias glassfish-instance -srcstorepass $KEYSTOREPW -deststorepass $KEYSTOREPW -destkeypass $KEYSTOREPW

sudo openssl pkcs12 -export -in $LIVE/fullchain.pem -inkey $LIVE/privkey.pem -out pkcs.p12 -name s1as -password pass:$KEYSTOREPW
sudo keytool -importkeystore -destkeystore keystore.jks -srckeystore pkcs.p12 -srcstoretype PKCS12 -alias s1as -srcstorepass $KEYSTOREPW -deststorepass $KEYSTOREPW -destkeypass $KEYSTOREPW


sudo openssl pkcs12 -export -in $LIVE/cert.pem -inkey $LIVE/privkey.pem -out cert_and_key.p12 -name $NAME -CAfile $LIVE/chain.pem -caname root -password pass:$KEYSTOREPW
sudo keytool -importkeystore -destkeystore cacerts.jks -srckeystore cert_and_key.p12 -srcstoretype PKCS12 -alias $NAME -srcstorepass $KEYSTOREPW -deststorepass $KEYSTOREPW -destkeypass $KEYSTOREPW
sudo keytool -import -noprompt -trustcacerts -alias root -file $LIVE/chain.pem -keystore cacerts.jks -srcstorepass $KEYSTOREPW -deststorepass $KEYSTOREPW -destkeypass $KEYSTOREPW

sudo openssl pkcs12 -export -in $LIVE/fullchain.pem -inkey $LIVE/privkey.pem -out pkcs.p12 -name glassfish-instance -password pass:$KEYSTOREPW
sudo keytool -importkeystore -destkeystore cacerts.jks -srckeystore pkcs.p12 -srcstoretype PKCS12 -alias glassfish-instance -srcstorepass $KEYSTOREPW -deststorepass $KEYSTOREPW -destkeypass $KEYSTOREPW

sudo openssl pkcs12 -export -in $LIVE/fullchain.pem -inkey $LIVE/privkey.pem -out pkcs.p12 -name s1as -password pass:$KEYSTOREPW
sudo keytool -importkeystore -destkeystore cacerts.jks -srckeystore pkcs.p12 -srcstoretype PKCS12 -alias s1as -srcstorepass $KEYSTOREPW -deststorepass $KEYSTOREPW -destkeypass $KEYSTOREPW


# ====== Download latest list of cacert and import it into the cacerts.jks ========== #

wget https://curl.haxx.se/ca/cacert.pem --no-check-certificate -O cacert.pem

PEM_FILE=cacert.pem
KEYSTORE=cacerts.jks
# number of certs in teh PEM file
CERTS=$(grep 'END CERTIFICATE' $PEM_FILE| wc -l)

# For every cert in the PEM file, extract it and import into the JKS keystore
# awk command: step 1, if line is in the desired cert, print the line
#              step 2, increment counter when last line of cert is found
for N in $(seq 0 $(($CERTS - 1))); do
  ALIAS="${PEM_FILE%.*}-$N"
  cat $PEM_FILE |
    awk "n==$N { print }; /END CERTIFICATE/ { n++ }" |
    keytool -noprompt -import -trustcacerts \
            -alias $ALIAS -keystore $KEYSTORE -storepass $KEYSTOREPW
done

# ==================================================================================== #


sudo keytool -list -keystore keystore.jks -storepass $KEYSTOREPW
sudo keytool -list -keystore cacerts.jks -storepass $KEYSTOREPW

if [ ! -f $GFDOMAIN/config/keystore-orig.jks ]; then
echo "Backing up original files..."
sudo cp -f $GFDOMAIN/config/keystore.jks $GFDOMAIN/config/keystore-orig.jks
sudo cp -f $GFDOMAIN/config/cacerts.jks $GFDOMAIN/config/cacerts-orig.jks
fi

echo "Updating certificates..."
sudo cp -f keystore.jks $GFDOMAIN/config/keystore.jks
sudo cp -f cacerts.jks $GFDOMAIN/config/cacerts.jks

cd ..

sudo rm -rf etc
 类似资料:
  • 上传你的代码,直接在浏览器中输入你的域名或IP(例如:www.yourdomain.com),安装程序会自动执行安装。期间系统会提醒你输入数据库信息以完成安装,安装完成后建议删除application目录下的Install。 安装完成,一定把 data/conf/db.php 文件做个备份!否则大神也救不了你! ThinkCMF目录结构: |--admin

  • 快速试用 如果想快速试用pika,目前提供了Centos5,Centos6和Debian(Ubuntu16) binary版本,可以在release页面看到,具体文件是pikaX.Y.Z_xxx_bin.tar.gz。 1. unzip file $ tar zxf pikaX.Y.Z_xxx_bin.tar.gz 2. change working directory to output not

  • 下载地址 直接官网下载就好,非常简单。 https://influxdata.com/downloads/ 安装 sudo dpkg -i influxdbName.deb 启动 sudo service influxdb start 使用 启动成功之后,我们就可以开始使用influxDB啦! 命令行 在命令行中直接输入influx,就可以管理数据库了。 root@xtutu:~# influ

  • 主要内容:Bootstrap4 CDN,创建第一个 Bootstrap 4 页面,容器类,两个 Bootstrap 4 页面,Bootstrap4 .container 实例,Bootstrap4 .container-fluid 实例我们可以通过以下两种方式来安装 Bootstrap4: 使用 Bootstrap 4 CDN。 从官网 getbootstrap.com 下载 Bootstrap 4。 Bootstrap 4 CDN 国内推荐使用 Staticfile CDN 上的库: Boot

  • 主要内容:Bootstrap5 CDN,Bootstrap5 CDN,创建第一个 Bootstrap 5 页面,容器类,两个 Bootstrap 5 页面,Bootstrap5 .container 实例,Bootstrap5 .container-fluid 实例我们可以通过以下两种方式来安装 Bootstrap5: 使用 Bootstrap5 CDN。 从官网 getbootstrap.com 下载 Bootstrap 5。 Bootstrap 5 CDN 国内推荐使用 Staticfile

  • 如果你从没使用过 VUX,请参考 快速入门。 不推荐使用 umd 方式引用组件,但是如果不得不使用,可以参考 umd 构建 直接安装或者更新: npm install vux --save 或者使用 yarn yarn add vux // 安装 yarn upgrade vux // 更新 如果你想直接从 Github 安装,请指定 v2 分支 npm install git://githu