需要帮助使用asadmin配置GlassFish

时间:2011-01-05 15:15:49

标签: ssl glassfish asadmin

由于项目限制,我需要在shell脚本(linux)中使用asadmin配置我的GlassFish安装。我配置了所有参数,除了一个。我需要配置的部分是“网络监听器”部分。以下是默认domain.xml文件的部分:

<network-config>
    <protocols>
        <protocol name="http-listener-1">
            <http default-virtual-server="server" max-connections="250" server-name="">
                <file-cache enabled="false"></file-cache>
            </http>
        </protocol>
        <protocol security-enabled="true" name="http-listener-2">
            <http default-virtual-server="server" max-connections="250" server-name="">
                <file-cache enabled="false"></file-cache>
            </http>
            <ssl ssl3-enabled="false" cert-nickname="s1as"></ssl>
        </protocol>
        <protocol name="admin-listener">
            <http default-virtual-server="__asadmin" max-connections="250" server-name="">
                <file-cache enabled="false"></file-cache>
            </http>
        </protocol>
    </protocols>
</network-config>

对于“http-listener-2”部分,我需要更改“ssl”部分。我看了很多地方但找不到正确的asadmin命令来进行这些更改。我的ssl部分需要看起来像这样:

<ssl key-store="config/xxxxxServer.jks" trust-store="config/xxxxxTrustStore.jks" cert-nickname="xxxxxServer" />

正如我所说,我现在已经查了几天了,我找不到与asadmin一起使用的正确命令行命令来设置这些参数。我认为“asadmin create-ssl”将是我所需要的,但不幸的是,它不是。在查看GlassFish的Web界面时,我看到了我需要设置的参数。这告诉我应该能够通过asadmin配置它。任何帮助我的帮助将不胜感激。

感谢阅读,祝你有个美好的一天。

1 个答案:

答案 0 :(得分:7)

快速回答:使用asadmin get和set。

这里有一些来自命令的输出,以使其更清晰...我希望。

让我们来看看输出 ...

$ ~/GlassFish_Server/bin/asadmin get 'configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.*'
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.allow-lazy-init=true
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.cert-nickname=s1as
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.classname=com.sun.enterprise.security.ssl.GlassfishSSLImpl
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.client-auth=
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.client-auth-enabled=false
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.key-store-password-provider=plain
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.ssl-inactivity-timeout=30
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.ssl2-enabled=false
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.ssl3-enabled=false
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.tls-enabled=true
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.tls-rollback-enabled=true
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.trust-max-cert-length=5
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.trust-store-password-provider=plain
Command get executed successfully.

现在,使用set 来更改其他某个属性的值......

$ ~/GlassFish_Server/bin/asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.key-store=config/xxxxxServer.jks
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.key-store=config/xxxxxServer.jks
Command set executed successfully.

使用get验证值'take'...

$ ~/GlassFish_Server/bin/asadmin get configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.key-store
configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.key-store=config/xxxxxServer.jks
Command get executed successfully.