本文介绍了必须启用安全管理员才能远程访问DAS-带有Docker的Acess Glassfish管理控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将Web应用程序部署在docker容器上的glassfish上。
当我访问管理控制台([IP]:4848)时,我可以访问登录页面,但是出现此错误消息,但我无法登录:

I try to deploy my web app on glassfish which is on a docker container.When I access to the Admin Console ( [IP]:4848 ), I can access to login page but there is this error message and I can't login:

所以我在另一篇文章中发现我需要在bin文件夹中添加以下行:

So I find on other post that I need to add these line in bin folder:

./asadmin start-domain
./asadmin change-admin-password
./asadmin enable-secure-admin
./asadmin stop-domain
./asadmin start-domain

但是我做不到因为我的glassfish实例位于容器中。

But I can't do it because my glassfish instance is on a container.

有关信息,我使用以下命令运行glassfish:

For information, I run glassfish with:

sudo docker run -p 4848:4848 -p 8080:8080 -e GLASSFISH_PASS="password" -d glassfish


推荐答案

有两种方法可以做到这一点,但是最好的方法可能是复制。 (Payara Server派生自GlassFish,因此dockerfile也与GlassFish兼容)。

There are a couple of ways to do this, but the best way is probably to copy the method used in the Payara Server dockerfile. (Payara Server is derived from GlassFish and therefore the dockerfile is compatible with GlassFish too)

总而言之,此方法创建2个文件:a tmpfile 包含默认(空)密码和所需的新密码,以及 pwdfile 仅包含新更改的文件。

To summarise, this method creates 2 files: a tmpfile which contains the default (empty) password and the desired new password, and a pwdfile which contains just the newly changed file.

如果 tmpfile 的内容是:

AS_ADMIN_PASSWORD=
AS_ADMIN_NEWPASSWORD=MyNewPassword

然后<$ c $的内容c> pwdfile 应该是:

AS_ADMIN_PASSWORD=MyNewPassword

要使用asadmin更改密码,第一个文件必须与 change-admin-password 命令,第二个包含所有将来的命令。

to change the password using asadmin, the first file must be used with the change-admin-password command, and the second with all future commands.

在Docker术语中,它看起来像这样(直接从上面链接的dockerfile中获取):

In docker terms, this looks like this (taken directly from the dockerfile linked above):

ENV PAYARA_PATH /opt/payara41
ENV ADMIN_USER admin
ENV ADMIN_PASSWORD admin

# set credentials to admin/admin 

RUN echo 'AS_ADMIN_PASSWORD=\n\
AS_ADMIN_NEWPASSWORD='$ADMIN_PASSWORD'\n\
EOF\n'\
>> /opt/tmpfile

RUN echo 'AS_ADMIN_PASSWORD='$ADMIN_PASSWORD'\n\
EOF\n'\
>> /opt/pwdfile

RUN \
 $PAYARA_PATH/bin/asadmin start-domain && \
 $PAYARA_PATH/bin/asadmin --user $ADMIN_USER --passwordfile=/opt/tmpfile change-admin-password && \
 $PAYARA_PATH/bin/asadmin --user $ADMIN_USER --passwordfile=/opt/pwdfile enable-secure-admin && \
 $PAYARA_PATH/bin/asadmin restart-domain

# cleanup
RUN rm /opt/tmpfile

这篇关于必须启用安全管理员才能远程访问DAS-带有Docker的Acess Glassfish管理控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 02:30