RSS구독하기:SUBSCRIBE TO RSS FEED
즐겨찾기추가:ADD FAVORITE
글쓰기:POST
관리자:ADMINISTRATOR
출처 카페 > 리눅스 서버 관리하기 / 파파
원본 http://cafe.naver.com/linuxserver/1023

안녕하세요 오늘도 모처럼 카페에 들렸다 계정 제한에 대한 내용을 보고 제가 아는 간단한 내용을 정리하여 올립니다.


우선 위의 질문에 대한 내용이 잘 이해가 되지 않아 제 생각한데로 정리하여 봅니다. 틀리면 다시 답글로 질문하여 주세요.


오라클 설치후 사용자 수를 제한한다고 나와 있는 부분은 오라클 사용의 동시 접속자를 DB 접속에 대한 제한을 두는것입니다.


이에 오라클이 아닌 리눅스 내의 계정에 대한 동시 접속자를 제한을 두는 방법은 몇가지 형태로 설정이 가능합니다.


==> Redhat 리눅스의 경우 Redhat 7.0(커널 2.2.X)까지는 ipchains가, 그 이상의 배포판 (커널 2.4.x, 2.6.x)에는 iptables가 제공된다


- ipchains을 이용한 접속제한 예제
   ipchains -A output -d 0/0 -j DENY  >> 모든 외부 트래픽 차단 설정
   ipchains -A output -p tcp -d 0/0 telnet -j ACCEPT
    >> 외부 트래픽 중 telnet 트래픽을 모두 허용
   ipchains -A output -p tcp -d 172.16.5.1 telnet -j ACCEPT
    >> outbound 트래픽 중 172.16.5.1로의 텔넷 트래픽만 허용

- ipchains을 이용한 접속해재 예제
  ipchains -D output -p tcp -d 172.16.5.1 telnet >> 옵션을 -D로 변경하여 재입력

- iptables를 이용한 접속제한 예제
  iptables -A OUTPUT -d 0/0 -j DROP  >> 모든 외부트래픽 차단 설정
  iptables -A OUTPUT -p tcp -d 172.16.5.1 --destination-port telnet -j ACCEPT
  >> outbound 트래픽 중, 172.16.5.1로의 텔넷 트래픽만 허용

- iptables를 이용한 접속해재 예제
  iptables -D OUTPUT -p tcp -d 172.16.5.1 --destination-port telnet -j ACCEPT

==> 기본 제공되는 프로그램이외에도 공개용 방화벽 프로그램 등을 이용하여 접속제한을 설정할
  수 있습니다. (예:oops firewall)


==> 외부 사이트의 소스 실행 금지
 o 기본적으로 웹 호스팅 서버 차원에서 외부 사이트의 소스 실행을 금지시킴.
 o php.ini 파일에서 다음과 같이 설정한합니다.
    allow_url_fopen = Off

==> 필요시 특정 홈페이지만 외부 사이트의 소스 실행 허용
 o 과정 Ⅰ 적용 후 외부 사이트의 소스 실행이 반드시 필요한 홈페이지에 대해서만 선별적으로
    해당 기능을 허용.(이 경우 반드시 과정 Ⅲ의 패치 적용 필요)
 o httpd.conf 파일에서 특정 홈페이지 도메인(예를들어 www.abc.co.kr)에 다음과 같은 설정을
    추가.

   
            ServerAdmin webmaster@abc.co.kr
            DocumentRoot /home/abc/public_html
            ServerName www.abc.co.kr
            php_admin_flag allow_url_fopen On        <= 추가



>오라클 설치 후 보안관련해서 DB 서버가 운영되고

>있는 시스템은 꼭 필요한 사용자 아이디만 생성하여

>사용자 수를 제한한다라고 나와있는 부분이 있습니다.

>

>그렇다면 리눅스 자체에서 특정 아이디를 몇명까지

>동시 접속으로 재한한다는 말인거 같습니다.(긴가 민가

>해서 그런데 맞는가요 ^^;;;;)

>

>리눅스에서는 어떤 파일에 이런 정보가 있는지좀

>알려주새요.

2006/09/11 10:28 2006/09/11 10:28
이 글에는 트랙백을 보낼 수 없습니다
출처 블로그 > webman21님의 블로그
원본 http://blog.naver.com/webman21/18079635

가령 "테스트.gif" 라는 이미지 파일이 있다면,  웹 브라우저에서 UTF-8 설정을 해줘야만 정상적으로 볼수가 있다.

그렇다고 해서 이미 만들어 놓은 한글 파일명으로 모두 바꿔야 할것인가?

그럴 필요는 없다.

mod_url 이라는 모듈만을 아파치에 추가해 주면 되는 문제이다.

추후에 모듈을 추가하기 위해서는 아파치가 DSO (동적) 으로 컴파일되어 있어야 하는데 여기에서는 아파치가 DSO로


설치되어 있다는 가정하에 설명하도록 한다.



<설치와 컴파일>

1. /usr/local/apache/bin/httpd -l | grep mod_so해서
mod_so.c 가 있다면 동적으로 컴파일 되었으므로, mod_url.c설치가 쉽다.

2. mod_url.c파일을 /usr/local/apache/libexec/안에 복사한다.

3. /usr/local/apache/bin/apxs -i -a -c /usr/local/apache/libexec/mod_url.c
 로 컴파일을 한다.

4. 정상적으로 설치가 되었다면, httpd.conf안에

--------------
AddModule redur |_module        libexec/mod_url.so
를 확인할수 있을것이다.

5. mod_usr.so 다음줄에
Addmodule mod_url.c
를 적어놓는다.

--------------------------
LoadModule redurl_module      libexec/mod_url.so
AddModule mod_url.c
--------------------------

6. 아파치설정의 마지막부분에


<IfModule mod_url.c>
CheckURL On
</IfModule>


부분을 추가한다음 아파치를 리부팅 시키면 정상적으로 한글 이름이 보여지는것을 확인할수 있을 것이다.

이제부터는 익스플로어에서 utf-8로 보내기를 체크를 해제하지 않아도 상관없이 한글이름 파일을 웹에서 확인할수 있다.


첨부파일을 다운로드하셔서 컴파일 하시기 바랍니다.

2006/09/11 10:28 2006/09/11 10:28
이 글에는 트랙백을 보낼 수 없습니다
출처 블로그 > 픽시시스템
원본 http://blog.naver.com/tipscorea/10000462120

개인 계정에서 블로그등의 사이트를 운영하시는 분들 중 가끔 외부에서의 컨텐츠 직링크로 인해 트래픽 초과에 걸리시는 분들이 많습니다. 트래픽 문제가 아니더라도, 무단 링크로 인해 저작권을 침해받는 경우도 있겠죠.
이를 해결하기 위해 레퍼러비교 같은 방법도 쓰곤 하는데, 아마 .htaccess 파일을 이용한 것도 많이들 아실 겁니다.

간단히, .htaccess와 워터마킹 기술을 이용해 이미지 링크 제어를 하는 법을 소개합니다.

일단, 이미지들이 저장되는 디렉토리에 .htaccess파일을 만듭니다. (이미 존재한다면 아래의 소스를 마지막에 추가하시면 됩니다.)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !explug\.com [NC]
RewriteCond %{HTTP_REFERER} !eouia0\. [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.*) image.php?image=$1

...........
잠깐 설명을 하자면,

RewriteCond %{HTTP_REFERER} !explug\.com [NC]
RewriteCond %{HTTP_REFERER} !eouia0\. [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]

이 부분에 링크를 허용할 URL들을 기재합니다. 정규식 패턴이므로 잘 알아서.. :)
위의 예의 경우 explug.com, eouia0가 포함되는 사이트, google 등에 링크를 허용한 경우입니다. 이 경우에는 원본 이미지를 마음대로 가져다 쓸 수 있습니다.
그외의 URL에서 링크가 걸릴 경우에는

RewriteRule (.*) image.php?image=$1

에 따라, image.php?image=파일이름 으로 리다이렉트됩니다. 만약 그냥 링크 자체를 끊고 싶으시다면 여기에 아무거나 써주셔도 되지요.

이제 워터마킹 처리를 위해 image.php를 작성합니다. GD라이브러리를 사용했으므로 GD가 사용가능한 계정이어야 합니다.

<?
define ("WATERMARK", "watermark.jpg");

header("Content-type: image/jpeg");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

$pic = strip_tags( $_GET['image'] );

$image_url = urldecode($pic);

if (!@fopen($image_url, "r")) {
   $dst_img = imagecreatefromjpeg(WATERMARK);
   $res = imagejpeg($dst_img, "", 100);
   die();
}

$file = pathinfo($image_url);
switch(strtoupper($file["extension"])) {
   case "JPG":
       $src_img = imagecreatefromjpeg($image_url);
       break;
   case "GIF":
       $src_img = imagecreatefromgif($image_url);
       break;
   case "PNG":
       $src_img = imagecreatefrompng($image_url);
       break;
}

$src_w = imagesx($src_img);
$src_h = imagesy($src_img);

$portion = $src_h / $src_w;
$dest_w = 300;
$dest_h = round($dest_w * $portion);

$dst_img = imagecreatetruecolor($dest_w, $dest_h);
imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h);

$watermark = imagecreatefromjpeg(WATERMARK);

$watermark_w = imagesx($watermark);
$watermark_h = imagesy($watermark);

$overlay_img = imagecreatetruecolor($watermark_w, $watermark_h);
imagecopy($overlay_img, $watermark, 0,0,0,0, $watermark_w, $watermark_h);
imagedestroy($watermark);

$white  = imagecolorallocate($overlay_img, 0xFF, 0xFF, 0xFF);
imagecolortransparent($overlay_img, $white);

$offsetX = $dest_w - $watermark_w - 3;
$offsetY = $dest_h - $watermark_h - 3;

imagecopymerge($dst_img,$overlay_img,$offsetX,$offsetY,0,0,$watermark_w,$watermark_h, 100);
imagedestroy($overlay_img);

$res = imagejpeg($dst_img, "", 100);
imagedestroy($dst_img);
?>

실행예는 링크를 보시면 이해하실 수 있을 겁니다. 링크를 허용한 사이트에서는 원본이, 링크를 허용하지 않은 사이트에서는 image.php에 의해 워터마크처리된 이미지로 링크가 걸리게 됩니다. 여기에서는 예를 위해 워터마킹 처리된 이미지의 사이즈를 가로 300으로 고정시켰지만 이 부분은 적당히 소스를 고치시면 원하는 대로 적용시키실 수 있으실 겁니다.

                                                                (주)픽시시스템(http://www.pixy.co.kr)

2006/09/11 10:28 2006/09/11 10:28
이 글에는 트랙백을 보낼 수 없습니다
출처 블로그 > 나의 블로그
원본 http://blog.naver.com/judas3/21801722

PHP를 아파치 모듈로 실행

PHP를 아파치 모듈로 사용할 때, 아파치 환경 설정 파일(예. httpd.conf)과 .htaccess 파일("AllowOverride Options"이나 "AllowOverride All" 권한이 필요합니다)을 이용해서 환경 설정을 변경할 수 있습니다.


PHP 4.0에서는, 아파치 환경 설정 파일에서 PHP 설정을 변경할 수 있게 하는 몇가지 아파치 설정이 존재합니다. 가능한 설정 목록은 ini_set() 문서에 있는 테이블의 PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM을 참고하십시오.


참고: PHP 3.0에서는, php3.ini 이름에 각각 대응하는 "php3_"를 붙여서 사용할 수 있는 아파치 설정이 존재합니다.


php_value 이름 값

특정한 설정값을 설정합니다. PHP_INI_ALL과 PHP_INI_PERDIR형 지시자에만 사용할 수 있습니다. 기존 설정값을 제거하기 위해서는 값을 none로 설정하십시오.


참고: boolean 값을 설정하기 위해서 php_value를 사용하지 마십시오. 대신, php_flag(아래를 참고)를 사용해야만 합니다.


php_flag 이름 on|off

Boolean 환경 설정에 사용합니다. PHP_INI_ALL과 PHP_INI_PERDIR형 지시자에만 사용할 수 있습니다.


php_admin_value 이름 값

특정한 설정값을 설정합니다. .htaccess 파일에서는 사용할 수 없습니다. php_admin_value의 설정값은 .htaccess나 버추얼 호스트 설정으로 바꿀 수 없습니다. 기존 설정값을 제거하기 위해서는 값을 none로 설정하십시오.


php_admin_flag 이름 on|off

Boolean 환경 설정에 사용합니다. php_admin_flag의 설정값은 .htaccess나 버추얼 호스트 설정으로 바꿀 수 없습니다. 기존 설정값을 제거하기 위해서는 값을 none로 설정하십시오.


예 4-2. 아파치 환경 설정 예제


<IfModule mod_php4.c>
  php_value include_path ".:/usr/local/lib/php"
  php_admin_flag safe_mode on
</IfModule>
<IfModule mod_php3.c>
  php3_include_path ".:/usr/local/lib/php"
  php3_safe_mode on
</IfModule>

경고

PHP 상수는 PHP 외부에서는 존재하지 않습니다. 예를 들면, httpd.conf에서는 error_reporting을 설정하기 위해서 E_ALL나 E_NOTICE 등의 PHP 상수를 사용할 수 없으며, 아무런 의미를 가지지 않기에 0으로 처리합니다. 대신 비트마스크 결합값을 사용하십시오. php.ini에서는 상수를 사용할 수 있습니다.

윈도우 레지스트리를 통해 PHP 설정 변경하기

윈도우에서 PHP를 실행할 때, 윈도우 레지스트리를 통해서 디렉토리 단위로 설정값을 변경할 수 있습니다. 레지스트리 키 HKLM\SOFTWARE\PHP\Per Directory Values에 기록된 설정값은, 경로명이 서브키로 연결됩니다. 예를 들면, 디렉토리 c:\inetpub\wwwroot를 위한 설정값은 HKLM\SOFTWARE\PHP\Per Directory Values\c\inetpub\wwwroot에 기록합니다. 디렉토리 단위의 설정은 그 디렉토리와 그 하위 디렉토리에서 실행되는 모든 스크립트에 영향을 줍니다. 키가 가지는 이름은 PHP 설정 지시어이고, 문자열 값을 가집니다. 값에 지정한 PHP 상수는 처리되지 않습니다.


PHP의 다른 인터페이스

PHP의 인터페이스에 상관 없이, ini_set()를 이용하여 스크립트 실행시의 몇가지 값을 변경할 수 있습니다. 아래의 표는 설정값이 어느 레벨에서 변경/지정될 수 있는지 보여줍니다.


표 4-1. PHP_INI_* 상수 정의


상수 값 의미
PHP_INI_USER 1 유저 스크립트에서 설정 가능한 엔트리
PHP_INI_PERDIR 2 php.ini, .htaccess, httpd.conf에서 설정 가능한 엔트리 
PHP_INI_SYSTEM 4 php.ini나 httpd.conf에서 설정 가능한 엔트리 
PHP_INI_ALL 7 어디에서라도 설정 가능한 엔트리


환경 설정의 설정값은 phpinfo() 출력에서 확인할 수 있습니다. ini_get()나 get_cfg_var()을 이용하여 개별 설정값에 접근할 수도 있습니다.

2006/09/11 10:27 2006/09/11 10:27
이 글에는 트랙백을 보낼 수 없습니다
Web_developing/Apache  2006/09/11 10:26
출처 블로그 > 학습
원본 http://blog.naver.com/jesuskth/20005249838

거의 3년간 여기서 많은 배움과 팁만 얻어가다 보안에 관련한 팁글을 보던중, open_basedir 에 관련한 내용이 있어 제 서버에 적용하려고 웹사이트를 뒤적거려 얻은 팁같지 않은 팁입니다 ^^;;

저같은 경우는 현재 무료로 20명정도를 호스팅 해드리고 있는데. 글자그대로 "웹호스팅" 이므로 텔넷은 막아놓고 있습니다 (이건 변명이고.. 쉘상의 해킹에 관해서 모두 막을 자신이 없습니다. ^^;)

문제되는 부분은 php 프로그램을 이용한 웹상에서 다른 계정이용자의 파일을 볼수 있다는 것이었는데 아파치 설정파일에서 open_basedir 를 설정해주니 막히더군요.

파일을 보는 예제) ps. 무단도용 죄송합니다 ^^;

비밀 노팔룡// 웹브라우저로 확인해서 제로보드를 사용한다면...대충찍을 수 있겠죠...config.php파일 있는 위치가 뻔하지 않습니까?
자신의 계정에서 가볍게 php코딩해서 보세요~ 훤히 보입니다..
<?php
$fp = fopen('절대경로파일명', 'r');
while(!feof($fp)) {
$content = fread($fp, filesize('절대경로파일명'));
}
fclose($fp);
echo '<xmp>'.$content.'</xmp>';
?>
해보세요 03/01 20:43:09  
 
아쉬 쉬움 <?php

system("cat /home/계정/public_html/제로보드/config.php");

?>

많은 헛점과 오류가 있을지 모르지만, 혹시라도 있을지 모를 저같은 초보서버 관리자께
조금이나마 도움이 되고자 글을 씁니다.

운영체제는 프비 4.9 이며 아파치 버전은 1.3.29 입니다.

자.. 팁.. 나갑니다 -_-;;

<Directory /home/계정사용자아이디/>
   php_admin_value open_basedir /home/계정사용자아이디/:/var/tmp/:/tmp/
</Directory>

이구문을 추가해 주시면 됩니다. 너무 간단한가요 제가 잘 몰라서 이게 어떤문제가 있는지는 모르겠습니다. 다만, 이 구문을 적어주면 해당 계정사용자는 자신의 계정폴더와 /var/tmp/ /tmp/ 폴더만 php의 file 관련 함수로 접근 할 수 있더군요.

접근 가능한 폴더를 더 추가해 주실려면 콜론(:)을 적으시고 추가하시면 됩니다..

바뀐설정을 적용하실려면 아파치를 재시작해주시는걸 잊지마세요.

이상저의 처음이자 팁같지 않은 팁이었습니다.. 꾸벅.

2006/09/11 10:26 2006/09/11 10:26
이 글에는 트랙백을 보낼 수 없습니다
출처 블로그 > 『해킹.... 속임수의 예술....』
원본 http://blog.naver.com/zsup1343/60003541921
Apache mod_gzip.c Module install
1. Module 설치하기
1-1. File Download (mod_gzip.so)
http://www.remotecommunications.com/apache/mod_gzip/ 여기에서 "mod_gzip.so" (85K) (Linux용)을 Download 한다. 이파일을 "/etc/httpd/modules" 또는 "/usr/local/apache/libexec"에 복사한다.

1-2. Apache "httpd.conf" Setting.
LoadModule gzip_module modules/mod_gzip.so # 만약 : /etc/httpd/modules 이면
LoadModule gzip_module libexec/mod_gzip.so # 또는 : /usr/local/apache/libexec 이면

AddModule mod_gzip.c


mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_min_http 1001 # 1000 = HTTP/1.0, 1001 = HTTP/1.1
mod_gzip_minimum_file_size 300 # 압축할 최소 Size
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 100000
mod_gzip_keep_workfiles No
mod_gzip_item_include file \.html$ # 압축할 파일들 설정
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.jsp$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^text/.html
mod_gzip_item_include mime ^text/html$ # HTML 형식 모두 압축
mod_gzip_item_include mime ^application/x-httpd-php # PHP 스크립트 압축
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_exclude file \.css$ # 압축 제외 파일들.
mod_gzip_item_exclude file \.js$
mod_gzip_item_exclude mime ^image/.*

mod_gzip_temp_dir /dev/shm # 이것 Linux용이고요 보통 '/tmp'하시면됩니다.
# 최고의 속도를 날려면 RamDisk 의 위치를 넣으세요.
LogFormat "%h %l %u %t \"%V %r\" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_size}n:%{mod_gzip_compression_ratio}npct." common_with_mod_gzip_info2
CustomLog logs/mod_gzip common_with_mod_gzip_info2
# Log 가 필요하신분만 넣으세요.

1-3. Apache Server Restart
# service httpd restart
2. Static Complie (설치)
2-1. File Download
http://www.remotecommunications.com/apache/mod_gzip/ 에서 "mod_gzip.c" (300K) 을 Download 한다. 파일을 Apache Source 폴더에 Copy 한다. ('apache/src/modules/extra/')
2-2. Source Modify
apache/src/Configuration... (3개의 파일에 다음내용을 추하간다 "AddModule modules/extra/mod_gzip.o")
# cd ..../apache/ # Apache 소스 있는곳
# echo "AddModule modules/extra/mod_gzip.o" >> src/Configuration.tmpl # configure 생성하기 전에 원시 파일
# ./configure --prefix=...... # configure 실행 필요한 옵션 넣으세요.
# make # 컴파일
# service httpd stop # Web Server Stop
# make install # Apache Install
# httpd -l # 컴파일 된 모듈 확인
Compiled-in modules:
http_core.c
mod_env.c
mod_log_config.c
mod_mime.c
mod_negotiation.c
mod_include.c
mod_dir.c
mod_cgi.c
mod_asis.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_access.c
mod_auth.c
mod_setenvif.c
mod_redurl.c # 한글 파일 처리 모듈
mod_gzip.c # 이것 이 있으면 정상.
mod_php4.c
# service httpd restart # Web Server Start
2-3. Apache "httpd.conf" Setting.

mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_min_http 1001 # 1000 = HTTP/1.0, 1001 = HTTP/1.1
mod_gzip_minimum_file_size 300 # 압축할 최소 Size
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 100000
mod_gzip_keep_workfiles No
mod_gzip_item_include file \.html$ # 압축할 파일들 설정
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.jsp$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^text/.html
mod_gzip_item_include mime ^text/html$ # HTML 형식 모두 압축
mod_gzip_item_include mime ^application/x-httpd-php # PHP 스크립트 압축
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_exclude file \.css$ # 압축 제외 파일들.
mod_gzip_item_exclude file \.js$
mod_gzip_item_exclude mime ^image/.*

mod_gzip_temp_dir /dev/shm # 이것 Linux용이고요 보통 '/tmp'하시면됩니다.
# 최고의 속도를 날려면 RamDisk 의 위치를 넣으세요.
LogFormat "%h %l %u %t \"%V %r\" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_size}n:%{mod_gzip_compression_ratio}npct." common_with_mod_gzip_info2
CustomLog logs/mod_gzip common_with_mod_gzip_info2
# Log 가 필요하신분만 넣으세요.

2-4. Start web server
httpd -t
service httpd restart
logs/mod_gzip Log 파일 참조하세요.
2006/09/11 10:26 2006/09/11 10:26
이 글에는 트랙백을 보낼 수 없습니다
출처 블로그 > Human Packet
원본 http://blog.naver.com/jabusunin/30002719579

/* ---------------------------------------------------------
  - 작 성  자 : 정찬호(master@rootman.co.kr)
  - Homepage :
http://www.rootman.co.kr/
  - 최종수정일 : 2003. 12. 08
  - 모듈정보
    Apache DoS Evasive Maneuvers Module
    For Apache 1.3 and 2.0
    Copyright (c) 2002 Network Dweebs Corporation
    Version 1.8 [2003.0901.1845]
  ---------------------------------------------------------------- */

---------------------------------------------------------------------
*. mod_dosevasive이란 무엇인가
---------------------------------------------------------------------
  이것은 HTTP Dos 또는 DDos 스택 또는 저돌적인 공격으로부터 아파치를 보호하는데 있습니다.  이것은 ipchains, 방화벽, 라우터등으로 쉽게 구성될 수 있도록 디자인 되었습니다.

  탐지는 주소, URI의 IP 내부 동적 해쉬테이블을 생성함으로 수행되고, 각 아이피별로 거부됩니다.
  - 초당 몇번 이상의 같은 페이지를 요청하는 경우
  - 초당 같은 자식노드를 동시에 50번 이상 생성하는 경우
  - 일시적으로 블러킹되는 동안 어떠한 요청을 생성하는 경우

----------------------------------------------------------------------

1. mod_dosevasive 설치
----------------------------------------------------------------------
  다운로드 :  
http://www.rootman.co.kr/bbs/zboard.php?category=11&id=dataroom
                 http://www.nuclearelephant.com/projects/dosevasive/

  [root@rootman root]# tar xvfz mod_dosevasive.1.8.tar.gz
  [root@rootman root]# cd /usr/local/apache/bin
  [root@rootman bin]# ./apxs  -iac ../mod_dosevasive/mod_dosevasive.c
  [root@rootman bin]# ./apxs  -iac ../mod_dosevasive/mod_dosevasive.c
     gcc -DLINUX=22 -DUSE_HSREGEX -fpic -DSHARED_CORE -DSHARED_MODULE -I/usr/local/apache/include  -c ../mod_dosevasive/mod_dosevasive.c
     gcc -shared -o ../mod_dosevasive/mod_dosevasive.so mod_dosevasive.o
     [activating module `dosevasive' in /usr/local/apache/conf/httpd.conf]
     cp ../mod_dosevasive/mod_dosevasive.so /usr/local/apache/libexec/mod_dosevasive.so
     chmod 755 /usr/local/apache/libexec/mod_dosevasive.so
     cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak
     cp /usr/local/apache/conf/httpd.conf.new /usr/local/apache/conf/httpd.conf
     rm /usr/local/apache/conf/httpd.conf.new

  [root@rootman root]# vi /usr/local/apache/conf/httpd.conf     <--- 아래두줄이 추가되었나 확인한다.
       LoadModule dosevasive_module  libexec/mod_dosevasive.so
       AddModule mod_dosevasive.c

  [root@rootman /root]# /usr/local/apache/bin/apachectl graceful    <--- 아파치재가동시킨다.

-------------------------------------------------------------------------
2. httpd.conf에는 다음과 같이 설정을 추가한다.
-------------------------------------------------------------------------  
    DOSHashTableSize     3097
    DOSPageCount         3
    DOSSiteCount         50
    DOSPageInterval      1
    DOSSiteInterval      1
    DOSBlockingPeriod    3600
 


  ----------------------------------------------
  추가적으로 지시자를 추가하실 수 있습니다.
  ----------------------------------------------
   DOSEmailNotify      master@rootman.co.kr
   DOSSystemCommand    "su - someuser -c '/sbin/... %s ...'"

 - DOSHashTableSize 
   각 자식 해쉬테이블 마다 탑레벨 노드의 수를 지정합니다.
   수치가 높으면 높을수록 더 많은 퍼포먼스가 나타나지만 테이블스페이스에 메모리를 남기게 된다.  접속량이 많으면 이 수치를 높혀도 된다.
   
 - DOSPageCount
   이것은 같은 페이지 또는 URI, 인터벌당 요청수에 대한 카운트 수이다.
   지정된 값이 초과되면 클라이언트에 대한 IP 정보가 블러킹리스트에 추가된다.

 - DOSSiteCount
   지정된 시간동안 같은 페이지를 지정된 수 보다 초과될경우 IP 정보가 블러킹리스트에 추가된다.

 - DOSPageInterval
   페이지 카운트 시발점, 디폴트는 1초이다.

 - DOSSiteInterval
   사이트 카운트 시발점, 디폴트는 역시 1초이다.

 - DOSBlockingPeriod
   클라이언트가 블랙리스트에 추가되어 블러킹되는 총 시간.
   이때 클라이언트는 403 (Forbidden) 에러를 출력하게 된다.

 - DOSEmailNotify
   이 값이 지정되면, IP가 블러킹될때마다 지정된 이메일로 발동된다.
   
   주의 : 메일러는 mod_dosevasive.c 에 정확하게 지정되야 한다.
         디폴트는 "/bin/mail -t %s" 이다.

 - DOSSystemCommand
   이 값이 지정되면, 시스템은 아이피가 블러킹될때마다 명령행을 실행한다.
   이것은 아이피 필터링이나 다른 도구를 사용하도록 설계되었습니다.

--------------------------------------------------------------------------

3. 인가된 IP 주소 할당
--------------------------------------------------------------------------
  버전 1.8에서는 아이피가 블러킹되더라도 인가된 클라이언트 아이피에 대해서는 적용되지 않습니다.   인가시키는 목적은 소프트웨어, 스크립트, 로컬서치로봇, 해당 서버로부터의 많은 요청인한 웹거부로 부터의 또다른 프로그램을 보호하는데 있습니다.

  아파치에서 설정하는 방법은 다음과 같습니다.

  DOSWhitelist    127.0.0.1
  DOSWhitelist    127.0.0.*

  와일드카드는(*) 필요하다면 최대 8진수(xxx.*.*.*)까지 사용할 수 있습니다.

-------------------------------------------------------------------------
4. 테스트 하기
-------------------------------------------------------------------------
  [root@rootman mod_dosevasive]# perl test.pl        
    HTTP/1.1 200 OK
    HTTP/1.1 403 Forbidden
    HTTP/1.1 200 OK
    HTTP/1.1 403 Forbidden
    HTTP/1.1 403 Forbidden
-------------------------------------------------------------------------

5. 원문보기
-------------------------------------------------------------------------
Apache DoS Evasive Maneuvers Module
For Apache 1.3 and 2.0
Copyright (c) 2002 Network Dweebs Corporation
Version 1.8 [2003.0901.1845]

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

WHAT IS MOD_DOSEVASIVE ?

mod_dosevasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack.  
It is also designed to be a detection tool, and can be easily configured to talk to ipchains, firewalls, routers, and etcetera.  

Detection is performed by creating an internal dynamic hash table of IP Addresses and URIs, and denying any single IP address from any of the following:

- Requesting the same page more than a few times per second
- Making more than 50 concurrent requests on the same child per second
- Making any requests while temporarily blacklisted (on a blocking list)

This method has worked well in both single-server script attacks as well as distributed attacks, but just like other evasive tools, is only as useful to the point of bandwidth and processor consumption (e.g. the amount of bandwidth and processor required to receive/process/respond to invalid requests), which is why it's a good idea to integrate this with your firewalls and routers.

This module instantiates for each listener individually, and therefore has a built-in cleanup mechanism and scaling capabilities.  Because of this, legitimate requests are never compromised but only scripted attacks.  Even a user repeatedly clicking on 'reload' should not be affected unless they do it maliciously.

Two different module sources have been provided:

Apache v1.3 API:        mod_dosevasive.c
Apache v2.0 API:        mod_dosevasive20.c


HOW IT WORKS

A web hit request comes in.  The following steps take place:

- The IP address of the requestor is looked up on the temporary blacklist
- The IP address of the requestor and the URI are both hashed into a "key".  
 A lookup is performed in the listener's internal hash table to determine
 if the same host has requested this page more than once within the past 1 second.  
- The IP address of the requestor is hashed into a "key".
 A lookup is performed in the listerner's internal hash table to determine
 if the same host has requested more than 50 objects within the past second (from the same child).

If any of the above are true, a 403 response is sent.  
This conserves bandwidth and system resources in the event of a DoS attack.  
Additionally, a system command and/or an email notification can also be triggered to block all the originating addresses of a DDoS attack.

Once a single 403 incident occurs, mod_dosevasive now blocks the entire IP address for a period of 10 seconds (configurable).  
If the host requests a
page within this period, it is forced to wait even longer.  
Since this is triggered from requesting the same URL multiple times per second, this again does not affect legitimate users.

The blacklist can/should be configured to talk to your network's firewalls and/or routers to push the attack out to the front lines, but this is not required.

mod_dosevasive also performs syslog reporting using daemon.alert.  Messages
will look like this:

Aug  6 17:41:49 elijah mod_dosevasive[23184]: [ID 801097 daemon.alert] Blacklisting address x.x.x.x: possible DoS attack.


WHAT IS THIS TOOL USEFUL FOR?

This tool is *excellent* at fending off small to medium-sized request-based DoS attacks or script attacks and brute force attacks.  
Its features will prevent you from wasting bandwidth or having a few thousand CGI scripts running as a result of an attack.  
When used in conjunction with other preventative measures such as router blackholing, this tool is very effective against larger DDoS attacks as well.

If you do not have an infrastructure capable of fending off any other types of DoS attacks, chances are this tool will only help you to the point of
your total bandwidth or server capacity for sending 403's.  
Without a solid infrastructure and DoS evasion plan in place, a heavy distributed DoS will most likely still take you offline.  


HOW TO INSTALL

APACHE v1.3
-----------

Without DSO Support:

1. Extract this archive into src/modules in the Apache source tree
2. Run ./configure --add-module=src/modules/dosevasive/mod_dosevasive.c
3. make, install
4. Restart Apache


With DSO Support, Ensim, or CPanel:

1. $APACHE_ROOT/bin/apxs -iac mod_dosevasive.c
2. Restart Apache


APACHE v2.0
-----------

1. Extract this archive
2. Run $APACHE_ROOT/bin/apxs -i -a -c mod_dosevasive20.c
3. The module will be built and installed into $APACHE_ROOT/modules, and loaded into your httpd.conf
4. Restart Apache


CONFIGURATION

mod_dosevasive has default options configured, but you may also add the following block to your httpd.conf:


APACHE v1.3
-----------


   DOSHashTableSize    3097
   DOSPageCount        2
   DOSSiteCount        50
   DOSPageInterval     1
   DOSSiteInterval     1
   DOSBlockingPeriod   10


APACHE v2.0
-----------

   DOSHashTableSize    3097
   DOSPageCount        2
   DOSSiteCount        50
   DOSPageInterval     1
   DOSSiteInterval     1
   DOSBlockingPeriod   10


Optionally you can also add the following directives:

   DOSEmailNotify        you@yourdomain.com
   DOSSystemCommand        "su - someuser -c '/sbin/... %s ...'"

You will also need to add this line if you are building with dynamic support:

APACHE v1.3
-----------
AddModule        mod_dosevasive.c


APACHE v2.0
-----------
LoadModule dosevasive20_module modules/mod_dosevasive20.so

(This line is already added to your configuration by apxs)


DOSHashTableSize
----------------
The hash table size defines the number of top-level nodes for each child's hash table.  
Increasing this number will provide faster performance by decreasing the number of iterations required to get to the record, but consume more memory for table space.  
You should increase this if you have a busy web server.  
The value you specify will automatically be tiered up to the next prime number in the primes list (see mod_dosevasive.c for a list of primes used).


DOSPageCount
------------
This is the threshhold for the number of requests for the same page (or URI) per page interval.  
Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list.


DOSSiteCount
------------
This is the threshhold for the total number of requests for any object by the same client on the same listener per site interval.  
Once the threshhold
for that interval has been exceeded, the IP address of the client will be added to the blocking list.


DOSPageInterval
---------------
The interval for the page count threshhold; defaults to 1 second intervals.


DOSSiteInterval
---------------
The interval for the site count threshhold; defaults to 1 second intervals.


DOSBlockingPeriod
-----------------
The blocking period is the amount of time (in seconds) that a client will be blocked for if they are added to the blocking list.  
During this time, all subsequent requests from the client will result in a 403 (Forbidden) and the timer being reset (e.g. another 10 seconds).  
Since the timer is reset for every subsequent request, it is not necessary to have a long blocking period; in the event of a DoS attack, this timer will keep getting reset.


DOSEmailNotify
--------------

If this value is set, an email will be sent to the address specified
whenever an IP address becomes blacklisted.  A locking mechanism using /tmp
prevents continuous emails from being sent.

NOTE: Be sure MAILER is set correctly in mod_dosevasive.c
     (or mod_dosevasive20.c).  The default is "/bin/mail -t %s" where %s is
     used to denote the destination email address set in the configuration.  
     If you are running on linux or some other operating system with a
     different type of mailer, you'll need to change this.


DOSSystemCommand
----------------
If this value is set, the system command specified will be executed whenever an IP address becomes blacklisted.  
This is designed to enable system calls to ip filter or other tools.  
A locking mechanism using /tmp prevents continuous system calls.  
Use %s to denote the IP address of the blacklisted IP.


WHITELISTING IP ADDRESSES

As of version 1.8, IP addresses of trusted clients can be whitelisted to insure they are never denied.  
The purpose of whitelisting is to protect software, scripts, local searchbots, or other automated tools from being denied for requesting large amounts of data from the server.  
Whitelisting should *not* be used to add customer lists or anything of the sort, as this will open the server to abuse.  
This module is very difficult to trigger without performing some type of malicious attack, and for that reason it is more appropriate to allow the module to decide on its own whether or not an individual customer should be blocked.

To whitelist an address (or range) add an entry to the Apache configuration
in the following fashion:

DOSWhitelist        127.0.0.1
DOSWhitelist        127.0.0.*


Wildcards can be used on up to the last 3 octets if necessary.  
Multiple DOSWhitelist commands may be used in the configuration.


TWEAKING APACHE

The keep-alive settings for your children should be reasonable enough to keep each child up long enough to resist a DOS attack (or at least part of one).  
For every child that exits, another 5-10 copies of the page may get through before putting the attacker back into '403 Land'.  
With this said,
you should have a very high MaxRequestsPerChild, but not unlimited as this will prevent cleanup.

You'll want to have a MaxRequestsPerChild set to a non-zero value, as DosEvasive cleans up its internal hashes only on exit.  
The default MaxRequestsPerChild is usually 10000.  
This should suffice in only allowing a few requests per 10000 per child through in the event of an attack (although if you use DOSSystemCommand to firewall the IP address, a hole will no longer be open in between child cycles).


TESTING

Want to make sure it's working? Run test.pl, and view the response codes.
If the target machine is not localhost, be sure to change it in the script first.  
You should receive 403 responses after the first 25-50 requests, depending on your server configuration.  
Please don't use this script to DoS others without their permission.


KNOWN BUGS

- This module appears to conflict with the Microsoft Frontpage Extensions


FEEDBACK

Please email me with questions, constructive comments, or feedback:
 jonathan@nuclearelephant.com.

From :http://www.rootman.co.kr

2006/09/11 10:25 2006/09/11 10:25
이 글에는 트랙백을 보낼 수 없습니다
출처 블로그 > rulru님의 블로그
원본 http://blog.naver.com/rulru/70003288314
Apache 에서 DoS 공격 막기 (1.3.x 2.x 모두)
글쓴이 : 좋은진호 (2003년 08월 29일 오후 06:55) 읽은수: 6,699 [ 아파치 # 트랙백(0) 인쇄용 페이지 본문 E-Mail로 보내기 ]
아파치 작성자 : 좋은진호(truefeel, http://coffeenix.net/ )
작성일 : 2003.8.20(수) apache v1.3.x
수정일 : 2003.8.25(월) apache v2.x 부분 추가

특정 URL이나 IP일 경우나 특정한 브라우저를 이용하여 DoS(Denial of Service, 서비스거부)
공격이 들어온다면 httpd.conf 에서 SetEnvIf, SetEnvIfNoCase 등과 Allow, Deny 설정으로
간단히 막을 수 있겠지만 일정한 유형이 없다면 해결점을 찾기가 쉽지 않다.

다행히 Apache용 mod_dosevasive 모듈로 DoS 공격을 쉽게 막을 수 있다.
며칠전 1.7버전 발표로 apache 2.x에서도 정상적으로 이 모듈을 이용할 수 있게 됐다.

1. mod_dosevasive 설치

http://www.nuclearelephant.com/projects/dosevasive/
에서 mod_dosevasive (현재 최신버전은 1.7)을 받아온다.

1) 기존에 사용하던 apache 1.3.x에 모듈만 추가할 때

mod_dosevasive.tar.gz 을 푼다음 apxs로 설치

----------------------------------------------
# tar xvfz mod_dosevasive.tar.gz 
# cd dosevasive
# /bin/apxs -iac mod_dosevasive.c
...
[activating module `dosevasive' in /usr/local/apache/conf/httpd.conf]
cp mod_dosevasive.so /usr/local/apache/libexec/mod_dosevasive.so
chmod 755 /usr/local/apache/libexec/mod_dosevasive.so
...
----------------------------------------------

httpd.conf의 LoadModule, AddModule는 apxs가 알아서 추가해준다.

2) apache 1.3.x부터 새로 컴파일할 할 때

mod_dosevasive.tar.gz 을 apache_source_홈/src/modules 에 푼 다음
기존에 apache 컴파일하는 것과 동일한 방법으로 하되, --add-module=... 옵션만
추가해준다.

----------------------------------------------
./configure --prefix=/usr/local/apache \
--enable-module=all --enable-shared=max \
--add-module=src/modules/dosevasive/mod_dosevasive.c  <-- 추가함
make
make install
----------------------------------------------

3) apache 2.x에 모듈만 붙일 때

/bin/apxs -iac mod_dosevasive20.c

2. 설정

httpd.conf 에 아래 설정이 있는지 확인한다.

apache 1.3.x
----------------------------------------------
...
LoadModule dosevasive_module libexec/mod_dosevasive.so
...
AddModule mod_dosevasive.c
----------------------------------------------

apache 2.x
----------------------------------------------
LoadModule dosevasive20_module modules/mod_dosevasive20.so
----------------------------------------------

httpd.conf에는 다음과 같이 설정을 추가한다.
( 단, 아래 설정 중에 apache 2.x일 때는 < IfModule mod_dosevasive20.c> 로 )
----------------------------------------------
< IfModule mod_dosevasive.c>
  DOSHashTableSize  3097
  DOSPageCount    3
  DOSSiteCount    50
  DOSPageInterval   1
  DOSSiteInterval   1
  DOSBlockingPeriod  30
< /IfModule>
----------------------------------------------
DOSHashTableSize  3097

hash table의 크기. IP, URI등을 분석하기 위한 공간으로 쓰이는 것 같은데 정확히는
모르겠다. 접속이 많은 서버이면 수치를 높인다.

DOSPageCount    3
DOSPageInterval   1

DOSPageInterval에서 지정한 시간(초단위)동안 같은 페이지를 3번 요청한 경우
해당 클라이언트 IP를 블럭킹한다. 블럭킹되는 동안에 사용자에게는 403(Forbidden)
코드가 전송된다.

DOSSiteCount    50
DOSSiteInterval   1

DOSSiteInterval에서 지정한 시간동안 어느 페이지나 이미지든 요청 건수가 50번을 넘는
경우 해당 클라이언트 IP를 블럭킹한다. 403코드 보내는 것은 마찬가지.
HTML 내에 이미지가 10개이면 요청 건수는 HTML포함하여 11번이 되므로 이미지가 많은
사이트는 숫자를 크게한다.

DOSBlockingPeriod  30

블럭킹된 IP는 30초동안 접속을 할 수 없다.

3. 모듈 사용을 중지하려면

차단 기능을 이용하지 않기 위해

DOSPageCount 0
DOSSiteCount 0

와 같이 하면 모듈 내부의 default값을 이용해서 동작하므로 LoadModule, AddModule를
주석 처리하는 방법을 써야한다. 또는 Count값을 상당히 큰 수를 지정할 수도 있겠다.

4. 차단하는지 테스트

간단한 테스트 툴로 test.pl을 제공한다.
12번째 줄에

printf("%03d ", $_ );

를 추가하고

apache를 실행시킨 다음 perl test.pl을 해보면 200 OK, 403 Forbidden 된 것을 쉽게
확인할 수 있을 것이다.

DOSPageCount, DOSSiteCount 수치를 너무 낮게 하면 정상적인 접속에 대해서도 차단될 수
있으므로 주의해야 한다. 수치를 낮추고, 같은 페이지를 reload(Ctrl+R)를 여러번했더니
바로 403 페이지가 등장.

403 페이지를 별도로 만드는 것이 좋을 듯 싶다. httpd.conf에 ErrorDocument 403 ... 설정
으로 html을 만들어두면 방문자에게 도움이 되지 않을까...

이젠 ab, lynx 등으로 게시물 조회수를 순간적으로 올린다거나, 시스템 로드를 증가시키는
것까지도 어느정도 막을 수 있을 것이다.

※ syslog 로 로그 남기는 기능과 DOSEmailNotify, DOSSystemCommand 옵션은 제대로 적용
  되지 않아 이 글에 적지 않았다. 정상동작이 확인되면 그 때 추가할 것이다.
2006/09/11 10:23 2006/09/11 10:23
이 글에는 트랙백을 보낼 수 없습니다
출처 블로그 > [베베] 내 작은 버둥거림..
원본 http://blog.naver.com/babyj2005/19969091

# cd /usr/local/src

# wget http://mirror.trouble-free.net/dosevasive/mod_evasive_1.10.1.tar.gz

# tar xvfz mod_evasive_1.10.1.tar.gz

# cd mod_evasive

# /usr/local/httpd/bin/apxs -i -a -c mod_evasive20.c


-----------------------

<IfModule mod_evasive20.c>
   DOSHashTableSize    3097
   DOSPageCount        5
   DOSSiteCount        50
   DOSPageInterval     1
   DOSSiteInterval     1
   DOSBlockingPeriod   30
   DOSEmailNotify      내 메일주소
   DOSLogDir           "/usr/local/apache/log/mod_evasive"
</IfModule>

2006/09/11 10:23 2006/09/11 10:23
이 글에는 트랙백을 보낼 수 없습니다
출처 블로그 > 공부중...
원본 http://blog.naver.com/soya98/40019330983

아이피 주소를 도메인에 포워딩 하는중 문제가 발생했다. 잘 묵히던

팝업이 갑자기 안묵히고 난리다. 쿠키값을 확인해본 결과 잘 들어가져 있었으나 포워딩된

주소에서는 그 쿠키 값을 거부하고 있었다 ..

닷네임에서 확인해본 결과 아래와 같이 설명하고 있었다...

==================================================================

서로 다른 도메인을 포함하는 프레임 구조로 사이트를 IE6에서 열게 되면, 쿠키가 적용되지 않습니다.
이유는 마이크로 소프트에서 쿠키 정보의 남용을 막기 위해 p3p (Platform for Personal Preferences) 규약을 도입했기 때문입니다.
p3p (Platform for Personal Preferences) 규약은 W3C ( World wide Consortium )에서 만들어 졌습니다.
(마이크로 소프트 p3p 정책 http://msdn.microsoft.com/library/default.asp?url=/workshop/security/privacy/overview/createprivacypolicy.asp)
(W3C - p3p 규약 http://www.w3.org/TR/2002/REC-P3P-20020416/ )

그래서 다른 주소지로 연결되는 프레임구조로(특히 포워딩 고정 연결시) 웹페이지가 열리게 되면, 쿠키가 적용되지 않게 됩니다.

두가지 해결 방안이 있습니다.

첫번째는 쿠키를 적용하는 웹페이지에서 p3p 규약을 허용하는 HTTP 헤더를 추가하는 방법과
두번째는 쿠키를 적용하는 웹서버에서 p3p 규약을 허용하는 HTTP 헤더 추가하는 방법입니다.
===================================================================

무식하게 나마 세번째 방법이 있다.

세번째는 인터넷익스플로러에서 직접 설정을 해주는 것이다.


첫번째는 클라이언트 컴퓨터에서 볼때 설정해주는 것이다 즉 웹페이지에 직접 적어 넣는다.

<head>

< meta http - equiv = "p3p" content = 'CP="CAO DSP AND SO " policyref="/w3c/p3p.xml"' >

</head>


심플하게 php에 들어있는 자바스크립트로 만든 팝업등에서 써먹을 수도 있다.


두번째는  서버에서 직접 설정하는 것인데 왠지 께림찍해서 거부했다.

리누기 conf/httpd.conf 에 다음과 같이 추가한다.

<IfModule mod_headers.c>
Header add P3P "CP=\"ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC\""
Header set P3P "CP=\"ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC\""
</IfModule>

그리고 데몬을 다시 구동 시켜야 겠지요?


세번째 무식한 방법

도구-인터넷옵션-개인정보-고급-자동쿠키덮어쓰기 (제3사 쿠키라고 한다.) 체크해주면 됨





기타 언어별 p3p 셋팅법

<meta http-equiv> 처럼 메타태그를 이용한 헤더 전송방법
아파치서버의 mod_headers 모듈을 이용한 방법
PHP 의 header 를 이용한 방법등이 있다.

jsp의 header

asp의 header

메타태그:
<meta http-equiv="p3p" content='CP="CAO DSP AND SO " policyref="/w3c/p3p.xml"' >


아파치서버 conf/httpd.conf :

<IfModule mod_headers.c>
#Header add P3P "CP=\"DSP CUR OTPi IND OTRi L FIN\""
</IfModule>


php :

<?php
Header
("p3p: CP=\"CAO DSP AND SO ON\" policyref=\"/w3c/p3p.xml\"");
?>

혹은( 이상하게 아래것은 안묵히는것 같다.)

<?

header('P3P: CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"');

?>

asp:

<% '//W3C P3P 규약설정 - ASP 버전
Response.AddHeader "P3P", "CP='ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC'"
%>

jsp:

Response.setHeader("P3P","CP='CAO PSA CONi OTR OUR DEM ONL'");

p.s php에서 적용이 안돼서 팝업창과 부모창 모두에게

<?
@header('P3P: CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"');
?>
<html>
<head>
<title>  </title>
<meta http-equiv="p3p" content='CP="CAO DSP AND SO " policyref="/w3c/p3p.xml"' >
</head>

위와 같이 적용한 결과 해결되었음

written by soya98

2006/09/11 10:22 2006/09/11 10:22
이 글에는 트랙백을 보낼 수 없습니다
웅쓰:웅자의 상상플러스
웅자의 상상플러스
전체 (379)
게임 (5)
영화 (2)
기타 (23)
맛집 (5)
영어 (2)
대수학 (3)
형태소 (5)
Hacking (9)
Linux (112)
HTML (48)
Application_developing (48)
Web_developing (102)
Window (11)
«   2006/09   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
  1. 2016/01 (1)
  2. 2015/12 (3)
  3. 2015/10 (3)
  4. 2015/03 (2)
  5. 2015/01 (4)