IT/Server

[Jboss7.1] 개인정보 및 중요정보 노출(서버 언어 정보 노출) 조치 방안

알아영 2018. 12. 11. 13:11


제이보스에서 개인정보 및 중요정보 노출(서버 언어 정보 노출) 조치 방안입니다.


결국, 아래와 같이 리스판스 헤더 중 X-power-By에 JSP 정보가 노출되는 것이 문제임.

제이보스의 경우 제대로 컴파일이 안되어 고생한 적이 많은데, 이번 것 또한 JSP 구성에 버그가 존재했다.

아래 내용을 참고

따라서 조치 프로세스는

1.   standalone> configuration> standalone.xml  문서에 Configuration 태그 추가

<configuration>

<jsp-configuration x-powered-by="false"/>

</configuration>

<subsystem xmlns="urn:jboss:domain:web:1.1" ~~~> 

  // 여기에 <configuration> 태그 추가

</subsystem>


2. standalone> configuration> standalone.xml  문서에 property 태그 추가

<property name="org.apache.catalina.connector.X_POWERED_BY value=false"/>


<system-properties>

// 여기에 <property> 태그 추가

</system-properties>


참고사이트: https://docs.jboss.org/author/display/AS72/Hardening+Guidelines


1번, 2번으로도 해결되지 않을 경우 JAVA에서 서플릿 필터를 이용하여 응답헤더를 설정하는 방법이 있다.

1. web.xml 에서 사용할 필터를 지정해준다.

<filter><!-- 웹 어플리케이션에서 사용될 필터를 지정하는 역할 -->

        <filter-name>FilterName</filter-name>

        <filter-class>com.xxx.xx.xxx.xxxFilter</filter-class> <!-- 패키지 주소 입력 -->

     </filter>     

     <filter-mapping> <!-- 특정 자원에 대해 어떤 필터를 사용할지를 지정 -->

        <filter-name>FilterName</filter-name>

        <url-pattern>/*</url-pattern> <!-- -->

     </filter-mapping>   

2.  res.setHeader("X-Powered-By", "PORTAL"); 추가

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)

        throws IOException, ServletException {

    HttpServletResponse res = (HttpServletResponse) response;

        chain.doFilter(new RequestWrapper((HttpServletRequest) request), response);  

  res.setHeader("X-Powered-By", "PORTAL");

    }


이렇게까지 했는데도 계속 X-Powered-by 가 없어지지 않는다면, jsp 파일을 터치해주어야 한다. 

단지 tmp 폴더에 있는 파일을 삭제해주는 정도가 아니라, jsp 파일을 열어서 약간의 수정의 통해서 jsp파일을 업데이트 해야한다.

필자의 경우엔 로그인 페이지 jsp 파일을 수정한 후에야, 드디어 정상적으로 컴파일이 되었다.