【问题标题】:How to disable TRACE/TRACK HTTP in JBoss Wildfly?如何在 JBoss Wildfly 中禁用 TRACE/TRACK HTTP?
【发布时间】:2015-02-17 18:39:47
【问题描述】:

我想在服务器级别而不是 web.xml 中禁用 JBoss wildfly 8.1 中的 TRACE/TRACK HTTP 方法。怎么做?

【问题讨论】:

    标签: jboss wildfly-8 http-trace


    【解决方案1】:

    感谢 Federico Sierra 的回复。我又试了一次,但默认情况下似乎没有禁用 TRACE。我得到 200 OK 状态码。见下文。

    # curl -k -v -X TRACE https://localhost:8443 --user admin:Password@123
    * About to connect() to localhost port 8443 (#0)
    *   Trying ::1...
    * Connection refused
    *   Trying 127.0.0.1...
    * connected
    * Connected to localhost (127.0.0.1) port 8443 (#0)
    * successfully set certificate verify locations:
    *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
      CApath: none
    * SSLv3, TLS handshake, Client hello (1):
    * SSLv3, TLS handshake, Server hello (2):
    * SSLv3, TLS handshake, CERT (11):
    * SSLv3, TLS handshake, Server key exchange (12):
    * SSLv3, TLS handshake, Server finished (14):
    * SSLv3, TLS handshake, Client key exchange (16):
    * SSLv3, TLS change cipher, Client hello (1):
    * SSLv3, TLS handshake, Finished (20):
    * SSLv3, TLS change cipher, Client hello (1):
    * SSLv3, TLS handshake, Finished (20):
    * SSL connection using ECDHE-RSA-AES256-SHA384
    * Server certificate:
    *        subject: CN=scspr0021776001.gdl.englab.netapp.com
    *        start date: 2015-02
    *        expire date: 2016-02
    *        common name: scspr0021776001.gdl.englab.netapp.com (does not match 'localhost')
    *        issuer: CN=scsp
    *        SSL certificate verify result: self signed certificate (18), continuing anyway.
    * Server auth using Basic with user 'admin'
    > TRACE / HTTP/1.1
    > Authorization: Basic YWRtaW46UGFzc3dvcmRAMTIz
    > User-Agent: curl/7.27.0
    > Host: localhost:8443
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Expires: 0
    < Cache-Control: no-cache, no-store, must-revalidate
    < X-Powered-By: Undertow/1
    < Set-Cookie: JSESSIONID=j1Uh0ZpFl08-op1ak9dm6gr7.scspr0021776001; path=; HttpOnly
    < Set-Cookie: JSESSIONIDSSO=jIoXps8-b3dByrQektBEZfOP; path=/
    < Server: WildFly/8
    < Pragma: no-cache
    < Date: Wed, 18 Feb 2015 04:24:33 GMT
    < Connection: keep-alive
    < Content-Type: message/http
    < Content-Length: 135
    <
    TRACE /index.html HTTP/1.1
    Authorization: Basic YWRtaW46UGFzc3dvcmRAMTIz
    Host: localhost:8443
    User-Agent: curl/7.27.0
    Accept: */*
    * Connection #0 to host localhost left intact
    * Closing connection #0
    * SSLv3, TLS alert, Client hello (1):
    

    【讨论】:

    • 我可以确认 Wildfly 8.2.0 上没有禁用 HTTP TRACE。这可能仅在运行 HTTPS 时才会出现?
    • 没有消息?如何禁用跟踪方法,在 apache TraceEnable 关闭
    【解决方案2】:

    出于安全原因,默认情况下,Wildfly TRACE 和 TRACK 方法被禁用。

    您可以通过以下方式检查:

    curl -v -X TRACE http://localhost:8080
    
    * Rebuilt URL to: http://localhost:8080/
    * Adding handle: conn: 0x1ddb0a0
    * Adding handle: send: 0
    * Adding handle: recv: 0
    * Curl_addHandleToPipeline: length: 1
    * - Conn 0 (0x1ddb0a0) send_pipe: 1, recv_pipe: 0
    * About to connect() to localhost port 8080 (#0)
    *   Trying 127.0.0.1...
    * Connected to localhost (127.0.0.1) port 8080 (#0)
    > TRACE / HTTP/1.1
    > User-Agent: curl/7.33.0
    > Host: localhost:8080
    > Accept: */*
    >
    < HTTP/1.1 405 Method Not Allowed
    < Connection: keep-alive
    < X-Powered-By: Undertow/1
    * Server WildFly/8 is not blacklisted
    < Server: WildFly/8
    < Content-Length: 83
    < Content-Type: text/html
    < Date: Tue, 17 Feb 2015 20:16:29 GMT
    <
    <html><head><title>Error</title></head><body>405 - Method Not Allowed</body></html>* Connection #0 to host localhost left intact
    

    【讨论】:

      【解决方案3】:

      我设法在 Wildfly 8.2 中禁用了 HTTP TRACE(它应该适用于 Wildfly 8.1,但我尚未测试),并将以下内容添加到 webapp 的WEB-INF/undertow-handlers.conf

      method[TRACE] -> response-code[value=405]
      

      如果您有多个 web 应用程序,则必须将其添加到所有不需要响应 HTTP TRACE 请求的应用程序中。

      【讨论】:

      • 它有效。如果我在 web.xml 的安全约束标记内指定允许的 HTTP 方法,它就不起作用。如何在这个 undertow conf 文件中启用 DELETE 方法?
      猜你喜欢
      • 2018-01-02
      • 2020-08-08
      • 1970-01-01
      • 2019-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-26
      相关资源
      最近更新 更多