우분투 아파치 보안권장설정 ServerTokens Prod, ServerSignature Off

  다른 뜻에 대해서는 CentOS 아파치 보안권장설정 ServerTokens Prod, ServerSignature Off 문서를 참조하십시오.

1 개요[ | ]

아파치 ServerTokens Prod, ServerSignature Off

2 문제상황[ | ]

  • HTTP 헤더 확인
root@zetawiki:~# curl -I http://localhost
HTTP/1.1 200 OK
Date: Sun, 29 May 2016 12:07:41 GMT
Server: Apache/2.4.7 (Ubuntu)
Last-Modified: Sun, 29 May 2016 12:07:39 GMT
ETag: "0-533f9fc7abd22"
Accept-Ranges: bytes
Content-Type: text/html
→ Apache 버전(2.4.7), OS 종류(Ubuntu)가 표시됨
  • 404 페이지 확인
root@zetawiki:~# curl http://localhost/asdfasdf
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /asdfasdf was not found on this server.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address>
</body></html>
→ Apache 버전(2.4.7), OS 종류(Ubuntu)가 표시됨

3 확인[ | ]

root@zetawiki:~# cat /etc/apache2/conf-enabled/security.conf | egrep 'ServerTokens|ServerSignature'
# ServerTokens
#ServerTokens Minimal
ServerTokens OS
#ServerTokens Full
#ServerSignature Off
ServerSignature On
root@zetawiki:~# cat /etc/apache2/conf-enabled/security.conf | egrep '^ServerTokens|^ServerSignature'
ServerTokens OS
ServerSignature On

4 변경[ | ]

  • 아파치 보안설정파일 security.conf 를 security.conf.origin 으로 복사하여 보존
root@zetawiki:~# cp /etc/apache2/conf-enabled/security.conf /etc/apache2/conf-enabled/security.conf.origin
root@zetawiki:~# sed -i "s/ServerTokens OS/ServerTokens Prod/g" /etc/apache2/conf-enabled/security.conf
root@zetawiki:~# sed -i "s/ServerSignature On/ServerSignature Off/g" /etc/apache2/conf-enabled/security.conf
root@zetawiki:~# cat /etc/apache2/conf-enabled/security.conf | egrep '^ServerTokens|^ServerSignature'
ServerTokens Prod
ServerSignature Off
→ ServerTokens 가 Prod로, ServerSignature가 Off로 변경됨
  • 새 설정을 적용하기 위해 아파치 재시작
root@zetawiki:~# service apache2 restart
 * Restarting web server apache2                                          [ OK ]

5 확인 2[ | ]

root@zetawiki:~# curl -I http://localhost
HTTP/1.1 200 OK
Date: Sun, 29 May 2016 12:20:52 GMT
Server: Apache
Last-Modified: Sun, 29 May 2016 12:07:39 GMT
ETag: "0-533f9fc7abd22"
Accept-Ranges: bytes
Content-Type: text/html
root@zetawiki:~# curl http://localhost/asdfasdf
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /asdfasdf was not found on this server.</p>
</body></html>
→ HTTP 헤더와 404 페이지에 Apache 버전, OS 종류가 표시되지 않는다.

6 같이 보기[ | ]

7 주석[ | ]

  1. sed 대신 vi로 직접 편집해도 된다.

8 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}