Glassfish v4和SSL-管理员不再起作用

cot*_*ssi 4 java ssl https glassfish

我已经完成了将SSL证书添加到glassfish v4中的步骤。我已经验证了它可以通过浏览器和java swing客户端正常运行(我在客户端上使用的是Apache的http客户端库)

管理控制台不起作用!自从成功导入SSL之后,我无法再连接到管理控制台http://www.myhost.com:4848,仍然可以看到登录屏幕,一直有效的admin用户名/密码组合已停止工作。在尝试从netbeans部署Web应用程序时,我也注意到了一些问题,但是我还没有进行足够的研究来知道它是否是同样的问题。

以下是我添加ssl证书所采取的步骤。这些是直接从Glassfish v4安全指南p1-26到p1-29解除的。我确实添加了一个更改主密码的步骤,但是我应该早些做,但是我将其包括在这里。为了保护我的隐私,我在下面的步骤中也省略或更改了某些文件夹名称,但除此之外,我已经将所有这些文件夹复制到了终端应用程序之外。

有人知道管理员出了什么问题吗?需要注意的一件事-按照Glassfish的管理和安全指南,我可以ovrwrite s1as别名。您会注意到,在以下步骤中使用证书时,我使用了该别名

在此先感谢您的帮助!

第1步 -停止服务器

/usr/home/myhost                                                                                                                                                                                                                                           
110 % glassfish4/bin/asadmin stop-domain domain1
Waiting for the domain to stop .
Command stop-domain executed successfully.
Run Code Online (Sandbox Code Playgroud)

第2步 -更新主密码

/usr/home/myhost
110 % glassfish4/bin/asadmin
Use "exit" to exit and "help" for online help.
asadmin> change-master-password domain1
Enter the current master password>
Enter the new master password>
Enter the new master password again>
Command change-master-password executed successfully.
asadmin> exit
Command multimode executed successfully.
Run Code Online (Sandbox Code Playgroud)

第3步 -更改到密钥文件目录

/usr/home/myhost
111 % cd glassfish4/glassfish/domains/domain1/config/
Run Code Online (Sandbox Code Playgroud)

步骤4-从密钥库中删除s1as

/usr/home/myhost/glassfish4/glassfish/domains/domain1/config
113 % keytool -delete -alias s1as -keystore keystore.jks
Enter keystore password:
Run Code Online (Sandbox Code Playgroud)

第5步 -生成新的密钥对

/usr/home/myhost/glassfish4/glassfish/domains/domain1/config
114 % keytool -genkey -alias s1as -keyalg RSA -keystore keystore.jks -keysize 2048
Enter keystore password:
What is your first and last name?
[Unknown]:  www.myhost-dev.com
What is the name of your organizational unit?
[Unknown]:  development
What is the name of your organization?
[Unknown]:  myhost, inc
What is the name of your City or Locality?
[Unknown]:  mycity
What is the name of your State or Province?
[Unknown]:  mystate
What is the two-letter country code for this unit?
[Unknown]:  us
Is CN=www.myhost-dev.com, OU=development, O="myhost, inc", L=mycity, ST=mystate, C=us correct?
Enter key password for <s1as>
(RETURN if same as keystore password): 
Run Code Online (Sandbox Code Playgroud)

第6步 -生成证书签名请求(CSR)

/usr/home/myhost/glassfish4/glassfish/domains/domain1/config
115 % keytool -certreq -alias s1as -file toSymantec02.csr -keystore keystore.jks
Enter keystore password: 
Run Code Online (Sandbox Code Playgroud)

第7步 -向赛门铁克提交企业社会责任

步骤8-将Symantec中级和ssl证书复制到配置目录

第9步 -导入中间证书

/usr/home/myhost/glassfish4/glassfish/domains/domain1/config
115 % keytool -import -trustcacerts -alias Intermediate -keystore keystore.jks -file IntermediateCA.crt
Enter keystore password:
Certificate was added to keystore
Run Code Online (Sandbox Code Playgroud)

第10步 -导入SSL证书

/usr/home/myhost/glassfish4/glassfish/domains/domain1/config
116 % keytool -import -trustcacerts -alias s1as -keystore keystore.jks -file ssl_certificate.crt
Enter keystore password:
Certificate reply was installed in keystore
Run Code Online (Sandbox Code Playgroud)

步骤11-重新启动服务器

/usr/home/myhost
118 % glassfish4/bin/asadmin start-domain domain1
Enter master password (3) attempt(s) remain)>
Waiting for domain1 to start ...............................
Successfully started the domain : domain1
domain  Location: /usr/home/myhost/glassfish4/glassfish/domains/domain1
Log File:/usr/home/myhost/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
Run Code Online (Sandbox Code Playgroud)

Mik*_*ike 5

问题几乎可以肯定是DNs1as证书的专有名称()已更改,但是安全管理员主体尚未更新。

有一个asadmin命令(enable-secure-admin-principal),可以手动更新它,但也可以enable-secure-admin再次运行(即使已启用安全管理员)。此命令将调用与上一个相同的代码,并用任何正确的管理员证书别名(s1as)替换安全管理员主体。

然后,您将需要重新启动GlassFish才能使更改生效,但是随后您将能够登录到管理控制台。

根本原因是管理控制台实际上与登录名一起执行2-way SSL,因此将为您(管理员用户)验证用户名和密码,然后使用DNas作为用户ID和s1as 验证管理控制台本身。密钥作为密码。这是因为管理控制台通过REST与DAS通信,并且需要将其自身标识为受信任的客户端。


希望所有背景对您有所帮助,但TL; DR如下:

  1. 再跑enable-secure-admin一次
  2. 重新启动域