【问题标题】:How to add https-listener to WildFly's default-server?如何将 https-listener 添加到 WildFly 的默认服务器?
【发布时间】:2014-08-09 22:49:09
【问题描述】:

我正在学习来自https://github.com/jbosstm/quickstart/tree/master/XTS/ssl的教程

使用jboss-cli成功添加了security-realm:

/core-service=management/security-realm=SSLRealm:add()
/core-service=management/security-realm=SSLRealm/server-identity=ssl:add( \
   keystore-path=./standalone/configuration/server.keystore, \
   keystore-password=client, \
   alias=client)

当我尝试添加 https-listener:

/subsystem=undertow/server=default-server/https-listener=https:add( \
    socket-binding="https", security-realm="SSLRealm" \
)

WildFly 抛出异常:

{
  "outcome" => "failed",
  "failure-description" => "JBAS014750: Operation handler failed to complete",
  "rolled-back" => true
}

任何想法如何添加https-listener

【问题讨论】:

    标签: jboss command-line-interface wildfly jboss-cli


    【解决方案1】:

    WildFly 8.1 对我有用:

    添加领域:

    [standalone@localhost:9990 /] /core-service=management/security-realm=WebSocketRealm:add()
    {"outcome" => "success"}
    

    配置它:

    [standalone@localhost:9990 /] /core-service=management/security-realm=WebSocketRealm/server-identity=ssl:add(keystore-path=websocket.keystore, keystore-relative-to=jboss.server.config.dir, keystore-password=websocket)
    {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-reload" => true,
            "process-state" => "reload-required"
        }
    }
    

    添加一个新的监听器:

    [standalone@localhost:9990 /] /subsystem=undertow/server=default-server/https-listener=https:add(socket-binding=https, security-realm=WebSocketRealm)
    {
        "outcome" => "success",
        "response-headers" => {"process-state" => "reload-required"}
    }
    

    然后重启:

    [standalone@localhost:9990 /] reload
    

    这将以下片段添加到standalone/configuration/standalone.xml:

    <security-realm name="WebSocketRealm">
                <server-identities>
                    <ssl>
                        <keystore path="websocket.keystore" relative-to="jboss.server.config.dir" keystore-password="websocket"/>
                    </ssl>
                </server-identities>
            </security-realm>
    

    <https-listener name="https" socket-binding="https" security-realm="WebSocketRealm"/>
    

    您使用的是哪个版本的 WildFly?

    【讨论】:

    • 是否需要 SSL 证书?通常是的,但我在您的代码中找不到任何类型的 SSL 证书的链接
    • 在哪里包含 https-listener 配置?
    【解决方案2】:

    我通过调整standalone.xml 来做到这一点。据我所知,步骤是:

    1. 为 ssl 监听器添加安全领域

      <security-realm name="SSLRealm">
        <server-identities>
          <ssl protocol="TLS">
            <keystore path="keystore-name" relative-to="jboss.server.config.dir" keystore-password="password" alias="alias"/>
          </ssl>
        </server-identities>
        <authentication>
          <truststore path="truststorename" relative-to="jboss.server.config.dir" keystore-password="password"/>
        </authentication>
      </security-realm>
      
    2. 将 https-listener 添加到 undertow 配置中

      <https-listener name="default-https" socket-binding="https" security-realm="SSLRealm" verify-client="REQUESTED"/>
      
    3. 将 https-listener 的套接字绑定添加到套接字绑定列表中

      <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
      

    我尚未尝试使用管理界面添加此侦听器,但上述方法效果很好。

    【讨论】:

    • 对此不确定:步骤 2 (https-listener) 引用 socket-binding="https" 但在步骤 3 中添加的行将绑定命名为“management-https”。我猜这只是复制的。 name="https" 的条目类似,但端口不同,表达式类似于 ${jboss.https.port:8443}"
    【解决方案3】:

    在我的情况下,当我尝试添加 https 侦听器时,安全领域中使用的密钥库不存在。在我将密钥库复制到 config 目录并在 CLI 中执行 reload 后,我可以在 CLI 中添加 https-listener。

    虽然 CLI 不会打印出信息性错误消息,但控制台会告诉您 wildfly 找不到密钥库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-07
      • 2013-05-12
      • 2019-11-09
      • 2015-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多