Debian Sarge 에서 etch 로 업글...

ㅡ.ㅡ 뭐... 뜻하지 않게 ... 업글을 하게 되었지만...

이제 ... 컴파일에 손 댈일이 거의 없어진듯 하다...

기존 Sarge에서 문제가 되었던 apache 2 / php5 / mysql 5 가 완전히 구현이 된다.

기존 Sarge는 이런 문제때문에 APM 부분을 소스 컴파일을 했는데...

etch 로 넘어 오면서는... 패키지에 들어있는 APM을 이용했다...

뭐... 안정성이야... 허접한 내가 컴파일 한거보단 낫겠지 싶지만...

블로그 돌려 보면서... 문제점을 찾아 봐야겠다.

후훗...

ㅡ.ㅡ 오늘... 이상하게 눈의 피로가 많이 느껴진다...


크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2007/06/12 19:10 2007/06/12 19:10
, , , ,
Response
0 Trackbacks , 0 Comments
RSS :
http://blog.blog.n-nuri.com/rss/response/396

Trackback URL : http://blog.blog.n-nuri.com/trackback/396

Leave a comment
[로그인][오픈아이디란?]

Apache 무단링크 방지

Apache 2.x

httpd.conf 파일을 열어서

<Directory "해당 경로">
Oprion FollowSymLinks
AllowOverride None

## 링크 허용 부분
SerEnvIfNoCase Referer ^http://domain.com goout
SerEnvIfNoCase Referer ^http://domain.net goout

#이미지가 새창을 열경우 엑박(X)으로 보이는걸 방지하기 위한 레퍼럴이 존재하지 않는 요청
SerEnvIfNoCase Referer ^$ goout

# 파일 확장자 지정하기
<Files ~ "\.(gif|jpe?g|png|bmp|zip|tar|rar|alz|a00|ace|txt|mp3|mpe?g|wav|asf|wma|wmv|swf|exe)$">
Order deny,allow
deny from all
allow from env=goout

## 무단 링크시 띄워줄 에러
ErrorDocument 403 http:// 경고를 보여줄 Img 나 html
</Files>
</Directory>



참고 : http://www.neosky.info 
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2007/04/20 11:42 2007/04/20 11:42
,
Response
0 Trackbacks , 0 Comments
RSS :
http://blog.blog.n-nuri.com/rss/response/301

Trackback URL : http://blog.blog.n-nuri.com/trackback/301

Leave a comment
[로그인][오픈아이디란?]

아파치 설정 활용 예(서비스 제한측면)

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

제  목 : 아파치 설정 활용 예(서비스 제한측면)
작성자 : 좋은진호(truefeel, http://coffeenix.net/ )
작성일 : 2003.2~
정리일 : 2005.1.28(금)

아파치 웹서버의 활용에 있어, 보다나은 보안 설정 방법 몇 가지를 소개한다.

특정 Agent가 자꾸 사이트에 들어와서 긁어간다든지,
이미지 파일을 외부에서 링크하지 못하도록 한다든지,
특정 IP에서는 인증없이, 그 이외 IP에서는 아파치 인증을 통해서만 페이지를 보게하는
등의 응용적인 측면에서 방법들이다.
이 방법들은 제가 사용하고 있는 몇가지 방법을 정리하는 의미에서 적은 것이다.

1. 특정 브라우저의 접속을 차단

--------------------------------------------------------------------
SetEnvIfNoCase User-Agent "^Microsoft URL Control" dont_want

<Directory /usr/local/apache/htdocs>
   <Limit GET POST>
        Order Allow,Deny
        Allow from all
        Deny  from env=dont_want
   </Limit>
</Directory>
[/quote]
--------------------------------------------------------------------

----------------------------------------------
SetEnvIfNoCase User-Agent "^Wget" bad_bot
SetEnvIfNoCase User-Agent "^EmailSiphon" bad_bot
SetEnvIfNoCase User-Agent "^EmailWolf" bad_bot

The 'SetEnvIfNoCase' simply sets an enviornment (SetEnv) variable called
'bad_bot' If (SetEnvIf) the 'User-Agent' string contains Wget, EmailSiphon, or
EmailWolf, regardless of case (SetEnvIfNoCase). In english, anytime a browser
with a name containing 'wget, emailsiphon, or emailwolf' accesses our website,
we set a variable called 'bad_bot'. We'd also want to add a line for the
User-Agent string of any other Spidert we want to deny.

Now we tell Apache which directories to block the Spiderts from with the
<Directory> directive:

<Directory "/home/evolt/public_html/users/">
        Order Allow,Deny
        Allow from all
        Deny from env=bad_bot
</Directory>

2.  다른 곳에서 images를 link하지 못하도록

1) 디렉토리를 제한하는 방법

referer 체크를 통해 외부에서 /images 이하디렉토리의 파일을 link하지 못하도록 한다.
이를테면 truefeel.kr 이라는 사이트가 있을 때
truefeel.kr내에 있는 동영상을 이 도메인에서는 링크할 수 있지만
외부 사이트에서는 이 동영상을 링크해도 권한이 없도록 할 수 있다.

--------------------------------------------------------------------
SetEnvIf Referer "^http://localhost/"  local_referal
SetEnvIf Referer "^http://127.0.0.1/"  local_referal
SetEnvIf Referer "^http://홈페이지명/" local_referal
SetEnvIf Referer "^$"                  local_referal

<Directory /usr/local/apache/htdocs/images>
   Order Deny,Allow
   Deny  from all
   Allow from env=local_referal
</Directory>
--------------------------------------------------------------------

2) 이미지 파일 확장자로 제한하는 방법 (서비스 페이지가 ????.truefeel.kr 일 때)
                                                                                   
--------------------------------------------------------------------
SetEnvIfNoCase Referer "^http://localhost/"        local_referal
SetEnvIf       Referer "^http://127.0.0.1/"        local_referal
SetEnvIfNoCase Referer "^http://(.*).truefeel.kr/" local_referal
SetEnvIfNoCase Referer "^http://truefeel.kr/"      local_referal
SetEnvIfNoCase Referer "^$"                        local_referal
                                                                                   
<Files ~ "\.(gif|jpg|jpeg|png|bmp)$">
   Order deny,allow
   Deny  from all
   Allow from env=local_referal
</Files>
--------------------------------------------------------------------

3. 특정 IP에서만 접근 가능하게

너무나도 흔한 방법이긴 한데, 개인적으로 저에게 이런 부분을 물어보시는 분이 많았다.
아래의 예는 /usr/local/apache/htdocs 디렉토리를 211.111.222.0/24 대역에서만 접근가능한 설정이다.

--------------------------------------------------------------------
<Directory "/usr/local/apache/htdocs">
    Options FollowSymLinks MultiViews
    AllowOverride AuthConfig
    Order deny,allow
    Deny from all
    Allow from 211.111.222.0/255.255.255.0
</Directory>
--------------------------------------------------------------------

반대로 아래와 같이 하면 지정한 IP대역에서만 접근할 수 없다.

--------------------------------------------------------------------
... 생략 ...
    Order allow,deny
    Allow from all
    Deny from 211.111.222.0/255.255.255.0
... 생략 ...
--------------------------------------------------------------------

4. 특정페이지를 인증된 사용자만 볼 수 있는 아파치 인증 설정

이번 글은 5번의 인증 설정을 알기 전에 아파치 인증에 대해 모르는 분을 위해 적은 것으로
아파치 인증이 무엇인지 안다면 5번으로 바로 넘어가기 바란다.

아파치에서는 특정 페이지를 접근할 때 ID와 비밀번호를 알아야만 접근하도록 설정할 수 있다.
다음 예를 보자.

--------------------------------------------------------------------
<Directory "/home/truefeel/public_html">
            Options FollowSymLinks MultiViews
            AllowOverride AuthConfig
</Directory>
--------------------------------------------------------------------

위 처럼 AllowOverride AuthConfig 설정을 하면 ~truefeel/public_html 디렉토리에 인증 과정을
거치는 기본 설정은 된 것이다.
만약 ~truefeel/public_html/manager/ 아래의 디렉토리에 인증을 걸려고 한다면 그 디렉토리에
다음과 같은 형식의 .htaccess 파일을 생성한다.

[ ~truefee/public_html/manger/.htaccess 파일 내용 ]
--------------------------------------------------------------------
AuthType Basic
AuthName User   <-- "User" 는 인증창에 표시될 메시지 중의 하나일 뿐 신경쓸 필요 없다.
AuthUserFile /home/truefeel/manage/.htpasswd
AuthGroupFile /dev/null
<Limit GET POST>
require valid-user
</Limit>
--------------------------------------------------------------------

.htpasswd 파일에 ID/PW를 생성해두면 해당페이지 인증을 할 수 있게 된다.

5. 특정 IP는 인증없이, 그 이외는 아파치 인증 거치도록

아래의 설정은 위의 4번 글을 읽었다면 뭔가 종합적인 설정을 한 것 처럼 보일 것이다.

--------------------------------------------------------------------
<Location />
    AuthType Basic
    AuthName User
    AuthUserFile /home/truefeel/manage/.htpasswd
    AuthGroupFile /dev/null

    require valid-user
    order deny,allow
    deny  from all
    allow from 211.111.222.0/255.255.255.0
    Satisfy any
</Location>
--------------------------------------------------------------------

위의 설정은
- 211.111.222.0/24 IP 대역에 있는 접속자는 인증없이 통과하고,
- 그 이외의 IP 대역에서 접속하면 인증을 거쳐야하는 설정이다.
이 설정은 Satisfy any 지시자를 통해서 이뤄진다. IP가 맞거나 ID/PW가 맞으면 되는 것이다. (OR)

만약 Satisfy all 이라고 적었다면
- IP대역이 211.111.222.0/24 이면서
- 인증까지 모두 통과 해야
해당 페이지에 접근이 가능하다. (AND)

6. 업로드 디렉토리의 .php파일은 text처럼 인식하기

php나 cgi 등으로 파일 업로드 가능하도록 구현된 경우 .php나 .html 등의 파일을 업로드할 수
있는 실수를 범할 수 있다.

이런 실수를 하더라도 지정한 업로드 디렉토리에 있는 .php나 .html 파일을 php프로그램으로
인식하지 않고 일반 텍스트 파일로 판단하도록 설정하여 보다 안전한 웹페이지 구성이 가능하다.
다음은 /upload/ 와 /files/ 디렉토리 아래의 php파일은 일반 텍스트로 인식하라는 설정이다.

--------------------------------------------------------------------
<Directory ~ "/usr/local/apache/htdocs/(upload|files)">
        RemoveType .html .php
</Directory>
--------------------------------------------------------------------

위에서 ~ 기호는 디렉토리 경로에 정규 표현식을 사용하겠다는 의미로 (upload|files) 부분을
정규 표현식으로 인식한다. 따라서 htdocs/ 이하의 upload 디렉토리와 files 디렉토리를 의미한다.

단순히 /home/truefeel/public_html/data 디렉토리라면
<Directory "/home/truefeel/public_html/data"> 와 같이 설정하면 된다.

7. 참고 자료

* Apache Directives
  http://httpd.apache.org/docs/mod/directives.html
* Apache Authentication and Access Control
  http://www.apache.kr.net/documents/authplus-story.html

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2007/04/20 10:16 2007/04/20 10:16
Response
0 Trackbacks , 0 Comments
RSS :
http://blog.blog.n-nuri.com/rss/response/300

Trackback URL : http://blog.blog.n-nuri.com/trackback/300

Leave a comment
[로그인][오픈아이디란?]

글쓴이 : 좋은진호(truefeel, http://coffeenix.net/)
글쓴날 : 2004.2
정리일 : 2004.8.10(정리)
제  목 : [튜닝] apache에서 이미지 캐싱 처리(mod_expires)

apache에서는 mod_expires 모듈을 통해 Expires HTTP header 를 설정할 수 있다.
이를 통하여 클라이언트(웹페이지 방문자)에 캐싱되는 문서나 이미지들이 많아서 트래픽을
감소시킬 수 있다. 이미지 전용 서버나 이미지 디렉토리에 설정을 해두면 효과적이다.

이미지 서버에 지정한 다음 예를 보자.

-----------------------------------------------------------
<IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault "access plus 1 month"

        # 제외할 디렉토리
        <Directory "/usr/local/apache/htdocs/temp">
        ExpiresActive Off
        </Directory>
</IfModule>
-----------------------------------------------------------

- ExpiresActive On 지시자로 Expires 설정을 enable 한다.
- ExpiresDefault "access plus 1 month" 지시자는 액세스한지 얼마나 지나서 expire할 것인지를 지정한다.
  즉, 지정한 기간만큼 클라이언트에 캐싱이 된다. 위에는 1달이다.

이외에 클라이언트에서 액세스한지 1달, 4주, 30일, 1년 등과 같은 expire 주기와
서버의 파일의 수정 시간으로 expire 주기를 설정할 수 있다.

-----------------------------------------------------------
ExpiresDefault "access plus 1 month"
ExpiresDefault "access plus 4 weeks"
ExpiresDefault "access plus 30 days"
ExpiresDefault "access plus 1 years"
ExpiresDefault "modification plus 30 days"
-----------------------------------------------------------

- 설정 마지막부분에 Directory 지시자와 ExpiresActive Off 설정을 통해
  특정 디렉토리만 expire 설정에서 제외할 수 있다.
  반대로 특정 디렉토리만 On으로도 설정할 수 있다. (일반 웹서버에 /images 와 같이 디렉토리가 있는 경우)

-----------------------------------------------------------
ExpiresByType image/gif "acces plus 4 weeks"
-----------------------------------------------------------

- 위처럼 파일의 유형으로도 가능하다.

아주 간단하지 않는가?

참고로 [다음(daum)] 의 이미지 서버는 28일(4주)로 [야후!코리아] 는 5년으로 설정되어 있다.

* 참고 자료 : http://httpd.apache.org/docs/mod/mod_expires.html

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2007/04/20 10:13 2007/04/20 10:13
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://blog.blog.n-nuri.com/rss/response/299

Trackback URL : http://blog.blog.n-nuri.com/trackback/299

Leave a comment
[로그인][오픈아이디란?]

Debian Sarge php4에 Mysql 4.x 설치 실패

최근에...

기존 apache 1.x, php 4.x , mysql 3.x 를 사용하다가

최신으로 업데이트를 해야겠단 생각에 ... 업데이트에 도전하게 되었다.

하지만 내게 다가온건...

OTL 뿐이었다... 뭐... 내가 능력이 없는건 사실이지만... apt-get 로 해당 데몬 및 라이브러리를 쭈욱 넣어서

설치를 하였지만... 다른건 다 되는데 mysql 4.x php에 올라오지 않는것이다

이렇게도 해 보고 저렇게도 해보고...

결국엔 ㅡ.ㅡ 포기하고

기존 라이브러리는 apt-get 로 설치를 하고 APM만 소스 설치를 하였다

뭐... 이렇게 해도 기존 라이브러리를 하나씩 하나씩 설치해줄 필요가 없어서... 충분히 편한 작업 이었다.

혹시 몰라 APM configure를 올려 놓는다

ㅡ.ㅡ php 설치시 없는 라이브러리는 apt-get 로 설치 해주면 된다... 뭐... 아니다 싶으면 소스 설치를 해도 무관하다

Msql 5.x

./configure \
--prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data \
--disable-shared --enable-assembler \
--with-thread-safe-client --with-mysqld-user="mysql" \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--with-readline --without-debug \
--without-docs --without-bench \
--with-charset=utf8

Mysql은 UTF-8로 설치하고

my.cnf에

[client]
default-character-set=utf8

[mysqld]
default-character-set=utf8
init_connect=SET NAMES utf8

추가 해주면 된다.

Apche 2.x

./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-so --enable-rewrite

PHP 5.x

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-tiff-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --enable-gd-imgstrttf --enable-memory-limit --disable-debug --with-reges=php --disable-rpath --disable-static --with-pic --with-layout-GNU --enable-calendar --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-bcmath --enable-ctype --with-iconv --enable-exif --enable-filepro --enable-ftp --with-gettext -enable-mbstring --enable-shmop --enable-sockets --enable-wddx --enable-xml --with-expat-dir=/usr --with-xmlrpc --enable-yp --with-zlib --with-kerberos=/usr --with-openssl=/usr --with-zip=/usr --enable-dbx --with-mime-magic=/usr/share/misc/file/magic.mime --with-exec-dir=/usr/local/php/libexec --with-mysql=/usr/local/mysql --without-sybase-ct --enable-url-fopen-wrapper=yes


혹시???

성공 하신분은... 코멘트 남겨 주시면 감사 하겠습니다.
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2007/04/18 14:18 2007/04/18 14:18
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://blog.blog.n-nuri.com/rss/response/288

Trackback URL : http://blog.blog.n-nuri.com/trackback/288

Leave a comment
[로그인][오픈아이디란?]

블로그 이미지

http://blog.n-nuri.com 이 접속이 안 될경우 http://x2x.dnip.net 으로 접속해 주세요 공유하지 않는 지식은 썩은 물과 같다~~~!!!

- 삐꾸강아쥐

Archives

Recent Trackbacks

Calendar

«   2009/01   »
        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 31

Site Stats

Total hits:
227687
Today:
38
Yesterday:
279
free counters