달력

32024  이전 다음

  • 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

저번 주말엔 큐메일서버를 가지고 끙끙댔었습니다.


서핑중에 좋은 스크립트를 발견해서 올립니다.


큐메일 서버의 상태, 메일큐 제어 등을 할 수 있습니다.





'OS > LINUX' 카테고리의 다른 글

메일서버 릴레이 테스트  (0) 2006.06.16
[qmail]queue-fix  (0) 2006.05.30
qmail 설치후 queue 에 계속 쌓일 경우 .. 퍼미션 조절해주기..  (0) 2006.02.27
qmail+vpopmail 설치  (0) 2006.02.24
Apache James Setting  (0) 2006.02.23
Posted by tornado
|

linux.ro Forum Index ? ? Configurare linux ? ? Pb qmail
Autor Pb qmail
georgem1971


Inregistrat: Sep 13, 2003
Postari: 18
Sistem de operare: Red Hat

Postat: 2004-05-16 13:40   
Uh-oh:_.qmail_has_prog_delivery_but_has_x_bit_set._(#4.7.0)/ = asta e eroarea din /var/log/qmail/qmail-send.Mailurile ajung de la user@domeniu la orice alta adresa numai la cea locala nu.(de la user@domeniu catre orice@domeniu nu vine nimich)
Multumesc!!!


Vezi profilul lui georgem1971   Email georgem1971       Editeaza/Sterge This Post   Reply with quote
horchi


Inregistrat: Mar 07, 2003
Postari: 119
Sistem de operare: Free BSD &


De la: Bucuresti
Postat: 2004-05-17 08:35   
Salut!
Din cate cred ai instalat qmai+vpopmail. Daca e asa chmod -x /home/vpopmail/domain/domenui.ro/.qmail-default. De asemenea trebuie sa stii ca orice fisier .qmail- nu trebuie sa aiba setat +x (risc de securitate). In concluzie e bine sa faci un chmod -x la toate fisierele .qmail- (inclusiv acelea din /var/qmail/alias/)
Bafta!
_________________
Actually, unix is a very user-friendly system. It’s just that it is particular about which users it chooses to be friendly with.


Vezi profilul lui horchi   Email horchi     Editeaza/Sterge This Post   Reply with quote

http://www.linux.ro/forum/viewtopic.php?topic=10831&forum=6&1

'OS > LINUX' 카테고리의 다른 글

[qmail]queue-fix  (0) 2006.05.30
[qmHandle 1.2] 큐메일 제어 스크립트  (0) 2006.05.29
qmail+vpopmail 설치  (0) 2006.02.24
Apache James Setting  (0) 2006.02.23
sendmail 설정후 외부메일 안들어올때 -0-  (0) 2006.02.21
Posted by tornado
|

qmail+vpopmail 설치

OS/LINUX 2006. 2. 24. 12:54
qmail + vpopmail 설치편


qmail을 설치해봅시다. 여기서는 qmail+vpopmail+mysql+courier-imap 기반으로 설치를 합니다.

설치할 소스
apache_1.3.31 (http://httpd.apache.org/download.cgi)
php_4.3.7 (http://www.php.net/downloads.php)
mysql_4.0.20 (http://dev.mysql.com/downloads/)
gd_2.0.26 (http://www.boutell.com/gd/http/)
freetype_2.1.9 (http://prdownloads.sourceforge.net/freetype)
ZendOptimizer_2.5.2 (http://zend.com/store/products/zend-optimizer.php)
imap_4.7c2 (ftp://ftp.cac.washington.edu/imap/)
courier-imap_3.0.7 (http://prdownloads.sourceforge.net/courier/)
libiconv_1.9.1 (http://ftp.gnu.org/pub/gnu/libiconv/)
qmail_1.03 (http://qmail.org)
vpopmail_5.4.5 (http://www.inter7.com/vpopmail.html)
daemontools_0.76 (http://qmail.org/moni.csi.hu/pub/qmail/qmail-run/)
ucspi-tcp_0.88 (http://qmail.org/moni.csi.hu/pub/qmail/qmail-run/)
autorespond_2.0.2 (http://www.inter7.com/devel/)
ezmlm_0.53 (http://gd.tuwien.ac.at/infosys/mail/qmail/ezmlm-patches/)
qmailadmin_1.2.1 (http://www.inter7.com/qmailadmin/)
maildrop_1.5.2 (http://prdownloads.sourceforge.net/courier/)
ntop_3.0 (http://sourceforge.net/projects/ntop)
libpcab (ftp://ftp.ee.lbl.gov)

패치파일
gd 패치 : patch_gd2.0.26_gif_040622 (http://downloads.rhyme.com.au/gd/)
daemontools 패치 : daemontools-0.76.errno.patch (http://qmail.org/moni.csi.hu/pub/glibc-2.3.1/)
qmail 패치 : cocktail.patch (http://people.kldp.org/~eunjea/qmail/patch/)
ucspi-tcp 패치 : ucspi-tcp-0.88.errno.patch, ucspi-tcp-0.88.a_record.patch, ucspi-tcp-0.88.nobase.patch(http://qmail.org/moni.csi.hu/pub/glibc-2.3.1/)
ezmlm 패치 : idx.patch (http://qmail.org/moni.csi.hu/pub/glibc-2.3.1/)


▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧

1. 설치준비

먼저 설치할 소스를 다운받아 특정폴더에 넣어놓자

여기서는 /usr/local/source 디렉토리를 만들어서 여기에 모두 카피하였다.


2. RPM으로 설치된 패키지 제거

리눅스 설치를 everything으로 하였다면 rpm으로 APM이 설치되어있을 것이다.

해당 패키지들은 모두 제거해줘야한다.


먼저 관련 프로세스가 떠있는지 확인하고 떠있다면 죽여주자


apache 데몬이 있는지 확인

[root@localhost root]# ps -ef | grep httpd

root      4458  3462  0 20:02 pts/0    00:00:00 grep httpd

위와 같이 나오면 데몬이 없는 것이다.

실행중인 데몬이 있으면 데몬을 종료 (killall httpd)


mysql 데몬이 있는지 확인

[root@localhost root]# ps -ef | grep mysqld

이것 역시 떠있는 데몬이 있으면 종료해준다.


RPM 패키지 확인


설치된 apache 패키지 검색

[root@localhost root]# rpm -qa | grep httpd

httpd-manual-2.0.40-21

redhat-config-httpd-1.0.1-18

httpd-devel-2.0.40-21

httpd-2.0.40-21


apache 제거

[root@localhost root]# rpm -e --nodeps httpd-2.0.40-21

위와같은 방법으로 검색된 패키지들은 모두 삭제하자. --nodeps 옵션을 붙혀준 것은 의존성 때문이다.

이 옵션을 붙히지 않으면 다른 패키지가 이 패키지를 dependant 하고 있으므로 삭제할 수 없다는 메시지가 나온다.


설치된 mysql 패키지 검색

[root@localhost root]# rpm -qa | grep mysql

mysql-devel-3.23.54a-11

php-mysql-4.2.2-17

libdbi-dbd-mysql-0.6.5-5

mysql-server-3.23.54a-11

mysql-3.23.54a-11

mod_auth_mysql-1.11-12


mysql 제거

[root@localhost root]# rpm -e --nodeps mysql-3.23.54a-11

검색된 다른 패키지들도 동일한 방법으로 지워줌


설치된 php 패키지 검색

[root@localhost root]# rpm -qa | grep php

php-ldap-4.2.2-17

php-4.2.2-17

asp2php-gtk-0.76.2-5

php-manual-4.2.2-17

asp2php-0.76.2-5

php-devel-4.2.2-17

php-pgsql-4.2.2-17

php-odbc-4.2.2-17

php-snmp-4.2.2-17

php-imap-4.2.2-17


php 제거

[root@localhost root]# rpm -e --nodeps php-4.2.2-17

검색된 다른 패키지들도 동일한 방법으로 지워줌


gd 제거

[root@localhost root]# rpm -e --nodeps gd


freetype 제거

[root@localhost root]# rpm -e --nodeps freetype

3. libiconv 설치
웹메일에서 사용하게 될 iconv를 설치하자

[root@localhost root]# cd /usr/local/source/
[root@localhost source]# tar xvfz ./libiconv-1.9.1.tar.gz
[root@localhost source]# cd libiconv*
[root@localhost libiconv-1.9.1]# ./configure --prefix=/usr/local
[root@localhost libiconv-1.9.1]# make
[root@localhost libiconv-1.9.1]# make install


4. mysql 설치

mysql 그룹과 유저가 등록이 되어있는지 확인한다. 리눅스를 everything 으로 설치했다면 당연히 존재할것이다.

/etc/passwd 파일과 /etc/group 파일을 열면 존재여부를 확인할수 있다.


# vi /etc/passwd

:

mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash

:

# vi /etc/group

:

mysql:x:27:

:


보는바와 같이 이미 mysql 그룹과 유저가 생성되어 있다는 것을 알수 있다. Rpm으로 설치된 mysql때문이다.

만약 만약 생성되어있지 않다면 다음과같이 그룹과 유저를 추가시켜준다.


# groupadd mysql

# useradd -g mysql mysql


등록이 끝났으면 mysql을 다운받은 소스 디렉토리로 이동하여 설치할 준비를 하자

# cd /usr/local/source

[root@localhost source]# tar xvfz mysql*

[root@localhost source]# cd mysql*

[root@localhost mysql-4.0.20]# ./configure \

--prefix=/usr/local/mysql \

--with-charset=euc_kr \

--localstatedir=/usr/local/mysql/data


[root@localhost mysql-4.0.20]# make

[root@localhost mysql-4.0.20]# make install


인스톨까지 끝났다면 mysql에 사용될 기초적인 DB를 생성해준다.

[root@localhost mysql-4.0.20]# scripts/mysql_install_db


DB 생성후엔 데이터가 저장되는 폴더안의 내용물들의 소유권을 mysql 유저에게 주어야 한다.

[root@localhost mysql-4.0.20]# chown -R mysql.mysql /usr/local/mysql/data


환경설정 파일을/etc/my.cnf 에 복사한다.

[root@localhost mysql-4.0.20]# cp support-files/my-medium.cnf /etc/my.cnf


mysql 데몬스크립트 mysql.server 파일에 mysql_safe가 실행되는 라인에 language 옵션을 추가한다.

현재 설치하고 있는 mysql 버전은 4.0.20 임을 잊지말자.

[root@localhost mysql-4.0.20]# vi /usr/local/mysql/share/mysql/mysql.server

mysql.server 내용

$bindir/mysqld_safe --datadir=$datadir --language=korean --pid-file=$pid_file >/dev/null 2>&1 &


mysql 경로 설정

[root@dentistrytest mysql-4.0.20]# vi /root/.bash_profile

/usr/local/mysql/bin 추가

.bash_profile 내용

PATH=$PATH:$HOME/bin:/usr/local/mysql/bin


부팅시 자동실행될 수 있도록 링크를 걸고 데몬을 띄워보자

[여기서 잠깐!]

mysql rpm 패키지를 제거할 때 관련패키지를 제거하지 않았다면 기존의 mysql이 부팅시 자동실행되도록 등록되어있을것이다. 여기서는 위와같이 링크를 걸어줬으므로 이 링크파일은 제거해줘야한다. 아까전에 생성한 링크원본 파일이 리눅스 배포판의 mysql데몬 이름과 같다면 새롭게 링크를 걸 필요가 없지만 지우고 새로이 만드는게 좋다.


root@localhost mysql-4.0.20]# cd /etc/rc.d/init.d/rc3.d

root@localhost rc3.d]# ls al *mysql*

lrwxrwxrwx    1 root     root           16 Oct 11 15:21 K20mysqld -> ../init.d/mysqld


위와같이 mysql 관련 링크가 있으면 삭제해주자

root@localhost rc3.d]# rm rf K20mysqld


rc5.d 디렉토리 내용도 똑같이 삭제해준다.

root@localhost mysql-4.0.20]# cd /etc/rc.d/init.d/rc5.d

root@localhost rc5.d]# ls al *mysql*

lrwxrwxrwx    1 root     root           16 Oct 11 15:21 K20mysqld -> ../init.d/mysqld

root@localhost rc5.d]# rm rf K20mysqld


이제 링크를 걸어주면 되겠다.

root@localhost mysql-4.0.20]# cp -p /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld

이 과정에서 혹 같은 이름의 파일이 존재한다는 경고창이 나오면 y를 누르고 그냥 무시하자

root@localhost mysql-4.0.20]#ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/S90mysqld

root@localhost mysql-4.0.20]#ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc5.d/S90mysqld

root@localhost mysql-4.0.20]# /etc/rc.d/init.d/mysqld start


위와같이 링크를 걸지 않고 편하게 하고 싶다면 /etc/rc.d/rc.local 파일을 vi 에디터로 열어서 제일 마지막 라인에

데몬파일의 경로를 써주면 되겠다.


mysql 데몬 확인

# ps -ef | grep mysql

mysql     3537  3501  0 15:02 ?        00:00:00 [mysqld]

500       4055  3421  0 15:04 pts/0    00:00:00 grep mysqld


이제 다 끝났으면 mysql에 접속을 해보자

[root@localhost mysql-4.0.20]# /usr/local/mysql/bin/mysql mysql

mysql>


위와같이 프롬프트가 떴다면 정상적으로 설치된것이다.

기타 mysql 계정 추가하는 법은 여기서 설명하지 않겠다. DB 계정추가 및 자세한 사항은 MYSQL TIP 메뉴를 이용 바란다.


5. Freetype 설치

# cd /usr/local/source

[root@localhost source]# tar xvfz freetype-2.1.9*

[root@localhost source]# cd freetype-2.1.9

[root@dentistrytest freetype-2.1.9]# ./configure

[root@dentistrytest freetype-2.1.9]# make

[root@dentistrytest freetype-2.1.9]# make install



6. GD 설치

# cd /usr/local/source

[root@localhost source]# tar xvfz gd*

[root@localhost source]# cd gd*


gif 지원을 위해 패치를 해준다. 현재 GD버전은 gd-2.0.26이다.

본인의 경우는 패치파일들은 모두 /usr/local/source/patches에 모아놨다. 패치파일이 다른 디렉토리에 있다면 경로를 적절하게 써주면 되겠다.

[root@localhost gd-2.0.26]# patch -l < ../patches/patch_gd2.0.26_gif_040622

[root@localhost gd-2.0.26]# ./configure --prefix=/usr/local/gd --with-freetype=/usr/local/include/freetype2

[root@localhost gd-2.0.26]# make

[root@localhost gd-2.0.26]# make install



7. Apache 설치(1)

php 컴파일을 위해 apache 를 설정해준다.

# cd ..

[root@localhost source]# tar xvfz apache*

[root@localhost source]# cd apache*

[root@localhost apache_1.3.31]# ./configure -prefix=/usr/local/apache


8. IMAP 설치 (웹메일도 설치할 경우만)

이쯤에서 php 컴팔할때 사용할 IMAP을 설치해주자 IMAP2001 시리즈나 2002시리즈는 비추한다. IMAP4.7C2 강추!

최신 버전의 레드햇 계열에서 그냥 컴파일을 한다면 우리는 time.h 오류를 접할수 있을것이다.
IMAP configure 소스파일의 경로가 /usr/include/sys/time.h 로 되어있는데 한스텝 올려줘야 에러가 안난다.
현재 설치버전을 반드시 기억하기 바란다. 곧 이러한 삽질을 줄여줄수 있는 버전이 나올것이다.

# mv /usr/include/sys/time.h /usr/include/sys/time.h.ori
# ln -s /usr/include/time.h /usr/include/sys/time.h

설정이 끝났으면 IMAP을 설치하자

# cd /usr/local/source/
[root@localhost source]# tar xvfz imap*
[root@localhost source]# cp ?R imap* /usr/local/
[root@localhost source]# mv /usr/local/imap* /usr/local/imap
[root@localhost source]# cd /usr/local/imap
[root@localhost imap]# make slx
[root@localhost imap]# ln -s c-client include
[root@localhost imap]# ln -s c-client lib
[root@localhost imap]# cd c-client
[root@localhost c-client]# ln -s c-client.a libc-client.a
[root@localhost c-client]# cd ..
[root@localhost imap]# cp imapd/imapd /usr/sbin/in.imapd

xinetd.d/imap 파일을 vi 에디터로 열어서 아래와같이 수정한다. 만약 존재하지 않는다면 만들어준다.
[root@localhost imap]# vi /etc/xinetd.d/imap
service imap
{
        disable = no
        flags = REUSE
        socket_type = stream
        protocol = tcp
        wait = no
        user = root
        server = /usr/sbin/in.imapd
        log_on_failure += USERID
}


xinetd 데몬을 다시 띄우고 time.h를 원상복구 시켜준다.

[root@localhost imap]# /etc/init.d/xinetd restart
[root@localhost imap]# rm /usr/include/sys/time.h
[root@localhost imap]# mv /usr/include/sys/time.h.ori /usr/include/sys/time.h


9. php 설치

이제 php 설치를 한다. 여기서 좀 특별한 것은 는 imap function과 iconv function을 사용하기 위해 옵션을 추가한점이다.

# cd /usr/local/source

[root@localhost source]# tar xvfz php*

[root@localhost source]# cd php*


[root@localhost php-4.3.7]# ./configure --with-config-file-path=/etc \
 --with-exec-prefix=/usr/bin \
 --with-mysql=/usr/local/mysql \
 --with-apache=../apache_1.3.31 \
 --with-imap=/usr/local/source/imap-4.7c \
 --with-gd=/usr/local/gd \
 --with-freetype-dir=/usr/local/include/freetype2 \
 --with-jpeg-dir=/usr/lib/ \
 --with-png-dir=/usr/lib/ \
 --with-zlib-dir=/usr/lib/ \
 --with-language=korean \
 --with-charset=euc-kr \
 --disable-debug \
 --enable-track-vars \
 --enable-safe-mode \
 --enable-gd-native-ttf \
--with-kerberos \
 --enable-mbstring \
 --with-mime-magic \
 --with-iconv=/usr/local/lib/


[root@localhost php-4.3.7]# make

[root@localhost php-4.3.7]# make install


php 환경설정 파일 복사

[root@localhost php-4.3.7]# cp ./php.ini-dist /etc/php.ini


10. apache 설치(2)

[root@localhost php-4.3.7]# cd ../apache*

[root@localhost apache_1.3.31]# ./configure --prefix=/usr/local/apache \

--activate-module=src/modules/php4/libphp4.a \

--enable-module=so \

--enable-shared=max \

--sysconfdir=/usr/local/apache/conf \

--htdocsdir=/usr/local/apache/htdocs \

--logfiledir=/var/log/httpd


[root@localhost apache_1.3.31]# make

[root@localhost apache_1.3.31]# make install


인스톨이 끝났으면 httpd.conf 파일을 수정해줘야한다.

[root@localhost apache_1.3.31]# vi /usr/local/apache/conf/httpd.conf


- ServerName 부분을 주석 해제하고 본인의 아이피나 도메인으로 설정한다.

ServerName 127.0.0.1


- 아래 부분에 index.php 추가

<IfModule mod_dir.c>

    DirectoryIndex index.html index.php

</IfModule>


- AddType 추가

AddType application/x-httpd-php .php .php3 .inc .ph .htm .html

AddType application/x-httpd-php-source .phps


디렉토리 보안을위해 Options 부분 Indexes 를 삭제해준다.

Options Indexes FollowSymLinks MultiViews


시스템 부팅시에 자동 실행되도록 링크를 걸어준다.

[root@localhost apache_1.3.31]# cp -p /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd

[root@localhost apache_1.3.31]# ln s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S99httpd

[root@localhost apache_1.3.31]# ln s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S99httpd

[root@localhost apache_1.3.31]# /etc/rc.d/init.d/httpd start


<P style="FONT-SIZE: 12px; MARGIN: 0px
Posted by tornado
|

Apache James Setting

OS/LINUX 2006. 2. 23. 15:31

Apache James 2.1 Setting

mail server로 대다수 서버는 sendmail이라는 데몬을 사용하죠. 물론 qmail이나 다른 데몬들도 많이 나오고 있습니다. 그런데 굳이 java로 된 메일 서버를 쓸 이유까지 있을까도 생각할 수 있지만 이런 질문에 대한 답은 각자 찾아보도록 하기로 하고 james의 사용에 대해서 알아보자.

아쉬운 점은 현재까지 릴리즈된 James 2.1은 IMAP을 지원하지 않기 때문에 이를 이용한 기능은 구현이 어렵다. 하지만 3.0버젼에서는 IMAP을 지원한다고 하니 기대해볼만 하다.


 

James Download & Install

우선 James의 기반이 되는 Avalon과 James를 다음 사이트에서 다운로드 받아서 설치하는 과정이 필요하다.

Avalon :
http://avalon.apache.org/
James : http://james.apache.org/

※ Java 2 Platform, Standard Edition(J2SE)는 기본적으로 필요하다.

Console # gzip -d james-2.1.3.tar.gzConsole # tar xvf james-2.1.3.tarConsole # unzip Avalon-4.1.4-bin.zipConsole # mv james-2.1.3 /usr/local/ ← 원하는 위치로 옮긴다Console # mv Avalon-4.1.4 /usr/local/Console # ln -s /usr/local/james-2.1.3 jamesConsole # ln -s /usr/local/Avalon-4.1.4 avalon


 

Shell Configuration

Console # suConsole # vi /etc/profile ← bash가 아니면 그에 해당하는 설정 파일# /etc/profile…##### HOME SET ###############################################################export JAVA_HOME=/usr/local/java ← j2se의 위치 지정export AVALON_HOME=/usr/local/avalon ← avalon의 위치 지정export JAMES_HOME=/usr/local/james ← james의 위치 지정…#### CLASSPATH SET ###########################################################export CLASSPATH=./:$JAVA_HOME/lib/tools.jarexport CLASSPATH=$CLASSPATH:$AVALON_HOME/avalon-framework-4.1.4.jar…#### PATH SET ################################################################export PATH=$PATH:$JAVA_HOME/binexport PATH=$PATH:$JAMES_HOME/bin:wq

기본적인 세팅이 끝났으므로 제대로 동작하는지 테스트 해보자.

Console # cd $JAMES_HOME/bin/Console # chmod +x *.sh ← 만약 *.sh의 모드가 readonly일 경우에..Console # ./run.shUsing PHOENIX_HOME: /tmp/james-2.1.3Using PHOENIX_TMPDIR: /tmp/james-2.1.3/tempUsing JAVA_HOME: /usr/local/javaRunning Phoenix: Phoenix 4.0.1James 2.1.3Remote Manager Service started plain:4555POP3 Service started plain:110SMTP Service started plain:25NNTP Service started plain:119Fetch POP Disabled ← 이 결과와 같다면 정상적으로 동작하는 것이다.JVM exiting abnormally. Shutting down Phoenix. ← CTRL+C를 누르면...


 

Repository Setting

사용자 로긴과 패스워드를 담고 있는 User Repository와 MailBox/Spool에 대한 정보와 메일 메시지를 담고 있든 Mail/Spool Repository는 기본적으로 파일 시스템으로 운영되지만 설정하기에 따라 JDBC를 지원하는 RDBMS(mysql, oracle, etc)에 저장할 수 있다. 이하 부분에서는 RDBMS로 ORACLE을 사용하는 설정에 대해 알아보자. 이를 위해서 Oracle 9i JDBC Driver를 받아야 한다.

Console # mv classes12.jar $JAMES_HOME/lib/ Console # mv nls_charset12.jar $JAMES_HOME/lib/

그외에 필요한 package의 경우도 이와 마찬가지로 $JAMES_HOME/lib/ 폴더에 넣으면 된다.

Console # cd $JAMES_HOME/apps/james/SAR-INF/vi config.xml

config.xml을 다음과 같이 수정하면 된다.

# $JAMES_HOME/apps/james/SAR-INF/config.xml<?xml version="1.0"?><!-- Configuration file for the Apache Jakarta James server --><!-- This file contains important settings that control the behaviour --><!-- of all of the services and repositories. --><!-- README! --><!-- This configuration file is designed to run without alteration for simple tests. --><!-- It assumes you have a DNS server on localhost and assigns a root password of root. --><!-- In case the defaults do not suit you, the items you are most likely to need to change --><!-- are preceded by a CHECKME! or CONFIRM? comment in the left margin. --><!-- For production use you will probably need to make more extensive changes, see --><!-- http://james.apache.org/documentation_2_1.html --><!-- $Revision: 1.40.2.5 $ Committed on $Date: 2003/05/12 21:10:24 $ by: $Author: noel $ --><config> <James><!-- CHECKME! --> <!-- This is the postmaster email address for this mail server. --> <!-- Set this to the appropriate email address for error reports --> <!-- If this is set to a non-local email address, the mail server --> <!-- will still function, but will generate a warning on startup. --> <postmaster>Postmaster@localhost</postmaster> <!-- servernames identifies the DNS namespace served by this instance of James. --> <!-- These servernames are used for both matcher/mailet processing and SMTP auth --> <!-- to determine when a mail is intended for local delivery. --> <!-- --> <!-- If autodetect is TRUE, James wil attempt to discover its own host name AND --> <!-- use any explicitly specified servernames. --> <!-- If autodetect is FALSE, James will use only the specified servernames. --> <!-- --> <!-- If autodetectIP is not FALSE, James will also allow add the IP address for each servername. --> <!-- The automatic IP detection is to support RFC 2821, Sec 4.1.3, address literals. --> <!-- --> <!-- To override autodetected server names simply add explicit servername elements. --> <!-- In most cases this will be necessary. --> <!-- By default, the servername 'localhost' is specified. This can be removed, if required. --> <!-- --> <!-- Warning: If you are using fetchpop it is important to include the --> <!-- fetched domains in the server name list to prevent looping. --> <servernames autodetect="true" autodetectIP="true"><!-- CONFIRM? --> <servername>localhost</servername> <servername>apple</servername> </servernames> <!-- Set whether user names are case sensitive or case insensitive --> <!-- Set whether to enable local aliases --> <!-- Set whether to enable forwarding --> <usernames ignoreCase="true" enableAliases="true" enableForwarding="true"/> <!-- The inbox repository is the location for users inboxes --> <!-- Default setting: file based repository - enter path ( use "file:///" for absolute) --><!-- <inboxRepository> <repository destinationURL="file://var/mail/inboxes/" type="MAIL"/> </inboxRepository>--> <!-- Alternative inbox repository definition for DB use. --> <!-- The format for the destinationURL is "db://<data-source>/<table>" --> <!-- <data-source> is the datasource name set up in the database-connections block, below --> <!-- <table> is the name of the table to store user inboxes in --> <!-- The user name is used as <repositoryName> for this repository config. --> <inboxRepository> <repository destinationURL="db://maildb/inbox/" type="MAIL"/> </inboxRepository> <!-- Alternative inbox repository definition for DB use. --> <!-- Stores message body in file system, rest in database --> <!-- <inboxRepository> <repository destinationURL="dbfile://maildb/inbox/" type="MAIL"/> </inboxRepository> --> </James> <!-- Fetch pop block, fetches mail from POP3 servers and inserts it into the incoming spool --> <!-- Warning: It is important to prevent mail from looping by setting the --> <!-- fetched domains in the <servernames> section of the <James> block --> <!-- above. This block is disabled by default. --> <fetchpop enabled="false"> <!-- You can have as many fetch tasks as you want, but each must have a --> <!-- unique name by which it identified --> <fetch name="mydomain.com"> <!-- Host name or IP address --> <host>mail.mydomain.com</host> <!-- Account login username --> <user>username</user> <!-- Account login password --> <password>pass</password> <!-- How frequently this account is checked - in milliseconds. 600000 is every ten minutes --> <interval>600000</interval> </fetch> </fetchpop> <!-- The James Spool Manager block --> <!-- --> <!-- This block is responsible for processing messages on the spool. --> <spoolmanager> <!-- Number of spool threads --> <threads> 10 </threads> <!-- Set the Java packages from which to load mailets and matchers --> <mailetpackages> <mailetpackage>org.apache.james.transport.mailets</mailetpackage> </mailetpackages> <matcherpackages> <matcherpackage>org.apache.james.transport.matchers</matcherpackage> </matcherpackages> <!-- The root processor is a required processor - James routes all mail on the spool --> <!-- through this processor first. --> <!-- --> <!-- This configuration is a sample configuration for the root processor. --> <processor name="root"> <!-- Checks that the email Sender is associated with a valid domain. --> <!-- Useful for detecting and eliminating spam. --> <!-- For this block to function, the spam processor must be configured. --> <!-- <mailet match="SenderInFakeDomain" class="ToProcessor"> <processor> spam </processor> </mailet> --> <!-- Important check to avoid looping --> <mailet match="RelayLimit=30" class="Null"/> <!-- White List: If you use block lists, you will probably want to check for known permitted senders. This is particularly true if you use more aggressive block lists, such as SPEWS, that are prone to block entire subnets without regard for non-spamming senders. --> <!-- specific known senders --> <!-- <mailet match="SenderIs=goodboy@goodhost" class="ToProcessor"> <processor> transport </processor> </mailet> --> <!-- People on this list agree to pay a penalty if they send spam --> <mailet match="InSpammerBlacklist=query.bondedsender.org" class="ToProcessor"> <processor> transport </processor> </mailet> <!-- E-mail legally required not to be spam (see: http://www.habeas.com) --> <!-- <mailet match="HasHabeasWarrantMark" class="ToProcessor"> <processor> transport </processor> </mailet> --> <!-- End of White List --> <!-- Check for delivery from a known spam server --> <!-- This set of matchers/mailets redirect all emails from known --> <!-- black holes, open relays, and spam servers to the spam processor --> <!-- For this set to function properly, the spam processor must be configured. --> <mailet match="InSpammerBlacklist=dnsbl.njabl.org" class="ToProcessor"> <processor> spam </processor> <notice>550 Requested action not taken: rejected - see http://njabl.org/ </notice> </mailet> <mailet match="InSpammerBlacklist=relays.ordb.org" class="ToProcessor"> <processor> spam </processor> <notice>550 Requested action not taken: rejected - see http://www.ordb.org/ </notice> </mailet> <!-- Sample matching to kill a message (send to Null) --> <!-- <mailet match="RecipientIs=badboy@badhost" class="Null"/> --> <!-- Send remaining mails to the transport processor for either local or remote delivery --> <mailet match="All" class="ToProcessor"> <processor> transport </processor> </mailet> </processor> <!-- The error processor is required. James may internally set emails to the --> <!-- error state. The error processor is generally invoked when there is an --> <!-- unexpected error either in the mailet chain or internal to James. --> <!-- --> <!-- By default configuration all email that generates an error in placed in --> <!-- an error repository. --> <processor name="error"> <!-- Logs any messages to the repository specified --> <mailet match="All" class="ToRepository"><!-- <repositoryPath> file://var/mail/error/</repositoryPath>--> <!-- An alternative database repository example follows. --> <repositoryPath> db://maildb/deadletter/error </repositoryPath> <passThrough> true </passThrough> </mailet> <!-- If you want to notify the sender their message generated an error, uncomment this --> <!-- <mailet match="All" class="NotifySender"/> --> <!-- If you want to notify the postmaster that a message generated an error, uncomment this --> <!-- <mailet match="All" class="NotifyPostmaster"/> --> </processor> <!-- Processor CONFIGURATION SAMPLE: transport is a sample custom processor for local or --> <!-- remote delivery --> <processor name="transport"> <!-- Is the recipient is for a local account, deliver it locally --> <mailet match="RecipientIsLocal" class="LocalDelivery"/> <!-- If the host is handled by this server and it did not get --> <!-- locally delivered, this is an invalid recipient --> <mailet match="HostIsLocal" class="ToProcessor"> <processor>error</processor> </mailet><!-- CHECKME! --> <!-- This is an anti-relay matcher/mailet combination --> <!-- --> <!-- Emails sent from servers not in the network list are --> <!-- rejected as spam. This is one method of preventing your --> <!-- server from being used as an open relay. Make sure you understand --> <!-- how to prevent your server from becoming an open relay before --> <!-- changing this configuration. --> <!-- --> <!-- This matcher/mailet combination must come after local delivery has --> <!-- been performed. Otherwise local users will not be able to receive --> <!-- email from senders not in this remote address list. --> <!-- --> <!-- If you are using this matcher/mailet you will probably want to --> <!-- update the configuration to include your own network/addresses. The --> <!-- matcher can be configured with a comma separated list of IP addresses --> <!-- wildcarded IP subnets, and wildcarded hostname subnets. --> <!-- e.g. "RemoteAddrNotInNetwork=127.0.0.1, abc.de.*, 192.168.0.*" --> <!-- --> <!-- If you are using SMTP authentication then you can (and generally --> <!-- should) disable this matcher/mailet pair. --> <mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor"> <processor> spam </processor> </mailet> <!-- Attempt remote delivery using the specified repository for the spool, --> <!-- using delay time to retry delivery and the maximum number of retries --> <mailet match="All" class="RemoteDelivery"><!-- <outgoing> file://var/mail/outgoing/ </outgoing>--> <!-- alternative database repository example below --> <outgoing> db://maildb/spool/outgoing </outgoing> <!-- Number of milliseconds between delivery attempts --> <delayTime> 21600000 </delayTime> <!-- Number of failed attempts before returning to the sender --> <maxRetries> 5 </maxRetries> <!-- The number of threads that should be trying to deliver outgoing messages --> <deliveryThreads> 1 </deliveryThreads> <!-- A single mail server to deliver all outgoing messages. --> <!-- This is useful if this server is a backup or failover machine, --> <!-- or if you want all messages to be routed through a particular mail server, --> <!-- regardless of the email addresses specified in the message --> <!-- --> <!-- The gateway element specifies the gateway SMTP server name. --> <!-- If your gateway mail server is listening on a port other than 25, --> <!-- you can set James to connect to it on that port using the gatewayPort --> <!-- element. --> <!-- <gateway> otherserver.mydomain.com </gateway> <gatewayPort>25</gatewayPort> --> </mailet> </processor> <!-- Processor CONFIGURATION SAMPLE: spam is a sample custom processor for handling --> <!-- spam. --> <!-- You can either log these, bounce these, or just ignore them. --> <processor name="spam"> <!-- To destroy all messages, uncomment this matcher/mailet configuration --> <!-- <mailet match="All" class="Null"/> --> <!-- To notify the sender their message was marked as spam, uncomment this matcher/mailet configuration --> <!-- <mailet match="All" class="NotifySender"/> --> <!-- To notify the postmaster that a message was marked as spam, uncomment this matcher/mailet configuration --> <!-- <mailet match="All" class="NotifyPostmaster"/> --> <!-- To log the message to a repository, this matcher/mailet configuration should be uncommented. --> <!-- This is the default configuration. --> <mailet match="All" class="ToRepository"><!-- <repositoryPath>file://var/mail/spam/</repositoryPath>--> <!-- Changing the repositoryPath, as in this commented out example, will --> <!-- cause the mails to be stored in a database repository. --> <!-- Please note that only one repositoryPath element can be present for the mailet --> <!-- configuration. --> <repositoryPath> db://maildb/deadletter/spam </repositoryPath> </mailet> </processor> </spoolmanager> <!-- DNS Server Block --> <!-- --> <!-- Specifies DNS Server information for use by various components inside --> <!-- James. --> <!-- --> <!-- Information includes a list of DNS Servers to be used by James. These are --> <!-- specified by the server elements, each of which is a child element of the --> <!-- servers element. Each server element is the IP address of a single DNS server. --> <!-- The servers element can have multiple server children. --> <dnsserver> <servers><!-- CONFIRM? --> <!--Enter ip address of your DNS server, one IP address per server --> <!-- element. The default configuration assumes a DNS server on the localhost. --> <server>127.0.0.1</server> <server>211.175.55.95</server> ← your dns </servers> <authoritative>false</authoritative> </dnsserver> <remotemanager> <port>4555</port> <!-- Uncomment this if you want to bind to a specific inetaddress --> <!-- <bind> </bind> --> <!-- Uncomment this if you want to use TLS (SSL) on this port --> <!-- <useTLS>true</useTLS> --> <handler> <!-- This is the name used by the server to identify itself in the RemoteManager --> <!-- protocol. If autodetect is TRUE, the server will discover its --> <!-- own host name and use that in the protocol. If discovery fails, --> <!-- the value of 'localhost' is used. If autodetect is FALSE, James --> <!-- will use the specified value. --> <helloName autodetect="true">myMailServer</helloName> <administrator_accounts><!-- CHECKME! --> <!-- Change the default login/password. --> <account login="root" password="root"/> </administrator_accounts> <connectiontimeout> 60000 </connectiontimeout> </handler> </remotemanager> <!-- The POP3 server is enabled by default --> <!-- Disabling blocks will stop them from listening, --> <!-- but does not free as many resources as removing them would --> <pop3server enabled="true"> <!-- port 995 is the well-known/IANA registered port for POP3S ie over SSL/TLS --> <!-- port 110 is the well-known/IANA registered port for Standard POP3 --> <port>110</port> <!-- Uncomment this if you want to bind to a specific inetaddress --> <!-- <bind> </bind> --> <!-- Uncomment this if you want to use TLS (SSL) on this port --> <!-- <useTLS>true</useTLS> --> <handler> <!-- This is the name used by the server to identify itself in the POP3 --> <!-- protocol. If autodetect is TRUE, the server will discover its --> <!-- own host name and use that in the protocol. If discovery fails, --> <!-- the value of 'localhost' is used. If autodetect is FALSE, James --> <!-- will use the specified value. --> <helloName autodetect="true">myMailServer</helloName> <connectiontimeout>120000</connectiontimeout> </handler> </pop3server> <!-- The SMTP server is enabled by default --> <!-- Disabling blocks will stop them from listening, --> <!-- but does not free as many resources as removing them would --> <smtpserver enabled="true"> <!-- port 25 is the well-known/IANA registered port for SMTP --> <port>25</port> <!-- Uncomment this if you want to bind to a specific inetaddress --> <!-- <bind> </bind> --> <!-- Uncomment this if you want to use TLS (SSL) on this port --> <!-- <useTLS>true</useTLS> --> <handler> <!-- This is the name used by the server to identify itself in the SMTP --> <!-- protocol. If autodetect is TRUE, the server will discover its --> <!-- own host name and use that in the protocol. If discovery fails, --> <!-- the value of 'localhost' is used. If autodetect is FALSE, James --> <!-- will use the specified value. --> <helloName autodetect="true">myMailServer</helloName> <connectiontimeout>360000</connectiontimeout> <!-- Uncomment this if you want to require SMTP authentication. --> <!-- <authRequired>true</authRequired> --> <!-- Uncomment this if you want to verify sender addresses, ensuring that --> <!-- the sender address matches the user who has authenticated. --> <!-- This prevents a user of your mail server from acting as someone else --> <!-- <verifyIdentity>true</verifyIdentity> --> <!-- This sets the maximum allowed message size (in kilobytes) for this --> <!-- SMTP service. If unspecified, the value defaults to 0, which means no limit. --> <maxmessagesize>0</maxmessagesize> </handler> </smtpserver> <!-- The NNTP server is enabled by default --> <!-- Disabling blocks will stop them from listening, --> <!-- but does not free as many resources as removing them would --> <!-- NNTP-specific: if you disable the NNTP Server, you should also set the nntp-repository's threadCount to 0, otherwise there will be threads active and polling --> <nntpserver enabled="true"> <!-- THE NNTP PROTOCOL IS EXPERIMENTAL AND NOT AS WELL TESTED AS SMTP AND POP3 IN THIS RELEASE. The James project recommends that you check the James web site for updates to the NNTP service. --> <!-- port 563 is the well-known/IANA registered port for NNTP over SSL/TLS --> <!-- port 119 is the well-known/IANA registered port for Standard NNTP --> <port>119</port> <!-- Uncomment this if you want to bind to a specific inetaddress --> <!-- <bind> </bind> --> <!-- Uncomment this if you want to use TLS (SSL) on this port --> <!-- <useTLS>true</useTLS> --> <handler> <!-- This is the name used by the server to identify itself in the NNTP --> <!-- protocol. If autodetect is TRUE, the server will discover its --> <!-- own host name and use that in the protocol. If discovery fails, --> <!-- the value of 'localhost' is used. If autodetect is FALSE, James --> <!-- will use the specified value. --> <helloName autodetect="true">myMailServer</helloName> <connectiontimeout>120000</connectiontimeout> <!-- Set the authRequired value to true to enable authenticated NNTP --> <authRequired>false</authRequired> </handler> </nntpserver> <nntp-repository> <!-- If this is set to true, posting will be disallowed. --> <readOnly>false</readOnly> <rootPath>file://var/nntp/groups</rootPath> <tempPath>file://var/nntp/temp</tempPath> <articleIDPath>file://var/nntp/articleid</articleIDPath> <articleIDDomainSuffix>news.james.apache.org</articleIDDomainSuffix> <!-- The news groups hosted in this NNTP repository. --> <newsgroups> <newsgroup>org.apache.james.dev</newsgroup> <newsgroup>org.apache.james.user</newsgroup> <newsgroup>org.apache.avalon.dev</newsgroup> <newsgroup>org.apache.avalon.user</newsgroup> </newsgroups> <spool> <configuration> <spoolPath>file://var/nntp/spool</spoolPath> <!-- The number of threads that process spooler related tasks. --> <threadCount>1</threadCount> <!-- The spool thread(s) should idle for some time, if it has nothing to do --> <threadIdleTime>60000</threadIdleTime> </configuration> </spool> </nntp-repository> <!-- The Mailstore block --> <mailstore> <repositories> <!-- File based repositories. These repositories store all message data --> <!-- in the file system. --> <repository class="org.apache.james.mailrepository.AvalonMailRepository"> <protocols> <protocol>file</protocol> </protocols> <types> <type>MAIL</type> </types> </repository> <repository class="org.apache.james.mailrepository.AvalonSpoolRepository"> <protocols> <protocol>file</protocol> </protocols> <types> <type>SPOOL</type> </types> </repository> <!-- JDBC based repositories. These repositories store all message data --> <!-- in the database. --> <repository class="org.apache.james.mailrepository.JDBCMailRepository"> <protocols> <protocol>db</protocol> </protocols> <types> <type>MAIL</type> </types> <config> <sqlFile>file://conf/sqlResources.xml</sqlFile> </config> </repository> <repository class="org.apache.james.mailrepository.JDBCSpoolRepository"> <protocols> <protocol>db</protocol> </protocols> <types> <type>SPOOL</type> </types> <config> <sqlFile>file://conf/sqlResources.xml</sqlFile> </config> </repository> <!-- These repositories store message delivery and headers in the DB, and the body to the filesystem --> <repository class="org.apache.james.mailrepository.JDBCMailRepository"> <protocols> <protocol>dbfile</protocol> </protocols> <types> <type>MAIL</type> </types> <config> <sqlFile>file://conf/sqlResources.xml</sqlFile> <filestore>file://var/dbmail</filestore> </config> </repository> <repository class="org.apache.james.mailrepository.JDBCSpoolRepository"> <protocols> <protocol>dbfile</protocol> </protocols> <types> <type>SPOOL</type> </types> <config> <sqlFile>file://conf/sqlResources.xml</sqlFile> <filestore>file://var/dbmail</filestore> </config> </repository> </repositories> <!-- Spool repository configuration --> <!-- The spool repository is the location where incoming mails are temporarily stored --> <!-- before being processed. --><!-- <spoolRepository> <repository destinationURL="file://var/mail/spool/" type="SPOOL"/> </spoolRepository>--> <!-- Alternative spool repository definition for JDBC use --> <spoolRepository> <repository destinationURL="db://maildb/spool/spool" type="SPOOL"/> </spoolRepository> <!-- Alternative spool repository definition for JDBC use --> <!-- Stores message body in file system, rest in database --> <!-- <spoolRepository> <repository destinationURL="dbfile://maildb/spool/spool" type="SPOOL"/> </spoolRepository> --> </mailstore> <!-- The User Storage block --> <users-store> <!-- Configure User Repositories here. --> <!-- --> <!-- User repositories are required for the following purposes: --> <!-- - storing James user information, including forwards, aliases, --> <!-- and authentication data. --> <!-- - holding lists of users for the listserv mailet --> <!-- Currently, two different storage options are available: --> <!-- - file-based storage using Java serialization --> <!-- - database-backed storage --> <!-- (Use of database or file-system is defined on a "per-repository" basis) --> <!-- --> <!-- Note: One user repository is required for James: --> <!-- LocalUsers - the users for whom you are providing POP3, NNTP, or SMTP service --> <!-- --> <!-- Other repositories may be used by matchers or mailets. --> <!-- Default: File-based user repositories Use these configurations to store user info in the filesystem --> <!-- The LocalUsers repository, for storing James' User info. --><!-- <repository name="LocalUsers" class="org.apache.james.userrepository.UsersFileRepository"> <destination URL="file://var/users/"/> </repository>--> <!-- Database backed user repositories --> <!-- --> <!-- Use these configurations to store user info in a database. --> <!-- Note: The <data-source> element must refer to a connection configured --> <!-- in the <database-connections> configuration section. --> <!-- The LocalUsers repository, for storing James' User info. --> <repository name="LocalUsers" class="org.apache.james.userrepository.JamesUsersJdbcRepository" destinationURL="db://maildb/users"> <sqlFile>file://conf/sqlResources.xml</sqlFile> </repository> </users-store> <!-- The database-connections block --> <database-connections> <!-- These connections are referred to by name elsewhere in the config file --><!-- CHECKME! --> <!-- To allow James to use a database you must configure the database connection here. --> <!-- If you are not using a database, you can leave this section unchanged. --> <!-- These connections are referred to by name in URLs elsewhere in the config file. --> <data-sources> <!-- James is distributed with a built in relevant copy of the mm.mysql JDBC --> <!-- driver. No additional driver is needed for mysql. Read the mm.mysql LGPL --> <!-- license at apps\james\SAR-INF\lib\mm.mysql.LICENCE --> <!-- JDBC driver .jar libraries for other RDBMS can be placed in ~james/lib/ --> <!-- Example, connecting to a MySQL database called "mail" on localhost--> <!-- --> <!-- The max value is the maximum number of concurrent connections James will --> <!-- open to this database--> <!-- If you see "SQLException: Giving up... no connections available." in your --> <!-- log files or bounced mail you should increase this value --> <!-- <data-source name="maildb" class="org.apache.james.util.mordred.JdbcDataSource"> <driver>org.gjt.mm.mysql.Driver</driver> <dburl>jdbc:mysql://127.0.0.1/mail?autoReconnect=true</dburl> <user>username</user> <password>password</password> <max>20</max> </data-source> --> <data-source name="maildb" class="org.apache.james.util.mordred.JdbcDataSource"> <driver>oracle.jdbc.driver.OracleDriver</driver> <dburl>jdbc:oracle:thin:@127.0.0.1:1521:mail</dburl> ← @ Oracle Server Address : port number : SID <user>mail</user> ← user login <password>mail</password> ← user passwd <max>20</max> </data-source> <!-- Example, connecting to a Microsoft MSSQL database called "mail" on localhost--> <!-- --> <!-- The max value is the maximum number of concurrent connections James will --> <!-- open to this database--> <!-- If you see "SQLException: Giving up... no connections available." in your --> <!-- log files or bounced mail you should increase this value --> <!-- <data-source name="maildb" class="org.apache.james.util.mordred.JdbcDataSource"> <driver>com.inet.tds.TdsDriver</driver> <dburl>jdbc:inetdae7:127.0.0.1?database=James</dburl> <user>sa_james</user> <password>blahblah</password> <max>20</max> </data-source> --> </data-sources> </database-connections> <!-- Configuration for Cornerstone Services --> <!-- --> <!-- For a simple configuration, nothing beneath this line should require --> <!-- alteration. --> <!-- --> <!-- You will need to adjust the Socket Manager service configuration if you want --> <!-- to enable secure sockets (TLS) for any James service. --> <!-- --> <!-- Complex or high volume configurations may require changes to the parameters --> <!-- in this section. Please read the James and Avalon documentation before --> <!-- attempting to adjust this section. --> <!-- --> <!-- The Object Storage block --> <!-- --> <!-- Defines file storage details that are used for file-based repositories. --> <objectstorage> <repositories> <repository class="org.apache.james.mailrepository.filepair.File_Persistent_Object_Repository"> <protocols> <protocol>file</protocol> </protocols> <types> <type>OBJECT</type> </types> <models> <model>SYNCHRONOUS</model> <model>ASYNCHRONOUS</model> <model>CACHE</model> </models> </repository> <repository class="org.apache.james.mailrepository.filepair.File_Persistent_Stream_Repository"> <protocols> <protocol>file</protocol> </protocols> <types> <type>STREAM</type> </types> <models> <model>SYNCHRONOUS</model> <model>ASYNCHRONOUS</model> <model>CACHE</model> </models> </repository> </repositories> </objectstorage> <!-- The Connection Manager block --> <!-- --> <!-- The idle-timeout is the number of milliseconds that it will take for idle --> <!-- client connections managed by this connection manager to be marked at timed out. --> <!-- If no value is specified, the value defaults to 5 minutes, 300000 milliseconds --> <!-- A value of 0 means that client sockets will not timeout. --> <!-- --> <!-- The max-connections parameter specifies the default maximum number of client --> <!-- connections that this connection manager will allow per managed server socket. --> <!-- This value can be overridden by each individual service. --> <!-- If no value is specified, the value defaults to 30. --> <!-- A value of 0 means that there is no limit imposed by the connection manager, although --> <!-- resource limitations imposed by other components (i.e. max # of threads) may --> <!-- serve to limit the number of open connections. --> <!-- --> <connections> <idle-timeout>300000</idle-timeout> <max-connections>30</max-connections> </connections> <!-- The Socket Manager block --> <!-- --> <!-- The server-sockets element has a number of factory sub-elements. --> <!-- Each of the factory elements has a name and class attribute --> <!-- The name attribute for each factory element must be unique. --> <!-- The class attribute is the name of a class that implements the --> <!-- interface org.apache.avalon.cornerstone.services.ServerSocketFactory --> <!-- Specific factory elements may require some sub-elements. This is --> <!-- factory class dependent. --> <!-- --> <!-- The client-sockets element has a number of factory sub-elements. --> <!-- Each of the factory elements has a name and class attribute --> <!-- The name attribute for each factory element must be unique. --> <!-- The class attribute is the name of a class that implements the --> <!-- interface org.apache.avalon.cornerstone.services.SocketFactory --> <!-- Specific factory elements may require some sub-elements. This is --> <!-- factory class dependent. --> <!-- --> <sockets> <server-sockets> <factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultServerSocketFactory"/> <!-- <factory name="ssl" class="org.apache.avalon.cornerstone.blocks.sockets.TLSServerSocketFactory"> <keystore> <file>conf/keystore</file> <password>secret</password> <type>JKS</type> <protocol>TLS</protocol> <algorithm>SunX509</algorithm> <authenticate-client>false</authenticate-client> </keystore> </factory> --> </server-sockets> <client-sockets> <factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketFactory"/> </client-sockets> </sockets> <!-- The Thread Manager block --> <!-- --> <!-- The thread manager provides thread pools for use throughout the server. --> <!-- --> <!-- A thread pool with the name "default" must be defined in this thread manager --> <!-- configuration. --> <!-- --> <!-- Each thread pool is defined with a "thread-group" element. --> <!-- Each of these elements has the following required sub-elements: --> <!-- name - the name of the thread pool, used by other components to --> <!-- lookup the thread pool --> <!-- priority - the thread priority for threads in the pool. This is --> <!-- a value between 0 and 10, with 5 being the normal --> <!-- priority and 10 being the maximum. --> <!-- is-daemon - whether the threads in the pool are daemon threads. --> <!-- max-threads - the maximum number of threads allowed in the pool. --> <!-- min-threads - the minimum number of threads allowed in the pool. (not implemented) --> <!-- min-spare-threads - (not implemented) --> <thread-manager> <thread-group> <name>default</name> <priority>5</priority> <is-daemon>false</is-daemon> <max-threads>100</max-threads> <min-threads>20</min-threads> <min-spare-threads>20</min-spare-threads> </thread-group> </thread-manager></config>


 

Daemon Script

시스템 부팅시 자동으로 실행하기 위한 boot script을 작성하면 Process의 관리가 수월하다.

Console # cd $JAMES_HOME/bin/Console # vi james_daemon.sh

james_daemon.sh의 내용은 다음과 같다..

# $JAMES_HOME/bin/james_daemon.sh#!/bin/sh## go.sh# Shell script to start and stop James# OS specific support. $var _must_ be set to either true or false.cygwin=falsecase "`uname`" inCYGWIN*) cygwin=true;;esac# Checking for JAVA_HOME is required on *nixif [ "$JAVA_HOME" = "" ] ; then export JAVA_HOME=/usr/java echo "ERROR: JAVA_HOME not found in your environment." echo echo "Please, set the JAVA_HOME variable in your environment to match the" echo "location of the Java Virtual Machine you want to use." echo "Trying to use /usr/java as default" exit 1fiJAVACMD=$JAVA_HOME/bin/java# resolve links - $0 may be a softlinkTHIS_PROG="$0"while [ -h "$THIS_PROG" ]; do ls=`ls -ld "$THIS_PROG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '.*/.*' > /dev/null; then THIS_PROG="$link" else THIS_PROG=`dirname "$THIS_PROG"`/"$link" fidone# Get standard environment variablesPRGDIR=`dirname "$THIS_PROG"`PHOENIX_HOME=`cd "$PRGDIR/.." ; pwd`unset THIS_PROG# For Cygwin, ensure paths are in UNIX format before anything is touchedif $cygwin; then [ -n "$PHOENIX_HOME" ] && PHOENIX_HOME=`cygpath --unix "$PHOENIX_HOME"`fiif [ -z "$PHOENIX_TMPDIR" ] ; then# Define the java.io.tmpdir to use for Phoenix PHOENIX_TMPDIR="$PHOENIX_HOME"/temp mkdir -p "$PHOENIX_TMPDIR"fi# For Cygwin, switch paths to Windows format before running javaif $cygwin; then PHOENIX_HOME=`cygpath --path --windows "$PHOENIX_HOME"`fi# ----- Execute The Requested Command -----------------------------------------echo "Using PHOENIX_HOME: $PHOENIX_HOME"echo "Using PHOENIX_TMPDIR: $PHOENIX_TMPDIR"echo "Using JAVA_HOME: $JAVA_HOME"## Command to override JVM ext dir## This is needed as some JVM vendors # like placing jaxp/jaas/xml-parser jars in ext dir# thus breaking Phoenix#JVM_OPTS="-Djava.ext.dirs=$PHOENIX_HOME/lib"if [ "$PHOENIX_SECURE" != "false" ] ; then# Make phoenix run with security manager enabled JVM_OPTS="$JVM_OPTS -Djava.security.manager"fiif [ "$1" = "start" ] ; then shift $JAVACMD $JVM_OPTS \ $JVM_OPTS \ -Djava.security.policy=jar:file:$PHOENIX_HOME/bin/phoenix-loader.jar!/META-INF/java.policy \ $PHOENIX_JVM_OPTS \ -Dphoenix.home="$PHOENIX_HOME" \ -Djava.io.tmpdir="$PHOENIX_TMPDIR" \ -jar "$PHOENIX_HOME/bin/phoenix-loader.jar" $* > /dev/null 2>&1 & echo $! > /var/run/james.pid elif [ "$1" = "stop" ] ; then shift kill -15 `cat /var/run/james.pid` rm -rf /var/run/james.pid elif [ "$1" = "run" ] ; then shift $JAVACMD $JVM_OPTS \ $JVM_OPTS \ -Djava.security.policy=jar:file:$PHOENIX_HOME/bin/phoenix-loader.jar!/META-INF/java.policy \ $PHOENIX_JVM_OPTS \ -Dphoenix.home="$PHOENIX_HOME" \ -Djava.io.tmpdir="$PHOENIX_TMPDIR" \ -jar "$PHOENIX_HOME/bin/phoenix-loader.jar" $* "$@" else echo "Usage:" echo "james (start|run|stop)" echo " start - start james in the background" echo " run - start james in the foreground" echo " stop - stop james" exit 0 fi

james_daemon.sh의 작성이 끝났으면 실행모드로 바꾼다.

Console # chmod +x james_daemon.sh

/etc/rc.d/init.d/에 추가될 script은 다음과 같이 작성한다.

Console # cd /etc/rc.d/init.d/Console # vi james

james의 내용은 다음과 같다.

# /etc/rc.d/init.d/james#!/bin/sh## Startup script for James, the Jakarta Mail Server# chkconfig: 2345 95 15# description: James is a Mail Server# processname: james# pidfile: /var/run/james.pid# config: /opt/james/apps/james/conf/config.xml# logfiles: /opt/james/apps/james/logs## version 1.0 -## Source function library.. /etc/rc.d/init.d/functions#SET THE FOLLOWING LINE TO YOUR JAVA_HOMEexport JAVA_HOME=/usr/local/java#SET THE FOLLOWING LINE TO YOUR CORRECT JBOSS_HOMEexport JAMES_HOME=/usr/local/jamesexport PATH=$PATH:$JAMES_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin#IF YOU NEED SPECIAL CLASSES IN YOUR CLASSPATH#AT STARTUP, ADD THEM TO YOUR CLASSPATH HERE#export CLASSPATH=RETVAL=0# See how we were called.case "$1" in start) cd $JAMES_HOME/bin echo -n "Starting james daemon: " daemon $JAMES_HOME/bin/james_daemon.sh start RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/james ;; stop) echo -n "Stopping james daemon: " killproc james RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/james ;; restart) echo -n "Restarting james daemon: " $0 stop sleep 2 $0 start ;; esac

james의 작성이 끝났으면 실행모드로 바꾸고 /etc/rc.d/rc3.d/와 /etc/rc.d/rc5.d/에 alias를 만든다.

Console # chmod +x jamesConsole # cd /etc/rc.d/rc3.d/Console # ln -s /etc/rc.d/init.d/james S99jamesConsole # cd /etc/rc.d/rc5.d/Console # ln -s /etc/rc.d/init.d/james S99james


 

TEST

Console # ./run.sh Using PHOENIX_HOME: /usr/local/jamesUsing PHOENIX_TMPDIR: /usr/local/james/tempUsing JAVA_HOME: /usr/local/javaRunning Phoenix: Phoenix 4.0.1James 2.1.3Remote Manager Service started plain:4555POP3 Service started plain:110SMTP Service started plain:25NNTP Service started plain:119Fetch POP DisabledJVM exiting abnormally. Shutting down Phoenix. ← CTRL + CConsole # /etc/rc.d/init.d/james start ← daemon script test..Starting james daemon: [ 확인 ]

위와 같이 정상적인 실행이 되었다면, Oracle sqlplus나 JBuilder Database Pilot을 통해 Repository를 확인해보면 MailBox/Spool/User에 대한 정보를 다음과 같이 볼 수 있다.

Console # sqlplus mail/mail@mailSQL*Plus: Release 9.2.0.1.0 - Production on Wed Aug 13 10:28:59 2003Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.Connected to:Oracle9i Enterprise Edition Release 9.2.0.1.0 - ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.1.0 - ProductionSQL> select * from tab;TNAME TABTYPE CLUSTERID------------------------------ ------- ----------DEADLETTER TABLEINBOX TABLESPOOL TABLEUSERS TABLESQL> desc inbox Name Null? Type ----------------------------------------- -------- ---------------------------- MESSAGE_NAME NOT NULL VARCHAR2(200) REPOSITORY_NAME NOT NULL VARCHAR2(255) MESSAGE_STATE NOT NULL VARCHAR2(30) ERROR_MESSAGE VARCHAR2(200) SENDER VARCHAR2(255) RECIPIENTS NOT NULL VARCHAR2(1000) REMOTE_HOST NOT NULL VARCHAR2(100) REMOTE_ADDR NOT NULL VARCHAR2(20) MESSAGE_BODY NOT NULL LONG RAW LAST_UPDATED NOT NULL DATE SQL> desc users; Name Null? Type ----------------------------------------- -------- ---------------------------- USERNAME NOT NULL VARCHAR2(64) PWDHASH VARCHAR2(50) PWDALGORITHM VARCHAR2(20) USEFORWARDING NUMBER(38) FORWARDDESTINATION VARCHAR2(255) USEALIAS NUMBER(38) ALIAS VARCHAR2(255) * 출처: 야옹이 백작 (http://macspace.cnu.ac.kr/%7Earmateras/v3/favorites/Computer/Unix/james.html)
Posted by tornado
|

sendmail.cf 설정 파일중에


O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA


이런 부분이 있는데.. 여기서 Addr 부분이 127.0.0.1 이라서 그런다.


걍 지워버렸음.


메일 잘 들어온다.

Posted by tornado
|

트랙백 주소 : http://www.sir.co.kr/bbs/tb.php/pl_linux/171

 

http://linux.duke.edu/projects/yum/download.ptml

http://linux.duke.edu/projects/yum/download/2.0/ 에서

http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm

를 다운로드 하여

rpm -Uvh yum-2.0.8.1.noarch.rpm

설치한 후


/etc/yum.conf 를 다음과 같이 수정합니다.

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest

[base]
name=Red Hat Linux $releasever base
baseurl=http://mirror.hostway.co.kr/redhat/$releasever/os/$basearch/

[updates]
name=Red Hat Linux $releasever updates
baseurl=http://mirror.hostway.co.kr/redhat/$releasever/updates/$basearch/




그리고

yum update

하면 자동으로 업데이트 합니다.

Posted by tornado
|
Posted by tornado
|
ssh brute-force 공격에 대한 설명과 대응 방법
Posted by tornado
|

http://spamassassin.apache.org/

 

오케... 윈도그 2003 서버에 깔아서 테스트 해봐야겠다..

 

Posted by tornado
|

피싱 사이트 -.-

OS/LINUX 2005. 9. 22. 16:31

회사 네임서버가 레드햇 리눅스 9 이다.

네임서버에는 hosts.allow, hosts.deny 가 걸려 있고,

iptables 에서 몇몇 포트(53번, 22번 등)을 뺀 나머지는 다 걸러내구 있다.


흠.. 그런데.. 22번 포트가 문제였다.

이 구멍을 통해 우리 네임서버가 fising site 가 되 버렸다 ㅡㅡ;


/usr/include 디렉토리에 보니 못보던 파일들이 있다.

log.h 라는게 뭐지? 열어봤더니,

ssh 를 통해 들어온 계정들의 패스워드가 죄다 적혀있다.

허걱...


허미.. 잽싸게 다른 서버에 Linux 설치하고, 원래 서버 복구에 들어갔다.

그리고 새로 설치한 리눅스 서버에 iptables 로 C 클래스 중 울 회사 IP 대역만 열어놓구

시스템을 켰다..


음.. 다시 외부에서 들어온 흔적이 보인다..

/dev 디렉토리에 작업하네 ㅡㅡ;

범인은 회사내의 Informix 서버였다. MS-SQL 쓰니까.. 내버려 두고 있었더니, 이곳이 활동무대가 된듯 하다..

그래서 그 서버죽이고, ssh 도 죽이고 서버 다시 시작하니 잘 된다.


좀 써보다가 또 뚫으려고 하는 시도가 보이거나, 뚫렸을 때는 할수 없이

방화벽을 앞단에 세우고, 브릿지로 연결해서 쓰던지 해야겄다...


정말 골때리는거는... 아파치가 설치되어있으니까, 거기에 PHP 깔고... 서비스를 하더라는것이다.

대단한 넘들.....

Posted by tornado
|

***********************
아파치 가상호스트 설정하기
작성자 : 유희성
***********************


가상호스트란 하나의 IP 상에 여러개의 가짜 도메인을 구성하는 것이다.
이것은 아파치의 VirtualHost 라는 기능을 이용하는것인데 상당히 유용하다
도메인을 신청하면 www.yadong.com 이라는 형식으로 나오게 되는데
우리가 임의대로 2차도메인을 지정하고 그 이름이 들어왔을때 네임서버에서 일단
1차 도메인 쪽으로 연결을 시켜줍니다. 그리고 이것을 다시 아파치에서 받아들입니다.
이때 아파치에 설정되어있는 VirtualHost 부분에 설정되어있는 곳의 public_html
디렉토리를 연결시켜 주게 됩니다. 이런 방식으로 동작을 하기 때문에 각각의 사용자마다
2차 도메인을 가질수 있게 됩니다.

먼저 가상호스트를 만들기 위해 준비를 합니다.
네임서버가 잘 작동을 하는지 먼저 테스트 합니다.

nslookup 자기호스트.com 이라고 쳐서 잘 나오는지 확인합니다

잘 나왔다면 이제 네임서버 설정을 아주 약간만 고쳐줍니다. 먼저 /var/named/*.zone 파일을 고쳐줍니다.

vi /var/named/*.zone <--- 여러분은 yadong.com 이니까 yadong 을 써주면 되겠군요.

그럼 제일 아랫줄에 다음 라인을 추가 합니다.

first IN CNAME 211.108.242.host

위의 라인은 first.yadong.com 이라는 주소를 치고 들어왔을때 CNAME 클래스(CANONICAL NAME)를 이용하여
연결된 2차 도메인을 1차 도메인쪽으로 연결시켜 주는 부분입니다.
물론 A 클래스로 이용하여도 동작은 잘 됩니다.

이제 네임서버데몬 스크립트를 다시 restart 시킵니다.

/etc/rc.d/init.d/named restart

nslookup first.yadong.com 이라고 쳐서 cname 어짜고 저짜고 떴으면 된것입니다.
만약 안뜬다면 1차 네임서버 설정에 문제가 있을수도 있겠군요.

여기까지 잘 되었다면 이제 아파치를 설정합니다.

cd /usr/local/apache/conf
vi httpd.conf

이렇게 아파치 설정파일을 열고 줄 번호를 넣고 봅니다. set nu 하시면 됩니다.

#NameVirtualHost * <=== 약 970번 줄 근처에 있습니다.

이 부분의 주석을 풀어주고 뒤의 별표(*) 부분을 삭제한 후 자신의 아이피를 넣어줍니다.

그리고 아랫쪽에 보시면 VirtualHost 의 사용법에 대한 sample 이 있을것입니다.
이부분을 고치시는게 아니고 이걸 보고 아랫쪽에 새로 입력하여 작성합니다.

#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

위와 같은 형식의 문장이 있습니다.
<VirtualHost *> <=== 가상호스트의 시작을 알리는 태그.
뒤의 별표는 삭제하고 자신의 호스트 주소를 적어줍니다.
211.108.242.host
ServerAdmin <=== 가상호스트 운영자의 메일주소가 들어갑니다.
DocumentRoot <=== HTML 문서나 PHP 문서가 위치하게될 디렉토리를 지정합니다.
ServerName <=== 자신의 가상호스트 이름을 적어줍니다.
ErrorLog <=== 호스트를 운영하게 되면 각종 Log 파일들이 쌓이게 되는데
가상 호스트 마다 log 를 지정해 주지 않으면 apache 기본 log 파일에
쌓이게 됩니다. 그럼 나중에 log 분석하기도 힘들게 될뿐더러 관리도
힘들어 지게 됩니다. 이곳에 Log 파일의 경로와 사용할 log 파일의
이름을 적어줍니다.
여기는 error log 에 관련된 거겠지요?? 거기에 걸맞는 이름을 적어줍시다.
CustomLog <=== 이곳은 위와 동일합니다. 성공적으로 아파치에 접속이 되었을 경우에
나타나는 로그들이 이곳에 저장됩니다. 경로와 파일을 적어줍시다.
</VirtualHost> <=== 가상호스트의 종료부분 태그.

위의 문장대로 제일 아랫줄에 가상 호스트 부분을 추가해 줍니다.

<VirtualHost 211.108.242.30>
ServerName www.kcr.pe.kr
</VirtualHost>
<VirtualHost 211.108.242.30>
ServerAdmin tornado@kcr.pe.kr
ServerName tornado.kcr.pe.kr
DocumentRoot /home/tornado/public_tornado/
UserDir /home/tornado/public_tornado/
CustomLog logs/apache.tornado.com-access_log common
ErrorLog logs/apache.tornado.com_error_log
</VirtualHost>

위 예제는 학원의 30번 PC 에서 현재 잘 가동이 되고 있는 서버의 상태입니다.
처음 가상호스트 부분을 보시면 위쪽에 설명 되어있는 부분과 상이한 부분이 있습니다.
이곳은 root 사용자의 홈페이지를 가상호스트로 정해준 부분입니다.
그러니까 www.kcr.com 이라고 치고 들어왔을때 보여주는 경로인 셈입니다.
로그 파일은 기본 로그파일을 사용하기 때문에 별도의 로그파일은 지정해 주지 않았습니다.

가상 호스트 부분에서는 public_html 이라는 디렉토리를 사용하지 않습니다.
public_2차도메인이름 이라는 형식을 사용합니다.
왜냐하면 각각의 디렉토리마다 public_html 을 사용하게 되면 이름도 헷갈릴뿐더러
작동하는데 문제가 생길수 있습니다.
aaa.yadong.com 을 치고 들어갔는데
bbb.yadong.com 의 public_html 디렉토리의 문서를 보여줄 상황도 발생 할 수 있기 때문입니다.


<VirtualHost 211.108.242.30>
ServerAdmin tornado@kcr.pe.kr
ServerName tornado.kcr.pe.kr
DocumentRoot /home/tornado/public_tornado/
UserDir /home/tornado/public_tornado/
CustomLog logs/apache.tornado.com-access_log common
ErrorLog logs/apache.tornado.com_error_log
</VirtualHost>

위의 부분이 정말 가상호스트 부분입니다.

ServerName 부분을 보시면 tornado.kcr.pe.kr 이라고 되어있습니다.
여기서 tornado 라는 2차 도메인은 네임서버의 *.zone 파일에 CNAME 클래스로 지정되어있습니다.

여러분이 웹브라우져에서 tornado.kcr.pe.kr 이라고 치고 들어오셨을때 네임서버에서
일단 CNAME 으로 걸러줍니다. 그리고 다시 아파치의 가상 호스트 부분으로 들어가게 됩니다.
이때 VirtualHost 부분에 해당 호스트의 설정이 작성되어있다면 작성된 설정의
DocumentRoot 부분의 디렉토리로 이동하여 해당 문서(index.html 등등)를 보여주게 됩니다.

여기까지 하셨다면 apache데몬을 다시 시작합니다.

/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start

이때 에러가 없어야 합니다.
이제 각 디렉토리들을 작성해 주셔야 합니다.
user를 등록합니다.


useradd tornado
passwd tornado
적당한 패스워드 입력

이제 home 디렉토리로 이동합니다.

cd /home
cd tornado
mkdir public_tornado
cd public_tornado

vi index.html
여기는 tornado 의 메인 페이지 입니다.

저장하고 종료

chmod 755 -r ~tornado

위와 동일한 방법으로 각각의 가상호스트 마다 설정을 하여 줍니다.

웹브라우져를 실행한 후에 지정한 2차 도메인으로 접속하여 봅니다.
문서가 제대로 보인다면 제대로 성공하신 것입니다.


*******************************
아파치 가상호스트 2
작성자 : 유희성
*******************************

우리는 지난 시간에 2차 도메인을 이용한 가상 호스트 설정을 하였습니다.
이번에 할 것은 같은 아이피에 1차 도메인을 두개 이상 연결시켜서 가상 호스트를 잡아주는 방법입니다.

작동 방식은 먼저 시간에 설명드린 것과 거의 비슷합니다.
그러나 네임서버 설정이 약간 다릅니다.
먼저 시간에 했던 방식은 aaa.yadong.com 으로 들어왔을때 yadong.com 으로 연결시켜주고
아파치 가상 호스트부분에서 치고 들어온 도메인으로 연결시켜주는 방법이였습니다.

이번에 설정은 named.conf 에 새로운 zone 영역을 등록시키고 /var/named 디렉토리에
새로운 zone 영역 파일을 만들어주는 방식입니다.
이때 reverse 영역은 새로 작성하지 않습니다. 어차피 한 IP를 가지고 사용하는 것이기 때문에
새로 작성한다는 것은 의미가 없습니다.

지금 하는것과 같이 같은 아이피에 등록시켜줘도 전혀 문제는 없습니다.
만약 한대의 피시에 여러개의 랜카드가 꼽혀 있고 각각의 아이피가 부여되어있는 상태라면
각각의 아이피 마다 도메인을 부여하여 아파치 설정을 통해 가상호스트 운영을 할수 있습니다.
또 하나의 랜카드에 가상 IP 를 부여하여(Aliase) 가짜 호스트를 마치 진짜 처럼 운영할수도 있습니다.

그럼 설정파일부터 보겠습니다.

vi /etc/named.conf 파일을 열어서
zone 영역을 하나 더 만들어줍니다.

zone "aaa.com" IN {
type master;
file "aaa.zone";
};

위와 같이 추가하시고 저장후 빠져나옵니다.

위의 설정에서 파일을 지정했기 때문에 /var/named 디렉토리에 해당 파일을 만들어 주어야 합니다.
파일은 기존의 설정을 복사하여 사용합니다.

cd /var/named
cp yadong.zone aaa.zone
vi aaa.zone

$TTL 86400
@ IN SOA ns.aaa.com. root.aaa.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS ns.aaa.com.
IN MX 10 mail.aaa.com.
IN A 211.108.242.30
ns IN A 211.108.242.30
www IN A 211.108.242.30


위와 같은 설정이 되겠군요. 저장하고 빠져나옵니다.

네임서버를 다시 가동합니다.
/etc/rc.d/init.d/named restart

nslookup aaa.com 이라고 치셔서 응답이 제대로 나와야 합니다.
안나온다면 다시 설정을 천천히 살펴봅니다.

위와 같이 설정한 후에 아파치 virtualHost 부분은 기존 VirtualHost 설정 부분처럼 합니다.
다 하셨으면 apache데몬을 다시 시작하시고 브라우져에서 각각의 주소를 쳐봅니다.
그래서 각각의 호스트 디렉토리에 있는 파일내용이 보이면 성공입니다.


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

예전에 학원에서 배운 내용인데.. 이제야 자료를 찾았습니다 ^^;

근데 예로 든 주소가 다 왜 이 모양인지 ;;

Posted by tornado
|

****************
 proftp 설치하기
 작성자 : 유희성
****************


http://www.proftpd.org 에서 최신 버젼을 다운로드 받는다(좌측 상단에 tar.gz형식)
기존의 wu-ftp나 proftp 중에 rpm으로 설치된것은 삭제한다.

rpm -qa | grep proftp  라고 해서 뭐가 나오면 지운다. (이거 그냥 써도 된다)
rpm -qa | grep wu-ftp  라고 해서 뭐가 나오면 지운다.

rpm -e --nodeps 나온패키지     <=== 삭제

항상 최신 버젼을 유지합시다.

다운받은 소스를 압축을 풉니다.

tar xvzf proftpd-xxx.tar.gz   
cd proftpd-xxx
./configure --prefix=/usr/local/proftp --enable-auto-shadow

여기서 prefix 부분은 설치될 경로이고 --enable-auto-shadow 는 리눅스에서 지원하는
쉐도우 패스워드를 자동으로 인식하게끔 해주는것이다. 보안상 반드시 넣어준다.
에러가 없다면
make; make install     해준다.

cd /usr/local/proftp  로 들어간다.
ls -R 이라고 친다. 그럼 각 디렉토리 별로 잘 보일꺼다.

bin 이라는 디렉토리는  ftpwho 라는 넘과 ftpcount 가 있다.
ftpwho 는 어느넘이 현재 접속해서 사용하는지 그 정보를 보여주고
ftpcount 는 몇놈이 접속되어있는지 카운트를 세어준다.

./ftpwho 라고 쳐본다.. 맨첨에는 암것도 없다.

sbin 이라는 곳에는 proftp 의 실행파일이 들어있다.
etc 에는 ftp 설정파일이 들어있다.
man 디렉토리는 아무래도 manual page 가 있는거 같다.. 이거 사용해도 되지만
그냥 man proftpd 라고 하면 매뉴얼 페이지가 뜰것이다... 와우리눅스는 proftp 기본탑재...

var 디렉토리에는 Log file 이 쌓이게 된다.... 몇번 사용해보고 이곳에 들어가면 로그파일이 자동 생성되어진걸 볼수있다.

이제 proftp의 설정파일을 고쳐주자...

cd /usr/local/proftp/etc 로 들어가서 vi proftpd.conf 로 설정을 바꾸자.

# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName   "ProFTPD Default Installation"
ServerType   standalone
DefaultServer   on

# Port 21 is the standard FTP port.
Port    21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask    022

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances   30
# Set the user and group that the server normally runs at.
User    nobody
Group    nobody

# Normally, we want files to be overwriteable.
<Directory /*>
  AllowOverwrite  on
</Directory>

# A basic anonymous configuration, no upload directories.
<Anonymous ~ftp>
  User    ftp
  Group    ftp
  # We want clients to be able to login with "anonymous" as well as "ftp"
  UserAlias   anonymous ftp

  # Limit the maximum number of anonymous logins
  MaxClients   10

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
  DisplayLogin   welcome.msg
  DisplayFirstChdir  .message


  # Limit WRITE everywhere in the anonymous chroot
  <Limit WRITE>
    DenyAll
  </Limit>

</Anonymous>


약간 틀리겠지만 위 형식대로 입력이 되어있을것이다.

ServerName  "어쩌구... "   <=== 호스트 이름을 지정해준다. 바꾸고 싶으면 바꾼다.
ServerType  standalone    <=== 슈퍼데몬 환경에서 돌아갈지... 아니면 단독데몬으로 돌아갈지 결정한다.
        우리는 그냥 단독데몬으로 돌린다.
        xinetd 환경에서 돌리면 접속시 약간의 딜레이가 생길수도 있다.
        왜? 사용자가 요청을 하면 xinetd 를 통과해서 다시 proftp 로
        접속을 해주니까...
DefaultServer  on  <=== 이 부분은 걍 내둔다..
Port   21  <=== ftp 포트를 지정한다. 디폴트 값을 사용한다. 이부분을 바꿔주고 싶으면
     /etc/services 파일도 수정해 줘야 한다. 이 파일을 한번 열어본다.
     각 포트번호와 서비스들이 보일것이다.
Umast   022  <=== 기본 퍼미션을 지정한다. 777 에서 적혀 있는 값을 빼준것이 기본 퍼미션이다.
      755-022=755   기본 퍼미션이 755라는얘기다...
MaxInstance  30   <=== DoS(Deny of Service) 의 공격에 보호하기 위해서 proftp가
      Standalone 모드로 동작할때 생성되는 최대 자식 프로세스의 수를 지정.
      기본값으로 둔다.(보안상...)
User   nobody
Group   nobody  <=== 요기 두 부분은 ftp 에 접속한상태에서의 소유권을 지정해 준다.
          root 권한으로 proftpd 데몬을 띠우고 여기에 지정된 사용자, 그룹으로
          권한을 넘긴다.
          nogroup 로 되어있으면 nobody 로 고친다.
<Directory /*>
  AllowOverwrite  on <=== 이 부분은 새로 생성될 파일로 덮어씌우기를 결정해준다.
</Directory>     on 이면 덮어쓰기, off 이면 안되지..

<Anonymous ~ftp>

좌르르르륵
</Anonymous>   <=== 요기는 계정이 없는 사용자. 즉 익명사용자를 위한 공간을 할당해 주는 부분이다.

요기까지 고쳤으면 설정 끝이다.

그럼 proftpd 데몬을 띠운다.
아까 proftp 실행파일은 sbin 안에 있다고 하였다.
그럼 sbin 으로 이동한다.
cd /usr/local/proftpd/sbin  
./proftpd start   라고 했을 때 아무런 메세지가 없어야 한다.
에러 발생했으면 메세지 잘 보고 고친다.. 안되면 손가락 짤러..

ftp에 접속이 되는지 접속을 해보자.

ftp localhost  라고 한다.    ftp 211.108.242.host 라고 해줘도 똑같다.
그럼 유져와 패스워드를 입력하라고 한다.. 입력한다.. root 사용자는 보안상 못들어 가니까 접속하기 전에 계정을 하나 만들어주자.

login faild 만 안뜨면 된다.
이때 접속되는 디렉토리는 /home/ 디렉토리에 있는 각자의 계정에 접속이 되게 된다.


*************
  ftp 사용법
*************

사용법 : ftp <hostname | ip address>
ex >  ftp 211.108.242.69
 name : 자기 아이디 (계정이 없으면 anonymous) 
 password : 자기 패스워드(없으면 e-mail 주소 또는 @ )
      ftp>    <=== 일케 뜨면 된거다.

      help 또는 ? 를 입력한다.(도움말 출력)
     
      dir
      ls        디렉토리 리스트를 보여준다.
      size 파일의 크기를 출력
      mkdir (dir) 새로운 디렉토리 만들기
      rmdir 디렉토리 삭제
      delete <file> 파일삭제
      mdelete file1 file2....... 여러파일 삭제
      pwd 현재 경로 출력
      status 현재 상태 출력
      exit
      quit 종료
      get (file) ftp의 파일을 자신의 디렉토리로 가져온다.
      put (file) 자신의 파일을 원격 ftp로 전송
      mget (file1, file2, ........)  여러 파일 동시에 가져오기
      mpug (file1, file2, ........)  여러 파일 동시에 받기
      cd (dir) 디렉토리 이동
      nlist (dir) 원격  ftp의 dir 서브디렉토리 리스트 출력
      rename <name1  name2> ftp 상의 파일이름 바꾸기
      chmod 퍼미션 조정
      open 원격 ftp host 로 접속하기

      기타등등....... man으로 알아보세요..


이제 명령어도 보았으니 한번 테스트 해보자. 파일을 한개 올린다.

put 파일네임   <=== 이라고 치면 전송 상태가 text로 출력된다. 다 올라갔으면 ls 나 dir 로 업로드가 잘 되었는지 살펴보자.

그럼 자신의 directory 에 있는 파일(업로드한 파일)을 삭제하고 ftp에서 전송하자.
get 파일네임   <=== 파일이 잘 전송이 되었나??? 자신의 디렉토리에서 확인해 본다.

여기서 잠깐!!!!

지금 현재 상태에서 cd .. 을 계속 쳐본다.... 아마 자신이 접속한 곳 보다 상위 디렉토리로 이동을 하게 되는것을 봤을것이다.
이렇게 되면 당근 안된다. 모르는 사람이 내 디렉토리를 보게 되는것은 좀 기분이 나쁘다.
이런 현상을 막으려면 proftpd.conf 파일에 다음을 입력해준다.
DefaultRoot ~  라고 입력해 준다.  ~ 는 자신의 홈디렉토리가 된다.

이렇게 했는데도 같은 현상이면 DefaultRoot 부분을 <Global> 태그로 감싸준다.
<Global>
  DefaultRoot  ~
</Global>
이렇게 적어준다. Global 태그는 ftp 전체에 영향을 주는 전역을 선언하는 태그라고 되어있당.

DefaultRoot ~ aaa 라고 해주면 aaa 사용자 빼고 다른 넘들은 상위 디렉토리로 이동가능
DefaultRoot ~ !aaa 라고 해주면  aaa 사용자 빼고 다른사람들은 상위디렉토리로 이동 불가능.

이렇게 해서 계정 사용자들은 ftp를 이용하게 설정이 다 되었다. 하지만 계정이 없는 사용자.
익명사용자에 대해서도 ftp 를 사용할수 있게 해주어야 한다.
<Anonymous 경로>    <=== 이 부분이 익명사용자 설정이라고 위에 적어놨다.

이곳에 설정을 해 주면 된다.
일단 익명 사용자들은 거의 대부분 다운로드만 받게 설정을 해주어야 한다. 물론 읽기전용으로 해야쥐..

그럼 설정을 하자.
<Anonymous /home/ftp> 라고 경로를 고쳐준다. 그리고 ftp 라는 유저도 등록해 주자.. 그래야 알아먹지..


<Anonymous ~ftp>   <=== 요기처럼 ~ 로 줘도 된다.
  User    ftp <=== ftp 유져와 그룹을 지정한다.
  Group    ftp
  # We want clients to be able to login with "anonymous" as well as "ftp"
  UserAlias   anonymous ftp <=== anonymous 로 들어온 사용자를 ftp 라는 별칭을 부여해준다.

  # Limit the maximum number of anonymous logins
  MaxClients   10 <=== 익명사용자의 최대 접속수를 지정해주는 부분이다.

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
  DisplayLogin   welcome.msg <=== 익명 사용자의 환영 메세지이다.
  DisplayFirstChdir  .message


  # Limit WRITE everywhere in the anonymous chroot
  <Limit WRITE>  <=== 이 부분은 익명 사용자의 write 권한을 박탈한다.
    DenyAll  <=== 요기가 AllowAll 이라고 되어있으면 어케 될까?? 파일이 올라가게 된다.
  </Limit>
</Anonymous>

이제 대충 설정이 끝났다. 그리고 만약 익명사용자가 접근이 안된다면
<Anonymous > 태그 안에 아래처럼 적어준다.
RequireValidShell off

이 부분이 off 로 되어있어야 접속이 가능하게 된다. 이부분이 없어도 접속은 되지만
만약 익명 계정 접속이 안된다면 이부분부터 추가시켜준다.

그리고 만약 익명 사용자가 10명이 넘었을때 메세지를 보내야 하는데 아래와 같이 설정한다.

MaxClients  10 "미안허다. 10명밖에 못들어와.... 조금만 지둘려 ㅡ,.ㅡ"

이렇게 하면 10명이 넘은 사용자들에게는 따옴표 안의 문자가 출력될것이다.
그리고 성질급한 넘들은 브라우저 10개 띠워놓고 10개를 한 ftp 서버에 접속한 후에
파일다운로드를 시도하려 할수도 있다.
이때 이것을 막아주려면
MaxClientsPerHost 2 "이눔아.!! 좀 지둘려...."

이렇게 써주면 된다.

이제 환영메세지를 만들어보자.

아래의 내용을 /home/ftp/ 밑에 welcome.msg 에 입력한다.

vi welcome.msg
*****************************************************
어서오시게... 많이 가져가게나...
*****************************************************
proftp 1.2 %V
ftp://%L/

남은 용량 : %F
현재 사용자 수 : %N/%M (한 호스트당 1회 접속만 허용)
%R에서 %U님이 접속했습니다.
%T년에 접속.

불편한점은 메일로 보내주세요.
E-mailto:%E

*****************************************************

위의 내용중에 % 가 붙은 넘들은 아래와 같다.

%V 버젼 표시
%L 호스트 주소표시
%F 남은 용량
%N 현재 접속자수
%M 최대 접속자수
%R 접속한 호스트 주소
%U 유져이름 (anonymous 가 나오겠지???)
%T 접속한 날짜
%E 관리자 이메일주소(네임서버에 지정된 메일)

머 대충 이정도가 있다.. 더 알고 싶으면 proftpd.org 가보면 많다.


현재 계정사용자는 업로드/다운로드가 다 가능하지만 익명사용자는 다운로드만 가능하다.
만약 업로드까지 가능하게 해주려면 <Anonymous> 태그 안쪽에 아래와 같이 설정한다.

# 익명 사용자 업로드 디렉토리
<Directory incoming/*>    <=== /home/ftp/ 디렉토리 안에 incoming 라는 디렉토리를 만들어줘야한다. 퍼미션도 755로 변경해준다.
  AllowOverWrite on <=== on으로 해줘야 업로드가 가능하다.
  AllowRetriveRestart on <=== 요기랑 아래줄은 아마 이어올리기가 가능한 옵션일것이다. 생각 안나네.. ㅡ,.ㅡ;
  AllowStoreRstart on
  <Limit DELE RMD>   <=== 요기는 업로드 한 파일을 마음대로 지울수 없게 하기 위해서 지우는 속성을 박탈한 부분이다.
    DenyAll
  </Limit>
</Directory>

이렇게 해주면 익명계정의 사용자도 업로드가 가능하게 된다.

오늘은 여기까지... ^^



 

Posted by tornado
|

*********************
네임서버
작성자 : 유희성
*********************


Domain 이란 숫자화된 인터넷 주소인 IP주소를 대신하는 문자화된 별칭이다.
우리는 사이트에 접속을 할 때 http://www.yahoo.co.kr 이라고 입력하고 접속을 하게 된다.
여기서 www.yahoo.co.kr 을 도메인이라고 부르며 이것이 IP주소를 대신하는 인터넷주소이다.
위와 같이 도메인을 입력하게 되면 컴퓨터는 알아듣지 못하게 된다. 이렇게 입력된 도메인을
컴퓨터가 알아들을 수 있는 숫자형태로 바꾸어줘야 하는데 이 작업을 해주는 것이 DNS Server 이다.

도메인 이름 규격은 각 나라마다 약간씩 설정이 틀리지만
(음.. 한글도메인은 어케 되는지 저도 멀라영... 좀 알려줘여ㅡ,.ㅡ)
대부분 영문자와 숫자, 그리고 하이픈(-) 의 조합으로 사용되고 대소문자는 구별되지 않는다.
이름의 길이는 2글자에서 최대 63자까지 허용된다.
도메인 이름에는 콤마(,)나 언더바(_)등 기호를 사용하지 못한다.
그리고 도메인 이름은 전 세계에서 유일하여야 한다.

도메인 이름체계

이름체계는 Tree 구조로 이루어져있다.
제일 위에는 루트(ROOT) 도메인을 기준으로 3단계의 기본적인 단계로 구성된다.
루트 도메인이란 쩜! (.) 을 이야기 한다.
http://www.yahoo.co.kr. <== 요기처럼 kr 다음에 쩜(.) 이 하나 붙는데 이것을 루트 도메인이라고
한다. 이 루트 도메인 다음에 온 kr 이나 net, com, org 등등.. 이 1차 도메인이다.
이것은 우리가 임의로 정하는 것이 아니고 이것을 관리하는 INTERNIC 에 등록이 되어있는 것을 우리는
가져다가 쓰게 되는 것이다.

여기서 1차 도메인도 최상위 도메인과 국가도메인으로 나뉘어 지게 된다.
최상위 도메인이란 org, net, com, edu, gov, 등등이 되고, kr, jp. fr 등등 각 나라의
국가 도메인이 된다.
위의 www.yahoo.co.kr. 을 보면 처음 루트도메인 다음에 1차도메인 KR 이 오게 되었다.
그 다음에 존재하는 co 라는 부분이 2차 도메인에 해당된다.

2차 도메인은 사용자가 원하는 이름을 신청해서 사용할 수 있다. 하지만 kr이나 jp 등등의 국가도메인이
1차 도메인이 오면 국가에서 기관을 분류시키기 위해 미리 정의된 이름을 사용하기 때문에 이럴 경우에는
사용자가 직접 2차 도메인 이름을 지정하여 사용할 수 없다.
Oracle.com 같은 사이트는 최상위 도메인으로 이미 정해져 있는 것을 사용하였기 때문에 2차 도메인으로
oracle 이라는 이름을 지정하여 사용하였다… 유가릿??

3단계 도메인은 하위 도메인이라고 하며 우리가 만들고자 하는 yadong.pe.kr 같은 사이트에서
yadong 같은 녀석이 3차 도메인이 되게 된다. 왜 3차 인지 이해가 안되면 벽보고 반성한다.

자… 이렇게 도메인이 이루어졌다는 것을 알았다. 그럼 네임서버는 어떤 역할을 해주는 것일까…
네임서버는 위에서 말한 도메인 이름을 ip 주소로 바꾸어 주는 기능을 해준다.
반대로 ip 주소를 도메인 이름으로 바꿔주는 역할도 한다.

그럼 어떻게 작동 할까… (칠판에 그림참조)

일단 내가 브라우져에서 www.yahoo.com 이라고 입력을 한다.
그러면 이것은 네임서버로 질의를 보내게 된다. 만약 ADSL 이라면 인터넷공급회사에서 자동으로 네임서버가
지정이 되어있을 것이다.

일단 네임서버로 질의를 하게 되는데… 여기에는 당근 yahoo.com 의 정보가 없다.
그럼 로컬네임서버는 루트네임서버(.) 로 질의를 요청하게 된다.
그런데…. 루트 네임서버에서도 com 이라는 1차 도메인을 모르겠다고 하고… 질의를 com 네임서버를 참조하라고 한다.
그럼 다시 질의는 com 네임서버로 가게 된다… 여기서 열라 뒤진다. 이때 yahoo.com 이 정확하게 인터닉에 등록이
되어있는 도메인이라면 여기서 yahoo.com 의 아이피 주소를 우리가 맨 처음 질의한 로컬 네임서버에 알려주게 된다.
이렇게 알게된 IP 주소를 최종적으로 우리에게 알려주게 된다.
그런데 여기서… 맨 처음 질의를 할 때 ROOT 도메인부터 찾는다고 하였는데, 이때 제일 처음부터 찾으려면 서버는
쌩 노가다를 하게 된다. 그래서 CACHE 파일을 제공하여 주는데 /var/named/named.ca 라는 파일이다.
버전마다 약간 이름이 틀리다.

이 파일은 우리가 작성하는 것이 아니라 인터닉에서 제공을 하여 준다.
이 파일이 없다면 다른 PC 에서 복사를 하던지 인터닉에 접속해서 다운을 받던지 한다. 절대 수정금지..


/////////////////////
설 정 하 기
/////////////////////

네임서버를 구동하기 위해서는 bind 라는 패키지가 필요하다. 이 패키지는 웬만한 배포판에는 기본으로 들어있다.
현재 사용되는 버전은 bind8 과 bind9 이다.그럼 깔려있는지 살펴보자..

rpm -qa | grep bind <=== 라고 입력을 해서 뭐가 있으면 깔려있는 것이다.

거의 대부분 전체설치를 하기 때문에 자동으로 깔린다… 만약 없다면 linux cd 넣고 다시 깐다.
위치는 RedHat/RPMS 에 존재한다… source 로 깔고 싶다면 www.isc.org 에서 받던지 국내 Linux site 를 뒤져본다…


*********************
Bind 소스로 설치하기.
*********************

일단 RPM 패키지로 설치되어있는 bind 를 제거하여야 한다.
rpm -qa | grep bind 라고 쳐서 뭐가 나오면 지운다.

rpm -e 나온 패키지이름 <== 지운다.

이렇게 지운다음에 다운로드 받은 소스파일을 압축을 푼다.
/tmp/tar xvzf bind-9.2.0.tar.gz 라고 쳐서 압축을 푼다.
그리고 압축 풀린 디렉토리로 들어간다.

./configure -with-opens니
make; make install;
이렇게 설치가 되면 /usr/local/bind 디렉토리에 라이브러리 파일이 생성되고 바이너리 파일은
/usr/sbin 디렉토리에 생성된다.
설치 끝.

네임서버의 유형은 크게 세가지로 나뉘어진다.

1. primary name server : 1차 네임서버
2. secondary name server : 2차 네임서버
3. caching only server : 캐시 서버.

1차 네임서버는 당근 필수적이다. 2차 네임서버는 1차 네임서버에 주기적으로 접속하여 백업본을 유지한다.
일반적으로 2차 도메인은 1차 도메인이 다운되었거나 기타 다른 문제가 발생되었을 경우를 대비하여 같은
네트워크에 두지 않는다. 만일 같은 네트웍에 존재한다면 1차 네트웍이 죽으면 2차 네임서버도 작동을 안하게
될것이다. 그럼 뭐하러 2차를 만들어…

캐쉬 서버는 local DNS 에 접속하기 곤란한 상태에 있을 때 효과적으로 운영된다.
원거리에 위치한 같은 도메인을 사용하는 네트워크에 대해서 LOCAL DNS 를 시용하면 약간의 NETWORK DELAY가
발생하게 되므로 좋지 않은 상황이 된다.
이때 캐시 서버를 이용한다. Cache 서버는 이름을 IP 로 변환하는 작업만을 수행한다.


네임서버 설정 파일은 아래와 같다.

/etc/resolv.conf <== 기본 네임서버 지정. 여기에 기본 네임서버 설정이 없으면
네임서버 질의를 하지 못한다.
/etc/named.conf <== 이 파일은 /etc/hosts와 DNS 에 질의할 순서를 정한다.
/var/named/named.ca <== 루트 네임서버에 대한 정보가있는 데이터베이스파일
/var/named/named.local <== 루프백인 localhost 에 대한 설정파일
/var/named/파일이름.zone <== Public domain 에 대한 forward zone 파일
/var/named/파일이름.rev <== Inverse domain 에 대한 reverse zone 파일…


위의 파일중에 *.zone , *.rev 파일은 named.local 파일을 복사하여 사용한다.

먼저 named.conf 파일을 vi로 열어서 보자..

vi /etc/named.conf

options {
directory "/var/named";
};
zone "." {
type hint;
file "named.ca";
};
zone "0.0.127.in-addr.arpa" {
type master;
file "named.local";
};


제일 위에 보면 option 부분이 존재하고 그 안에는 directory "/var/named"; 라고 되어있다.
끝에는 항상 세미콜론이 붙는다. 이 부분은 여기에서 설정한 네임서버의 파일이 존재할 디렉토리를 말한다.
그러니까 여기서 기본 네임서버 설정을 하고 거기에 따른 부수적인 파일들은 /var/named 디렉토리에
위치하여야 한다는 이야기이다.

Zone 이라고 시작되는 부분은 zone 설정영역이라고 하며 이 부분에 캐쉬전용서버, 1차 , 2차 네임서버등에
관련된 설정을 해준다. 설정방법은 다음과 같다.

zone "데이터베이스" {
type (hint|master|slave);
file "존 파일명";
};

여기서 데이터베이스라고 되어있는 부분은 이 값에 따라 두개의 zone 으로 나누어지게 된다.
Option 부분 아래의 zone 부분을 보면 zone "." 이라고 되어있는데 쩜 (.) 이라고 되어있는
데이터베이스는 캐시서버를 의미한다.
윗부분의 zone "데이터베이스" 부분의 데이터베이스는 우리가 실제 설정을 할 진짜 도메인 이름을 넣어준다.
Yadong.com 좋다~~ (^O^)
이렇게 우리가 사용할 도메인 이름을 입력하면 이부분의 zone 영역은 Forward zone 데이터베이스가 된다.

그런데 앞의 설명에서 이름을 IP 주소로, IP주소를 이름으로 바꿔주는게 네임서버 역할이라고 하였다.
우리는 지금 이름을 IP 주소로 바꾸어주는 부분을 설정하였다. 그럼 반대의 경우도 설정을 해주면 된다.
방법은 아래와 같다.

zone "32.249.211.in-addr.arpa" { <== 이렇게 지정하면 reverse zone 이 된다.

};

이때 마지막의 호스트 부분은 적지 않는다. 왜? Network class 부분을 잘 생각해보자..
그렇다면 위의 두 가지 부분을 named.conf 파일에 추가하자..

zone "만들 도메인이름" {}
zone "아이피꺼꾸로.in-addr.arpa" {}

이렇게 설정이 되었다면 {} 안에 들어갈 부분을 작성해야 한다. 위쪽에 보니까 type 부분과 file 부분이 있다.
Type 부분은 hint, master, slave 중에 하나를 써주면 된다.
Hint 는 좌측 페이지의 첫번째 zone 영역을 보면 된다. 그러니까 cache 서버 라는 것을 알 수 있다.
master 부분은 1차 네임서버, slave 부분은 2차 네임서버이다. 2차 네임서버를 지정하여 줄때는
masters { 1차 네임서버 아이피 주소; }; 부분을 반드시 명시해 주어야 한다.

file "존 파일명"; 부분에는 directory 부분에 적혀있는 /var/named 디렉토리에 작성하게 될 zone 영역
파일들을 적어주면 된다.

file "만들도메인.zone"; <== 포워드 존 파일
file "만들도메인.rev"; <== 리버스 존 파일

거의 대부분 이런 형태로 zone 파일을 작성한다.

자 … 이렇게 작성이 되었다면 이제 /var/named 디렉토리로 이동하여 포워드존 , 리버스존 파일을 만들어 주자.
각 영역파일들은 named.local 파일을 복사하여 사용한다.

cp named.local 만들도메인.zone
cp named.local 만들도메인.rev

이렇게 복사를 하였으면 포워드 존 파일부터 수정한다.

vi /var/named/만들도메인.zone

$TTL 86400
@ IN SOA ns.211.249.32.119. root.ns.211.249.32.119. (
20020402 ; serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
86400 ) ; Mininum(TTL)

IN NS ns.211.249.32.119.

1 IN PTR localhost.


이런 형태의 파일이 보일것이다.
이제 차례대로 알아보자.
위쪽에 보면 @ 부분이 있는데 여기서 자주 헷갈리게 된다. 네임서버 설정에서의 @는 이메일을 보낼 때의
그 골뱅이가 아니고, 자기자신의 호스트를 가르키는 녀석이다.
골뱅이를 써도 되고 진짜 호스트 이름을 적어줘도 된다. 편의상 @로 사용한다.

@ IN SOA localhost.localdomain. root.localhost.

위의 부분은 책에 보니까 SOA 레코드는 해당 도메인에 대해 네임서버가 모든 리소스 레코드 권리를
가지고 있음을 알려주는 레코드. 라고 되어있다.
위에 골뱅이는 설명을 해 놨고 IN 은 네트워킹 어드레스 클래스를 의미하는 것으로 항상 리소스를
지정할 때 사용된다.
SOA 다음에는 1차 네임서버 주소와 관라자의 Email 주소가 있다. 이때 주의하여야 할 것은 여기서
적어주는 도메인은 완전한 도메인 이기 때문에 뒤에 반드시 쩜(.)을 찍어줘야 한다는 것이다.
쩜 빼고 울지말도록..
root.localhost 부분은 이 서버의 관리자 이메일 주소를 적어주는 부분이다.
이때 @를 사용하지 않는다. 이유는 위를 본다.

SOA <== Start of Authority
NS <== 네임서버 리소스
A <== 도메인에 IP 주소를 부여해 주는 레코드
MX <== 메일 익스체인저
CNAME <== 하나의 아이피에 여러 개의 별칭을 가질 수 있게 해주는 레코드

그리고 그 다음에 괄호 부분에는 각 설정 부분이 오게 된다.

20020402 ; serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
86400 ) ; Mininum(TTL)

여기서 세미콜론은 주석이다.

Serial 부분은 네임서버의 데이터 버전을 나타내는 부분이다. 보통 날짜를 년월일로 적어주지만 맘대로 적어도 된다.
이 부분은 2차 네임서버나 다른 네임서버에서 로컬 네임서버의 데이터를 불러올 때 자신이 가지고 있는 시리얼 넘버와
비교하여 자신의 것보다 높으면 업데이트 된 정보를 가져온다.

Refresh 부분은 2차 네임서버가 1차 네임서버에게 새롭게 업데이트된 정보가 있는지 요청 할 때까지의 시간을 지정한다.
단위는 초단위다. 60초 * 60분 * 3 = 10800 즉 세시간마다 요청을 보낼것이다.

Retry 부분은 2차에서 1차로 연결이 되지 않을 경우 재 연결할 때까지의 대기 시간이다.

Expire 부분은 2차 네임서버가 일정시간 동안 1차 네임서버에 접속하지 못했을 때 이전의 정보는 무의미하다는 것으로
간주하여 이를 파기할 시간을 정하는 부분이다.

Minimum(TTL) 이 부분은 각 zone 파일의 윗부분에 정의된 TTL 변수를 사용하고, 다른 변수에서 자신의 정보를
가져갔을 때 그쪽 서버의 캐시에 그 정보가 얼마나 오랫동안 머물것인지 정한다. 86400 초 후에 삭제된다.


NS 레코드는 해당 도메인에 대한 네임서버를 지정하는 레코드이다.

IN NS ns1.만들도메인.com. <==점 빼먹지 말자. 1차 네임서버

위처럼 지정해 주면 된다. 그리고, 우리는 위에서 적어준 도메인으로 메일도 받아야 한다.
앞 장에 보면 MX 라는 부분이 있다. 이 레코드를 사용하면 된다. 사용법은 아래와 같다.

IN MX 10 만들도메인.com.

MX 다음에 10 이라고 되어있는 부분은 1차 메일서버를 지정하게 된다. 2차 메일서버가 있다면
MX 20 2차도메인.com. <== 이렇게 추가한다.
이때 MX 레코드는 절대 IP 주소로 지정하지 않는다. 왜??? 안되니까… ㅡ,.ㅡ

우리는 지금 Forward zone 을 설정하는 부분이다. 이름을 치고 들어왔다면 그것을 IP로 바꾸어 주어야 하는데
지금은 1차 네임서버 이름만 지정을 하였다. 각 부분은 탭으로 띠어준다. 스페이스바는 사용하지 않는다.

먼저 /etc/named.conf 파일에 zone 영역에 yadong.com 이라고 적어줬다면 이것이 도메인이름이 될 것이다.
그럼 @ 를 써도 되겠지??

@ IN A 211.249.32.119 <==이 부분은 자기의 호스트
즉 /etc/named.conf 에서 yadong.com 이라고 적었다면
그 이름을 치고 들어왔을 때 바꾸어줄 아이피 주소를 적어준 것이다.

//////////////////////////////////////////
www.yadong.com 이라고 치고 들어왔을때는 ???
//////////////////////////////////////////

www IN A 211.249.32.119 <==이렇게 해주면 되겠지??
ns IN A 211.249.32.119 <==ns.yadong.com 이라고 치고 들어왔으면 이렇게 추가해주면 된다.


그럼 완성된 파일을 보자..

$TTL 86400
@ IN SOA ns. yadong.com. root. yadong.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.yadong.com.
IN MX 10 yadong.com.
@ IN A 211.249.32.119
ns IN A 211.249.32.119
www IN A 211.249.32.119

위와 같은 형식이 될 것이다. 자~ 여기서 우리는 Forward zone 영역 파일의 설정을 끝냈다.
이제 Reverse Zone 영역을 작성해 보자.

$TTL 86400
@ IN SOA ns.yadong.com. root.yadong.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.yadong.com.
119 IN PTR yadong.com.
119 IN PTR www.yadong.com.
119 IN PTR ns.yadong.com.

이렇게 작성하면 된다.
/etc/named.conf 에서 우리는 Reverse Zone 데이터베이스를 설정할 때
zone "0.0.127.in-addr.arpa" 이렇게 적어주었다.
자기 자신의 루프백 주소는 127.0.0.1 이다
이 부분을 잘 보면 마지막의 호스트부분인 1 을 생략하고 나머지 번호를 거꾸로 적었다는 것을 알 수 있다.
내가 사용하고 있는 IP 주소가 만약 211.249.32.119 이라면 뒷부분의 119 부분을 뺀 나머지 부분 211.249.32 를
거꾸로 써주면 되는 것이다. 그러니까 119를 뺀 나머지부분은 이미 설정이 되어있는 부분이기 때문에 IP 주소를
다 써 줄 필요가 없다는 말이다. 그냥 119 라고 적어주고 그 IP 가 들어왔을 때 변환시켜줄 도메인이름을 적어주면 된다.
그리고 PTR 레코드는 IP주소를 도메인 이름으로 변환해 주는 역할을 한다.

이렇게 해서 Reverse Zone 영역의 설정도 끝났다.
이제 막바지 작업이다.
/etc/hosts 에 자신의 도메인정보를 입력한다.
/etc/resolv.conf 에 자신의 도메인 정보를 입력한다.

/etc/rc.d/init.d/network restart 해주고
/etc/rc.d/init.d/named restart 라고 해준다. 에러가 없다면 네임서버 질의를 한다.

nslookup 자기도메인.com <== 이렇게 해서 호스트 이름과 아이피 주소가 나와야 한다.
물론 반대로 IP 주소를 쳐도 이상없이 나와야 한다.

Posted by tornado
|

************************************
SendMail  (http://www.sendmail.org)
작성자 : 유희성
************************************


전자메일이 작동하는 방식은 일반편지와 유사하다.
일반 편지는 종이에 편지를 써서 우체통에 넣어 받는 사람, 보내는 사람의 주소, 이름을 적어 우체통에 넣는다.
그러면 우체통을 우체국 직원들이 체크해서 우체국으로 가져간다.
우체국에서는 해당지역으로 배달되는 것과 외부로 나가는 것을 분리한다.
관할 지역의 메일은 다시 우체부가 집으로 배달해 주고 외부 편지는 중앙 우체국으로 보낸다.

MUA(Mail User Agent) : 연필과 종이에 해당된다.
MDA(Mail Delivery Agent): 편지를 전달하는 우체부
MTA(Mail Transfer Agent): 외부로 메일을 보내는데 사용하는 트럭, 비행기, 기차 등등....

MTA 로는 sendmail, zmail, MMDF 등등이 있다.

Sendmail 은 크게 프로그램인 sendmail과 config 파일인 sendmail.cf로 구분할 수 있다.

Config 파일은 ----  sendmail.cf
       |--  Queue file
       |--  Aliases File 로 나누어 진다.


전송방식 =>>>>>  칠판에 그림 참조.


POP  : 메일서버에서 사용자의 편지를 자신의 MDA로 완전히 이동시킴.
IMAP : 메일서버에서 사용자의 편지를 자신의 MDA로 복사(참조).

먼저 자신의 PC에 메일 프로그램이 깔려있는지 확인하자.

rpm -qa | grep sendmail 이라고 해서 뭐가 나와야 한다. 없다면 깔아야 한다.

rpm -qi sendmail   ===> sendmail 정보확인.
rpm -ql sendmail   ===> sendmail이 어디에 설치되어있나???

그런데 메일 프로그램만 깔려있으면 안된다. 편지를 받아보려면 imap 이라는 패키지가 설치되어있어야 한다.
(pop3 와 imap이 동시에 설치됨)

rpm -qa | grep imap
rpm -qi imap  이라고 체크해보자... (없으면 linux 시디 넣고 깔던지 다운로드 해서 깔던지 해야한다)

뭔가 나왔다면 이녀석들을 돌릴 준비를 해줘야 한다.
일단 우리는 슈퍼데몬(xinetd) 환경에서 돌려줄 것이다.
슈퍼데몬에서 돌아가는지 확인해 보자.

vi /etc/xinetd.d/ipops  에 보면

disable=no 라고 되어있어야 한다.  yes 라면 no 로 바꾸어준다.

vi /etc/xinetd.d/imaps   파일도 위와 같이 고쳐준다.

이제 슈퍼데몬을 restart 시킨다.

/etc/rc.d/init.d/xinetd restart  라고 실행한다.

telnet localhost 110   이라고 쳐서 ok 뜨면 된거다. 110번은 pop3 이다.
안된다면 /etc/xinet.d/ 에 있는 위의 설정파일을 확인해보자

빠져 나올때는 quit 라고 입력한다.

만약 위의 테스트중 계속 에러발생시 포트가 막혀있을 가능성도 있을수 있다.
/etc/services  파일을 보면 그 안에 각 포트 설정이 되어있는데
해당 포트에 주석처리(#)가 되어있는지 잘 살펴보기 바란다.

이제 편지를 받을준비와 보낼 준비는 되었다.
그럼 이제 sendmail 을 설정 해 주자. 설정 파일은 /etc/sendmail.cf 이다.

**************************
SENDMAIL 설정하기
**************************

vi /etc/sendmail.cf

내용이 무쟈게 길다... 줄번호를 붙여서 본다. :set nu 라고 vi 명령창에 쓴다.. 그럼 줄번호 보인다.

여기서 sendmail.cf 파일의 설정 규칙을 잠깐 짚고 넘어가자.

1. 빈 행은 무시한다.
2. # 으로 시작하는 행은 주석처리로 무시한다.
3. C,D,F,H,K,M,O,P,R,S,V 로 시작하는 행은 설정행이며 이들은 각각 하나의 설정명령이다.
4. 하나의 빈 공간 또는 여러개의 빈 공간(TAB) 으로 시작하는 행은 앞 행의 연장이다.

********************
센드메일의 설정 명령어
********************

C : 클래스 정의
D : 매크로 정의
E : 환경변수 지정
F : 클래스 정의 (file, pipe)
H : Header 정의(Format of header)
K : Key file 정의(map 정의)
M : mailer 정의
O : 옵션
P : Message Precedences
R : 덮어쓰기(Rewrite)
S : Ruleset(새로운 규칙지시자)
T : Truseted users( 사용자 지정)
V : 설정 파일 버전


81번째 줄 정도에 Cwlocalhost 이라고 되어있는 부분이 보일것이다.
이 부분은 C설정 명령으로 localhost를 w 클래스로 정의하는 행이다. 기본적으로 localhost가 설정되어있다.
C 명령어는 문자열을 정의한다.

설정 예 : Cwlocalhost yadong.com dolpung.pe.kr
(이때 각 도메인은 진짜 등록되어있어야 한다. 요즘에는 진짜 도메인 아니면 메일이 안간다.
그리고 네임서버 상에서도 제대로 설정이 되어있어야 한다)


84번째 줄 정도에 보면  fw/etc/mail/local-host-names 라는 부분이 보일것이다.
이 부분은 메일을 수신할 호스트 이름을 명시할 파일의 위치를 설정이다.
주석처리되어있으면 절대 안된다. (sendmail 8.9 이하 버젼은 아마 sendmail.cw 파일로 되어있을것이다.)

179번째 줄 근처에 보면
#MaxMessageSize=1000000  이라는 부분이 있는데 여기는 메일의 최대크기를
지정해 주는 문장이다. 그런데 지금은 주석처리가 되어있다. 이렇게 주석처리가 되어있다면 메일크기의
제한이 없다는 것이다. 이부분을 주석을 풀고 용량을 조절하면 개인당 메일용량을 조정할 수 있게 된다.
이곳은 최대 메세지 크기 제한이다.

만약 메일 공간의 용량을 제한하고 싶다면 sendmail.cf 파일의 제일 아랫부분(1484번째 줄인가??)에

Mlocal,         P=/usr/bin/procmail, F=lsDFMAw5:/|@qSPfhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
                    M=10485760, T=DNS/RFC822/X-Unix,

이런 부분이 있을꺼다. 여러분의 현재 설정에서는 M=10485760 이라는 부분이 없을텐데
이 부분을 추가해준다. 쉼표도 찍어야겠죠?
이렇게 하면 받는 메일의 용량을 10Mb 로 제한을 하게된다.


274 번 째 줄 근처에
O QueueDirectory=/var/spool/mqueue   라는 부분이 있는데 이부분은 큐 디렉토리를 설정해준다.

293 번째 줄에 보면
O TimeOut.queuereturn=5d   라고 되어있는데 메일을 보내려는 호스트에 문제 발생시 큐 디렉토리에
                           저장하게 된다.

머 이밖에 많은 설정이 있지만 일단 생략하고 자세한것은 따로 책을 보기 바란다.

이제 sendmail.cf 파일의 설정은 대충(정말 대충이다 ㅡ,.ㅡ) 끝났다.

이제 해야할 일은 센드메일의 수신자를 설정하는 일이다. 위에서 sendmail.cf 파일을 설정할때 메일을 받을곳의
호스트 이름을 명시할 파일의 이름이 local-host-names 라는 파일이라는것을 우리는 알았다.
이 파일은 /etc/mail/ 디렉토리 안에 있다.
vi /etc/mail/local-host-names  라고 쳐서 아래와 같이 입력한다.

자기호스트.com      # yadong.com 이 되겠지요??

저장하고 나온다.

이렇게 하면 들어오는 메일의 수신자를 설정하게 된것이다.

이제 남은 설정은 센드메일로의 접근을 제어해 주는 일이 남았다.

/etc/mail/access 라는 파일이 그 역할을 해준다. 이 파일이 해주는 역할은 특정 호스트나 도메인의 접근을
허락, 거부 여부를 설정할수 있는 중요한 파일이다.

vi /etc/mail/access 라고 입력하자..

그럼 파일 내용중에 아래와 같은 부분이 있을것이다.

localhost.localdomain  RELAY
localhost   RELAY
127.0.0.1   RELAY

위의 상황은 자기 자신, 즉 localhost 에서 보내는 편지는 통과(RELAY) 시키겠다고 적어놓은 것이다(default값임)
위의 아랫쪽에 자기의 주소와 IP  번호를 입력하고 RELAY(통과) 시키자.

yadong.com   RELAY
211.108.242.host  RELAY

이렇게 해주게 됨으로써 yadong.com 에서 보내는 편지를 통과 시키겠다!!! 라고 설정이 끝났다.

만약 yadong.com   REJECT 라고 하면 어떻게 될까??
정답은 메일 수신이 안된다는 것이다... REJECT 는 특정호스트에서 오는 편지를 접근 못하게(REJECT) 하는 역할을 한다.

만약 스팸메일이나 받기 싫은 메일이 계속 오게 되면 이곳에 HOST 이름을 적어주던지 IP 번호를 적어주고 REJECT 시키면
메일이 거부된다.

참고로 이 파일(access)는 /etc/sendmail.cf 파일에서
'Kaccess hash -o /etc/mail/access' 로 지정되어있어야 한다.(default 값이니까 안건드려도 된당)

그리고 리눅스에서 센드메일은 기본적으로 localhost 이외의 모든 호스트에 대해서 RELAY 를 허용하지 않도록 설정
되어 있다. 그러니까 이 파일에 RELAY 시킬 호스트 이름과, REJECT 시킬 호스트 이름을 적어줘야 한다.


이제 수정이 끝난 access 파일을 데이터베이스화 시켜주어야 한다.
센드메일은 access 파일을 사용하지 않고 access.db  라는 dbm 파일을 이용한다.

cd /etc/mail
makemap hash /etc/mail/access < /etc/mail/access   라고 입력한다. 에러가 당연히 없어야겠징???

이렇게 다 했으면 센드메일 데몬을 다시 시작 시켜주자.

/etc/rc.d/init.d/sendmail stop
/etc/rc.d/init.d/sendmail start

라고 해주자... 물론 restart 해줘도 된다. 오케바리 떴으면 이제 메일을 보내보자.
수신자는 root@dolpung.pe.kr 로 보내주세요..

mail root@dolpung.pe.kr  이라고 입력한다.
subject:  <===  이부분에 제목을 입력하고 그냥 엔터친다.
프롬프트가 그냥 깜빡이고 있으면 내용을 좌아아아아악 적어준다.

다 입력을 하였으면 ctrl+d 를 살포시 눌러준다. 그럼 Cc:  라는 곳이 뜨는데 참조 이니까 그냥 엔터로 무시한다.


 

Posted by tornado
|
subversion을 사용하고자 한다면..
subversion을 언제인가 사용해보고 싶은 욕심이 있었는데..앞으로 공부하기에 좋은 자료가 될거 같아서 여러분과 공유하고자 퍼왔습니다.

=============================================================
Subversion  

Subversion 은 공개 버전관리 도구인 CVS 의 여러 단점들을 보완한 공개 버전관리 프로그램 입니다. 디렉토리 삭제, 텍스트/바이너리 자동인식, 속도등이 CVS 보다 뛰어납니다. 엊그제 테스트 삼아 깔아 봤는데, 간단한 설치와 뛰어난 기능. 그리고 보조도구들의 기능도 뛰어나서 만족했습니다. 

Subversion Official Site( http://subversion.tigris.org/ )
- SubVersion 공식 사이트
TortoiseSVN ( http://tortoisesvn.tigris.org/ )
- 공개 서브버전 클라이언트 인데, 정말 편리합니다. Gui 를 사용하지 않고 익스플로러 에서 ContextMenu 를 통해서 정말 쉽게 사용할수 있습니다.
KLDP > Subversion 사용 HOWTO ( http://wiki.kldp.org/wiki.php/DocbookSgml/Subversion-HOWTO/ )
- 한글로 된 튜토리얼 입니다.
김성민 님의 Wiki ( http://serious-code.net/moin.cgi/Subversion?action=highlight&value=cvs )
- SubVersion 사용에 대한 도움말과 링크들이 있습니다.


from http://www.okjsp.pe.kr/bbs?act=VIEW&bbs=TOOL&seq=51640
Posted by tornado
|


아파치웹서버 모니터링하기

아파치웹서버를 동작시킨 후에 관리자는 서버의 부하를 어느정도 받고 있는지 모니터링을 해야한다.

부하가 많고 응답속도가 현저하게 떨어졌을 때에는 적절한 조치를 취해야하며, 데몬은 뜨있지만 제대로 응답하지 않는 경우도 있기 때문에 항상 모니터링을 해야한다.

아파치웹서버의 모니터링은 유닉스의 쉘상태에서도 할 수 있으며, 웹으로도 할 수 있다.

일단 이런 모니터링을 가능하게 하려면 httpd.conf파일에 다음과 같이 설정을 해야한다.

 

 

아파치웹서버를 처음설치하고 나면 이부분은 주석처리가 되어있으므로 주석부분을 제거한 후에 위의 예처럼 "SetHandler"부분에  "server-status"라고 설정을 해두어야한다.

 

자, 이제 서버모니터링을 웹브라우즈로 해보자.

먼저 아파치를 띄워야하며 웹브라우즈를 실행시키도록 한다.

실행시킨후에 다음과 같은 URL을 주소입력부분에 입력한다.

        http://www.yourdomain.co.kr/server-status

또한 주기적인 갱신으로 계속적인 모니터링을 하려면 다음과 같이 refresh주기를 주면 된다. 단위는 초이다.

http://www.yourdomain.co.kr/server-status?refresh=5

예를들어 자신의 도메인이 www.manualand.co.kr이라면

       http://www.manualand.co.kr라고 하면 된다.

 

이 부분에 대한 대략적인 설명은 다음과 같다.

  •          Server Version : 아파치서버의 버전을 나타낸다.
  •          Server Built : 아파치서버가 설치된 년, 월, 일, 시
  •          Current Time : 현재 모니터링하는 년, 월, 일, 요일, 시간
  •          Restart Time : 아파치서버가 재동작한 년, 월, 일, 요일, 시간
  •          Parent Server Generation : 서버 부하방지을 위한 아파치서버 생성갯수 총서버 개수중 요구에 응하고 있는 서버의 개수와 놀고 있는 서버의 개수 Scoreboard Key 에 대한 정보  
  •          "-" : 응답을 하기 위해 대기중임을 나타냄.
  •          "S" : 시작되고 있음을 나타냄.
  •          "R" : 응답을 위해 요구사항을 해석하고 있음.
  •          "L" : 요구에 대한 응답을 하고 있음.
  •          "K" : 계속연결중임.
  •          "D" : DNS서버에 요구도메인 검색중임.
  •          PID key : 프로세스정보를 보여준다.

 

또한 유닉스의 쉘에서도 간단히 아파치웹서버에서 제공되는 쉘스크립트로 모니터링을 할 수가 있다.

쉘프롬프트상에서 다음과 같은 명령을 이용하면 된다.

 

    #./apachectl fullstatus

Posted by tornado
|

자주쓰는 아파치 설정사항 정리

 

브라우징 제거

아파치의 디폴트세팅은 브라우징이 enable되어 있다.
브라우징이란 웹브라우저에서 URL입력시 index.html과 같은 정확한 파일명을
생략하고 디렉토리만 적었을 경우, 디렉토리내 파일목록이 출력되는 현상을 말한다.
http.conf의 디렉토리 디렉티브내 다음줄 추가

Options -Indexes


아파치 인증창 사용

http.conf에서 인증을 걸 디렉토리 디렉티브내 다음줄 추가

    AllowOverride AuthConfig

해당 디렉토리에 다음과 같이 .htaccess파일(텍스트파일) 생성
[root@ns mrtg]# cat .htaccess
AuthName "MRTG를 위한 인증"
AuthType Basic
AuthUserFile /webhosting/mrtg/.auth
require valid-user

AuthName: 인증창 타이틀
AuthType: 인증형태
AuthUserFile: 인증자들의 리스트를 가진 파일(htpasswd명령어로 생성)

-c(create)는 처음 파일을 생성할때 필요하다.
[root@ns mrtg]# htpasswd -c .auth kang
New password:
Re-type new password:
Adding password for user kang
[root@ns mrtg]# ls -l .auth
-rw-r--r--    1 root     root           19 May  3 16:54 .auth


외부 IP접근제어

http.conf의 디렉토리 디렉티브내 다음줄 추가

        AllowOverride AuthConfig
    Order Allow,Deny
    Deny from 211.43.134.128/24 xxx.xxx.xxx.xxx/24
    Allow from all
    
Deny from 에 접근차단할 ip대를 입력.
슬래쉬(/)뒤의 숫자들은 net mask지정(생략하면 single ip에 대한 차단)


위의 내용을 종합한 예는 다음과 같다.    


    Options -Indexes FollowSymLinks MultiViews

    AllowOverride AuthConfig

    Order allow,deny
    Allow from all
    Deny from 211.43.134.128/24 xxx.xxx.xxx.xxx/24




가상호스트/Redirect

아래의 예는 dbakorea.pe.kr로 오면, www.dbakorea.pe.kr로 redirect시킨다.
본인은 아파치말고, packet filtering으로 처리하려했으나 실력부족과 게으름으로 인해
그만두었다.

    ServerName          dbakorea.pe.kr
    Redirect    /       http://www.dbakorea.pe.kr


가상호스트의 전형적인예

    ServerAdmin         kang@dbakorea.pe.kr
    DocumentRoot        /webhosting/dbakorea-mobile
    ServerName          mobile.dbakorea.pe.kr
    ErrorLog            /usr/local/apache/logs/mobile.dbakorea.pe.kr-error_log
    CustomLog           /usr/local/apache/logs/mobile.dbakorea.pe.kr-access_log common
    ScriptAlias /cgi-bin/ /webhosting/dbakorea-mobile/cgi-bin/
        DirectoryIndex      login.html


아파치 정보출력제어
80포트로 telnet후 get / http/1.0하면 나오는 정보제어

ServerTokens Prod[uctOnly]
: Apache 만 보여줌
ServerTokens Min[imal]
: Apache 버젼만 보여줌
ServerTokens OS
: 아파치 버젼과 운영체제를 보여줌
ServerTokens Full (또는 지시하지 않았을때)
: 모두 보여줌


Offline Browser서비스 거부(출처: http://www.apache.kr.net)
WebZip만 테스트해봤지만 %{User-agent} 라는 변수에 'MSIE 6.0b'와 같이 찍힌다.
한마디로 안된다. 다른 용도로 사용될 지 몰라도,..


    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    Deny from env=go_out


#CustomLog /usr/local/apache/logs/access_log common
#CustomLog /usr/local/apache/logs/referer_log referer
#CustomLog /usr/local/apache/logs/agent_log agent
CustomLog /usr/local/apache/logs/access_log combined


    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "RealPlayer 4\.0" force-response-1.0
    BrowserMatch "Java/1\.0" force-response-1.0
    BrowserMatch "JDK/1\.0" force-response-1.0
    BrowserMatch "WebZIP" go_out
    BrowserMatch "Teleport" go_out
    BrowserMatch "GetRight" go_out
    BrowserMatch "WebCopier" go_out



     ServerAdmin         kang@dbakorea.pe.kr
     DocumentRoot        /webhosting/dbakorea
     ServerName          www.dbakorea.pe.kr
     ServerAlias        dbakorea.pe.kr
     ErrorLog            /usr/local/apache/logs/www.dbakorea.pe.kr-error_log
     CustomLog           /usr/local/apache/logs/www.dbakorea.pe.kr-access_log combined



아파치 로그 rotate
디폴트로 아파치로그는 wtmp, lastlog등과 같이 일정 시간, 크기..등등에 따라 로그의 순환이 이루어지지 않는다.
logrotate로 3개의 로그를 1달단위로 순환하려면 /etc/logrotate.conf파일의 마지막에 다음과 같이 추가한다.

# system-specific logs may be configured here
/usr/local/apache/log/www.dbakorea.pe.kr-access_log {
        monthly
        rotate 2
}


바이러스등에 대한 아파치로그 제거

# CodeRed Worm등의 로그제거
SetEnvIf Request_URI default\.ida CodeRed
SetEnvIf Referer \.ida CodeRed
SetEnvIf Request_URI cmd\.exe CodeRed
SetEnvIf Referer cmd\.exe CodeRed
SetEnvIf Request_URI root\.exe CodeRed
SetEnvIf Referer root\.exe CodeRed


     ServerAdmin         kang@dbakorea.pe.kr
     DocumentRoot        /webhosting/dbakorea
     ServerName          www.dbakorea.pe.kr
     ServerAlias        dbakorea.pe.kr
     ErrorLog            /usr/local/apache/logs/www.dbakorea.pe.kr-error_log
     CustomLog           /usr/local/apache/logs/www.dbakorea.pe.kr-access_log combined env=!CodeRed



설치된 모듈 확인
[root@ns /root]# httpd -l
Compiled-in modules:
  http_core.c
  mod_env.c
  mod_log_config.c
  mod_mime.c
  mod_negotiation.c
  mod_status.c
  mod_include.c
  mod_autoindex.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_so.c
  mod_setenvif.c
  mod_php4.c
suexec: disabled; invalid wrapper /usr/local/apache/bin/suexec

설정파일 확인(Virtual Host Only)
[root@ns /root]# httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
                       default server dbakorea.pe.kr (/usr/local/apache/conf/httpd.conf:989)
                       port 80 namevhost dbakorea.pe.kr (/usr/local/apache/conf/httpd.conf:989)
                       port 80 namevhost htdig.dbakorea.pe.kr (/usr/local/apache/conf/httpd.conf:1010)
                       port 80 namevhost kang.mine.nu (/usr/local/apache/conf/httpd.conf:1025)
[root@ns /root]#


컴파일 설정보기
[root@ns /root]# httpd -V
Server version: Apache/1.3.26 (Unix)
Server built:   Sep 17 2002 00:36:53
Server's Module Magic Number: 19990320:13
Server compiled with....
-D HAVE_MMAP
-D HAVE_SHMGET
-D USE_SHMGET_SCOREBOARD
-D USE_MMAP_FILES
-D HAVE_FCNTL_SERIALIZED_ACCEPT
-D HAVE_SYSVSEM_SERIALIZED_ACCEPT
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D HTTPD_ROOT="/usr/local/apache"
-D SUEXEC_BIN="/usr/local/apache/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/httpd.scoreboard"
-D DEFAULT_LOCKFILE="logs/httpd.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
-D ACCESS_CONFIG_FILE="conf/access.conf"
-D RESOURCE_CONFIG_FILE="conf/srm.conf"
[root@ns /root]#


SSI를 사용
CGI와 거의 비슷하게 세팅한다.
아파치(Apache)의 설정파일은 이젠 httpd.conf하나로 통일되었으므로 이 파일에 모든 설정을 한다.

AddType text/html .shtml
AddHandler server-parsed .shtml

위의 2개를 꼭 있어야 한다. 그리고 CGI와 마찬가지로 ssi가 실행될 디렉토리에 Includes옵션을 설정한다.
아래의 예는 /www/htdocs/count라는 티렉토리에 CGI, SSI가 실행될 수 있게 한다.

# 내가 추가(Options에 ExecCGE는 CGI를 사용하기위해, Includes는 SSI를 사용하기 위해)

Options ExecCGI Includes
AllowOverride None



This article comes from dbakorea.pe.kr (Leave this line as is)
Posted by tornado
|

 

find /dev -type f

 


일케 쳐서......



/dev/MAKEDEV

 


이거 이외에 다른것들이 나오면...  해킹당한게다 ㅡㅡ;




Posted by tornado
|
첫줄에서 =G 하면 들여쓰기 됨 ..

'OS > LINUX' 카테고리의 다른 글

[펌] 자주쓰는 아파치 설정사항  (0) 2005.05.31
[리눅스] 해킹당했는지??  (0) 2005.05.18
[펌] 파일 옮기기  (0) 2005.05.16
[펌] tripwire설치 및 운영가이드  (0) 2005.05.11
[phpschool 펌] mod_rewrite 추가 설치...  (0) 2005.05.03
Posted by tornado
|

[펌] 파일 옮기기

OS/LINUX 2005. 5. 16. 12:09
백업을 한다거나 다른 파티션으로 퍼미션,소유자등의 정보를 유지한채 그대로 옮겨야할때
과거에는 tar로 묶은다음 mv로 옮길 파티션으로 이동하고 다시 tar로 푸는 작업을 했었다.

( cd /usr/src && tar cf - . ) | ( cd /mnt && tar xpf - )

이방법은 일반적인 방법이기는 하나 묶고 푸는 시간때문에 시간이 오래걸린다.
더 빠른 방법을 소개한다.

find /source -xdev | cpio -pvmd /destination

find로 /source에 있는 모든파일을 찾아서 사용자정보를 유지한채 /destination으로 옮긴다.
Posted by tornado
|