본문 바로가기

리눅스

Apache HTTP Server 버전 정보 노출 방지

728x90
반응형

Apache HTTP Server 버전 정보 노출 방지

Apache HTTP Server를 운영할 때 HTTP 응답 헤더나 서버에서 생성하는 오류 페이지 등에 Apache의 버전 및 운영체제 정보가 노출될 수 있습니다.

 

예를 들어 기본 설정에서는 다음과 같이 Server 응답 헤더에 Apache 버전 정보가 포함될 수 있습니다.

Server: Apache/2.4.xx (Unix)

 

이러한 정보는 공격자에게 서버의 운영 환경과 사용 중인 Apache 버전을 추측할 수 있는 정보를 제공할 수 있으므로 운영 환경에서는 불필요한 서버 정보를 최소화하는 것이 좋습니다.

 

Apache에서는 다음 두 가지 지시어를 이용하여 서버 정보 노출을 제어할 수 있습니다.

  • ServerTokens : HTTP 응답 헤더에 표시되는 서버 정보 수준 제어
  • ServerSignature : Apache가 생성하는 오류 페이지 및 디렉터리 목록 등에 표시되는 서버 정보 제어

1. ServerTokens 설정

ServerTokens 지시어를 Prod로 설정하여 서버 응답 헤더에서 최소한의 정보만 노출하도록 합니다.

vim /etc/httpd/conf/httpd.conf
#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of: Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens Prod
728x90

2. ServerSignature 설정

ServerSignature를 Off로 설정하여 서버 생성 페이지(예: 오류 페이지, 디렉터리 리스팅)에서 버전 정보와 호스트 이름을 표시하지 않도록 합니다.

vim /etc/httpd/conf/httpd.conf
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature Off

Apache 설정 문법 확인

sudo apachectl configtest

Apache 서비스 재시작

sudo systemctl restart httpd

서비스 상태 확인

sudo systemctl status httpd

설정 적용 확인

curl을 이용하여 HTTP 응답 헤더를 확인합니다.

curl -I http://<서버주소>

 

728x90
반응형