- 전체
- OpenSources
- Arts
- Scripts
- PHP
- CompterSystems
- Apps
- WebServer
- MANpage
- DigitalImaging
- Circuit
- ETC
- Hardware
- Synology
WebServer Apache - 특정 위치에서 php 동작을 금지하는 방법
2008.10.07 14:24
URL (link) |
---|
서버를 혼자쓰기 아까워 몇몇 사람들과 공유를 하고 있는건 이미 오래된 일이고,
지금까지는 공개/비공개 단 두개의 계정만을 운용하면서 FTP로만 접속을 허용했는데
별도의 계정을 가졌으면 하는 요청이 계속해서 들어오다 보니 작업을 좀 해서,
pure-ftpd와 apache에 작업을 좀 해서 각 계정별로 ftp와 http의 접속이 가능하도록 손을 보았다.
그런데, 문제가 발생. PHP를 사용할 수 있게 두다보면 보안에 큰 구멍이 생기는 것...
실험해 본 결과 PHP가 사용가능하면 php navigator 같은 관리툴을 설치할 수 있는데다가 이를 이용해서 서버 전체에 억세스 및 파일 생성/삭제가 가능했다. 패닉...
그래서 관련 정보를 찾다보니 특정 디렉토리에만 파일의 특성을 삭제하는 방법이 있었다!!
(google이 좋다고 하지만 역시나 공식문서만한건 없다...)
RemoveType .html .php .phtml .cgi
</Directory>
이렇게 하면 html, php, cgi 확장자의 파일의 속성을 제거해서 그냥 텍스트파일로 취급을 하기 때문에 문제를 사전에 방지할 수 있다.
참고로 php를 사용불가하게 하면서 .php만을 중지시키는 경우가 있는데 (내가 방금 그랬다 -_-;;;;;;; 혹시나 하고 type을 찾아본게 다행이다)
httpd.conf를 찾아보다 보면 다음과 같이 .php외에 .phtml이 추가되는 경우도 있다.
따라서 php를 막으려면 이것도 반드시 확인해서 추가해야 한다!! - 빼먹으면 피본다...
아래는 apache 2.0의 공식 문서중 해당 참조 부분~
RemoveType Directive
Description:
Removes any content type associations for a set of file extensions
Syntax:
RemoveType extension [extension] ...
Context:
virtual host, directory, .htaccess
Override:
FileInfo
Status:
Base
Module:
mod_mime
The RemoveType
directive removes any MIME type associations for files with the given extensions. This allows .htaccess
files in subdirectories to undo any associations inherited from parent directories or the server config files. An example of its use might be:
/foo/.htaccess:
RemoveType .cgi
This will remove any special handling of .cgi
files in the /foo/
directory and any beneath it, causing the files to be treated as being of the DefaultType
.
Note
RemoveType
directives are processed after any AddType
directives, so it is possible they may undo the effects of the latter if both occur within the same directory configuration.
The extension argument is case-insensitive, and can be specified with or without a leading dot.
RemoveType Directive
Description: | Removes any content type associations for a set of file extensions |
---|---|
Syntax: | RemoveType extension [extension] ... |
Context: | virtual host, directory, .htaccess |
Override: | FileInfo |
Status: | Base |
Module: | mod_mime |
The RemoveType
directive removes any MIME type associations for files with the given extensions. This allows .htaccess
files in subdirectories to undo any associations inherited from parent directories or the server config files. An example of its use might be:
/foo/.htaccess:
RemoveType .cgi
This will remove any special handling of .cgi
files in the /foo/
directory and any beneath it, causing the files to be treated as being of the DefaultType
.
Note
RemoveType
directives are processed after any AddType
directives, so it is possible they may undo the effects of the latter if both occur within the same directory configuration.
The extension argument is case-insensitive, and can be specified with or without a leading dot.
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
7 | Ajaxplorer [3] [1] | Shadow | 2011.08.21 | 47517 |
6 |
MicroServer
[10] ![]() | Shadow | 2010.11.03 | 78618 |
5 | proxy server [1] | Shadow | 2009.02.15 | 41381 |
4 |
well-known services port numbers
[1] ![]() | Shadow | 2009.02.14 | 41616 |
» | Apache - 특정 위치에서 php 동작을 금지하는 방법 | sukhyun | 2008.10.07 | 36297 |
2 | [펌] '도메인등록 업체' 가격이 알고 싶다. 두번째 이야기 | sukhyun | 2008.06.24 | 32448 |
1 | Apache - autoindex | sukhyun | 2008.04.06 | 36067 |