[개발서버] rsyncd 설정

ITWeb/서버관리 2011. 9. 7. 14:48

[기본설명]

rsyncd.conf 를 설정한 서버가 source 가 되며 client 에서는 read 만 가능 하도록 설정 하여 사용을 한다.

 

sudo vi /etc/xinetd.d/rsync

service rsync
{
        disable = no
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}

disable = yes 를 disable = no 로 변경

 

service xinetd restart

 

sudo vi /etc/rsyncd.conf

[temp]
path=/home/계정/temp
hosts allow=192.254.0.0/16
uid = nobody
gid = nobody
use chroot = yes
max connections = 4

192.254.0.0 ~ 192.254.255.255 까지 접속 가능 하며

/home/계정/temp 아래 파일을 읽어 갈수 있다.

 

[source]

- hostname : src1

 

[client]

- command : rsync -avz --progress  src1::temp/temp.log .

- src1 서버에 temp.log 파일을 가져와라. src1::temp 는 client 에서 알 필요가 없다.

:

[Mail] MTA, MUA, MDA, MRA....

ITWeb/서버관리 2011. 9. 7. 14:46

인터넷 메일 시스템은 상당히 복잡해 보이지만 여러 요소로 이루어진 하나의 시스템으로 보통 다음과 같은 요소로 구성 되어 있습니다.

 

MTA (Mail Transfer Agent)
인터넷 상에 있는 어떤 컴퓨터로부터 다른 컴퓨터로 전자 메일을 전송하는 서버 프로그램

 

MUA (Mail User Agent)
사용자가 전자 메일을 송수신할 때 사용하는 클라이언트 프로그램

 

MDA (Mail Delivery Agent)
MTA가 수신한 메시지를 사용자의 우편함에 쓰기 위한 프로그램

 

MRA (Mail Retrieval Agent)
리모트 서버에 있는 우편함으로부터 사용자의 MUA로 메시지를 가져오는 프로그램

 

일반적인 메일의 전달 과정은 다음과 같습니다.
전자 메일은 사용자가 MUA를 이용하여 MTA로 보냅니다. 이 송신 MTA는 메시지가 목적지에 도착할 때까지 메시지를 하나 혹은 그 이상의 MTA로 전송하게 됩니다. 목적지 MTA(수신 MTA)에 도달된 메시지는 사용자 정보에 따라서 MDA로 전송 되어 지며, MDA는 메시지를 수신자의 우편함에 쓰게 됩니다. 수신자는 메시지를 읽기 위해서 자신의 메일 서버에 직접 접근하거나 MUA를 사용하여 자신의 메일 서버의 우편함으로부터 메시지를 로컬로 가져옵니다. 이 때 MUA가 메시지를 분류하거나 정렬하기도 합니다. 수신자가 로컬이 아닌 리모트 메일 서버로부터 메일을 읽어 올 때 MRA를 사용합니다.

MUA로부터 MTA까지는 SMTP(Simple Mail Transfer Protocol)을 사용하여 메시지를 보내며, MTA와 MTA 사이에도 SMTP가 사용됩니다. MUA는 MRA를 통하여 POP(Post Office Protocol)나 IMAP (Internet Message Access Protocol)을 주로 사용하여 메일 서버로부터 로컬로 메시지를 읽어 옵니다.

:

apache ab 사용방법.

ITWeb/서버관리 2011. 9. 7. 14:46

refs. http://nickdenardis.com/2007/06/27/stress_testing_a_site_with/

Stress testing a site with Apache’s ab tool, part 1

Apache’s AB tool is a great way to really put stress on a server. I have compiled a list of the parameters I use to test my sites and applications.

First we have to make sure AB can hit the desired page and get the desired results. The most basic page is the homepage of a site, use the command below to send as many single requests as it can in 1 second

ab http://example.com/

But that is great and dandy but what happens if we want to try to stress a page that hits the database and has to do some actual dynamic work

ab http://example.com/search.php?q=Trees

Last but not least what if the site is behind a login that is an http form and not an htaccess form? That is where POST variables come into play, it is a little trickier but doable. Here is the command I use to hit a page behind a login.

ab -p ~/Documents/post.txt -T application/x-www-form-urlencoded -e http://example.com/manager/

Here is what my post.txt file contains:

email=test@domain.com&password=testing&submit=Login

Next we need to get these results to a file so we can work with them and have a record of progress as we tweak our site. It can be done with the “-e” parameter. An example is below:

ab http://example.com/search.php?q=Trees -e ~/Documents/results1.csv

What that does is hits the search page and puts the results in the results1.csv file. It is useful to put the file at the end of the command since you will want to change the filename on each run to keep a history of your results.

The csv file is separated into two columns. The first is the percentage complete and the second is the time in ms that it took to get to that percentage.

The first thing you want to look at is the zero percent. This is your latency, it is the amount of time it takes to fulfill the first request. You want this number to be as low as possible. I am running my site on a development server on my local network so the times will be lower but at the end I will show the results from the testing server.

ab -p ~/Documents/aci_post.txt -T application/x-www-form-urlencoded -e ~/Documents/aci_output.csv -kc 10 -t 10 http://aci/manager/makes.php
:

ssh no passphrase 생성.

ITWeb/서버관리 2011. 9. 7. 14:19

1. 관문이 되는 gateway 서버에서 key 생성

ssh-keygen -t rsa

암호 입력 없이 엔터 세번

 

Generating public/private rsa key pair.
Enter file in which to save the key (/home/계정명/.ssh/id_rsa):
Created directory '/home/계정명/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/계정명/.ssh/id_rsa.
Your public key has been saved in /home/계정명/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4

 

cat id_ras.pub

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvtSlFMETwPauw5qHjyC4FD9J0AoeHSc9waZGMr70OSJruOXC5rxqfgvj0Ux1J+1ZQADgXz5wvP8Z9UL4hoa0Mq+eTVxOdC40AV3YtiXZA+7y/SQKy5EHdRsFTU+7QQVYm5S/nPnV0QU+g8WzCegZB5hwrQCFE7PzDGYeRPS0lK6fuYo74Q5U9n+AjPloaK7qgnKkEuShr1yIxvdfQkemrGSgmC1z7pYrNHjbpCYRngxnS60iNkRmicDJb5XmgTTNfClOuwaf2xyQYbh5+Qo1PLo9eQ/xDtKoxij4p0Mp1yCU/wYWP+HRwbKyvjaWjS3fN/dSRodNRbDQu+ZnNfl4nQ== j계정명@HOSTNAME

 

2. gateway 서버에서 접속하고자 하는 서버들에 authorized_keys 생성

mkdir .ssh

cd .ssh

vi authorized_keys

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvtSlFMETwPauw5qHjyC4FD9J0AoeHSc9waZGMr70OSJruOXC5rxqfgvj0Ux1J+1ZQADgXz5wvP8Z9UL4hoa0Mq+eTVxOdC40AV3YtiXZA+7y/SQKy5EHdRsFTU+7QQVYm5S/nPnV0QU+g8WzCegZB5hwrQCFE7PzDGYeRPS0lK6fuYo74Q5U9n+AjPloaK7qgnKkEuShr1yIxvdfQkemrGSgmC1z7pYrNHjbpCYRngxnS60iNkRmicDJb5XmgTTNfClOuwaf2xyQYbh5+Qo1PLo9eQ/xDtKoxij4p0Mp1yCU/wYWP+HRwbKyvjaWjS3fN/dSRodNRbDQu+ZnNfl4nQ== j계정명@HOSTNAME

 

chmod 600 authorized_keys

※ chmod 600 을 안하면 암호를 물어 보기 때문에 permission 에 주의 할것!!

 

3. gateway 서버에서 원격서버로 접속 테스트 되면 끝.

 

public key 가 원격지 서버에 authorized_keys 로 복사 되어 있으면 됨.

 

※ 쌍방향으로 로그인이 되게 하려면 private key 도 함께 복사해 놓으면 끝.

 

cat authorized_keys | ssh HOSTNAME 'cat >> .ssh/authorized_keys; cd /home/계정/.ssh; chmod 600 authorized_keys'

:

perl passwd 자동 입력

ITWeb/개발일반 2011. 9. 7. 14:16
  1. print "Enter Your Password: "; $oldpass = ;
  2. print "Enter Your New Password: "; $newpass = ;
  3.  
  4. open (PASSWD, "| passwd --stdin");
  5. print PASSWD "$oldpass";
  6. print PASSWD "$newpass";
  7. print PASSWD "$newpass";
  8. close(PASSWD);
: