Jboss 如何将https侦听器添加到WildFly';默认服务器是什么?

Jboss 如何将https侦听器添加到WildFly';默认服务器是什么?,jboss,command-line-interface,wildfly,jboss-cli,Jboss,Command Line Interface,Wildfly,Jboss Cli,我将遵循以下教程: 使用jboss cli成功添加了安全领域: /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=cli

我将遵循以下教程:

使用jboss cli成功添加了安全领域:

/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侦听器时

/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监听器的想法?

我是通过修改standalone.xml来实现的。据我记忆所及,步骤如下:

  • 为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>
    
    
    
  • 将https侦听器添加到undertow配置

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

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

  • 我还没有尝试使用管理界面添加此侦听器,但上述方法非常有效。

    以下是在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>
    
    
    

    
    

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

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


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

    是否需要SSL证书?通常是的,但我在您的代码中找不到任何类型的SSL证书的链接我在哪里包括https侦听器配置?对此不确定:步骤2(https侦听器)引用套接字绑定=“https”,但步骤3中添加的行将绑定命名为“管理https”。我猜那是抄袭的。name=“https”的条目类似,但具有不同的端口,具有类似${jboss.https.port:8443}的表达式
    <https-listener name="https" socket-binding="https" security-realm="WebSocketRealm"/>