- Hiding Apache Version Information on Errors
- HTTP 404 Not Found 아파치 버전 숨기기
- ServerSignature Off
1 문제 상황[ | ]
- 404 Not Found 페이지에서 아파치 버전과 OS 정보가 노출된다.
- 이것을 숨기고 싶다.
Console
Copy
[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 /not_found.php was not found on this server.</p>
<hr>
<address>Apache/2.2.3 (CentOS) Server at localhost Port 80</address>
</body></html>
- → 아파치 버전은 2.2.3, OS는 CentOS임이 표시됨
2 확인[ | ]
- 기본값은 ServerSignature On
- 서버 정보를 표시하게 되어 있음
- CentOS
Console
Copy
[root@zetawiki ~]# cat /etc/httpd/conf/httpd.conf | grep ServerSignature
ServerSignature On
- 우분투
Console
Copy
root@zetawiki:~# cat /etc/apache2/conf-enabled/security.conf | grep ServerSignature
#ServerSignature Off
ServerSignature On
3 변경[ | ]
- 아파치 설정파일 httpd.conf를 httpd.conf_old로 복사하여 보존
Console
Copy
[root@zetawiki ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_old
Console
Copy
[root@zetawiki ~]# sed -i "s/ServerSignature On/ServerSignature Off/g" /etc/httpd/conf/httpd.conf
Console
Copy
[root@zetawiki ~]# diff /etc/httpd/conf/httpd.conf_old /etc/httpd/conf/httpd.conf
537c537
< ServerSignature On
---
> ServerSignature Off
- → ServerSignature 가 Off로 변경됨
- 새 설정을 적용하기 위해 아파치 재시작
Console
Copy
[root@zetawiki ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
4 확인 2[ | ]
Console
Copy
[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 /not_found.php was not found on this server.</p>
</body></html>
- → address 태그 부분이 완전히 사라졌다. 아파치/OS 정보가 노출되지 않음
5 같이 보기[ | ]
- 아파치 ServerTokens Prod, ServerSignature Off
- HTTP 헤더 아파치 버전 숨기기
- /etc/httpd/conf/httpd.conf
- 아파치 디렉토리 브라우징 막기
- 아파치 404 Not Found
- HTTP 404
- sed
- ↑ sed 대신 vi로 직접 편집해도 된다.
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.