티스토리 툴바

달력

052012  이전 다음

  •  
  •  
  • 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
  •  
  •  

서버가 부하가 가중되면 가장 먼저 알아내야 하는것이 원인을 파악하는 것일 겁니다. 하지만 그러기 어려운 상황이라면 가장 먼저 파악해야 하는것이 CPU에서 오는 부하인지 I/O에서 오는 부하인지를 알아내야 할 것입니다.
우선 기본적으로 부하상태(Load Average)를 알아내기 위해 top, w, uptime의 명령어를 활용할 수 있습니다.
top

top - 11:46:06 up 77 days,  1:16,  1 user,  load average: 0.06, 0.15, 0.11
Tasks: 87 total, 1 running, 86 sleeping, 0 stopped, 0 zombie
Cpu(s): 6.5%us, 0.5%sy, 0.0%ni, 92.7%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 4033528k total, 1571260k used, 2462268k free, 26472k buffers
Swap: 3911816k total, 128k used, 3911688k free, 627956k cached

w
 11:47:39 up 77 days,  1:17,  1 user,  load average: 0.08, 0.14, 0.11
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 121.133.79.177 11:13 0.00s 0.01s 0.00s w

uptime
 11:47:56 up 77 days,  1:18,  1 user,  load average: 0.06, 0.13, 0.10

top > w > uptime 순으로 보여지는 정보의 양이 적어지는군요. top의 경우에는 실행중인 프로세스의 목록도 표시됩니다. 오늘 언급하려는것은 sar(System Activity Reporter)입니다. 매우 간단하게 부하를 분류하여 보여줍니다.
[root@Theeye /]# sar
Linux 2.6.18-238.19.1.el5 (Theeye) 09/29/11

16:20:10 CPU %user %nice %system %iowait %steal %idle
16:30:10 all 17.81 0.84 2.75 68.50 0.00 10.10
16:40:23 all 16.75 0.00 3.26 69.68 0.00 10.30
Average: all 17.28 0.41 3.01 69.10 0.00 10.20

위 의 시스템은 IO대기가 차지하는 비율이 70%에 육박하는 상태입니다. IO문제가 분명하군요. 보통 DB 서버들이 부하가 걸릴때 위와 같은 모습을 보입니다. 이 경우 메모리를 증설하면 디스크에 읽고 써야 하는 데이터를 그만큼 메모리에 올릴 수 있어 디스크의 IO를 현저히 줄일 수 있습니다.
[root@Theeye /]# sar
Linux 2.6.18-238.19.1.el5 (Theeye) 09/29/11

14:30:01 CPU %user %nice %system %iowait %steal %idle
15:50:01 all 14.67 0.10 4.51 1.63 0.00 79.08
16:00:01 all 17.06 4.91 4.96 1.53 0.00 71.53
16:10:01 all 14.63 0.00 4.74 1.21 0.00 79.41
Average: all 13.04 2.18 3.98 8.36 0.00 72.45

메모리를 8G에서 16G로 증설한 후의 모습입니다. 정말 신기할 정도로 IO가 줄었네요. sar에서 자주 쓰이는 옵션으로는 다음과 같은 것이 있지 않을까 생각합니다.
-u : CPU 사용율 확인
-P : 특정 CPU의 사용율 확인 (sar -P 0)

 

 

 

 

발췌

http://theeye.pe.kr/509

'테크노오로지' 카테고리의 다른 글

[Linux] 서버의 부하조사  (0) 2011/10/12
[Linux] find  (1) 2011/09/14
구글코드에 google chart  (0) 2011/07/29
[Linex]Hinemos Part3  (0) 2011/04/15
[Linux]Hinemos Part2  (0) 2011/04/15
[Linux]Hinemos Part1  (0) 2011/04/15
Posted by 동경불나방

[Linux] find

테크노오로지 2011/09/14 14:12

[主なオプション]
-name ファイル名及びディレクトリ名にマッチするものを表示
-iname -nameと同じだが、大文字小文字を区別しない
-regex ファイル名が正規表現にマッチするものを表示
-iregex regexと同じだが、大文字小文字を区別しない
-type ファイルタイプを指定。タイプにはd(ディレクトリ)、f(ファイル)、l(シンボリックリンク)を指定
-emtpy ファイルが0byteもしくは中身のないディレクトリを表示
-size ファイルのサイズで検索。通常kオプションをつけてキロバイトにて指定

[使用例]

#空のファイルを削除
find . -empty -exec rm {}\; #ユーザ確認を求めない
find . -empty -ok rm {}\; #ユーザ確認を求める

※{}にはfindで引っかかったファイル名が引数として渡ります

#ファイルの数を調べる
find . -type f |wc -l

#findで見つかったファイルの中身をgrepする
find ./ -type f -exec grep https://www.ksknet.net {} \;

#ディレクトリ以下を再帰的に置換
sudo find . -type f -exec sed -i 's/置換前/置換後/g' {} \;

#1000kを越えるファイルを検索
find ./ -size +1000k

#ファイル所有者がtomのユーザを検索
find ./ -user tom

#ファイル名がhtmlもしくはcgiで終わるファイルを表示
find ./ -type f -iregex ".*\.html$" -or -iregex ".*\.cgi$"

#ファイル属性による検索(アクセス権限による検索)
find ./ -perm 755

#日付による検索
find ./ -daystart -ctime +2

補足 +2 と -2 では動作が異なります。+2では2日前より古いファイル、-2では2日前より新しいファイルを返します。
-ctime の他に -mtime -atime などがあります。

#日付による検索その2 (30日前より以前に作成されたファイルを削除)
find ./ -ctime +30 -type f -exec rm -f {} \;

[補足]
findは基本的にand検索をします。OR検索の場合は-oオプションを使用すること。

'테크노오로지' 카테고리의 다른 글

[Linux] 서버의 부하조사  (0) 2011/10/12
[Linux] find  (1) 2011/09/14
구글코드에 google chart  (0) 2011/07/29
[Linex]Hinemos Part3  (0) 2011/04/15
[Linux]Hinemos Part2  (0) 2011/04/15
[Linux]Hinemos Part1  (0) 2011/04/15
Posted by 동경불나방

구글은 참으로 여러 서비스를 해준다.

구글코드에 있는 구글차트라는 서비스는 참으로 편리하다.

 

값만 전해주면 차트를 만들어서 준다.

헐...

image

 

위의 폼을 송신하면

image

오우..

바로 차트변환이 된다.

 

자세한 내용은 http://code.google.com/intl/ko-KR/apis/chart/index.html 참조해라

 

참고할만한 블로그 http://blog.naver.com/notinoti?Redirect=Log&logNo=80113616014

'테크노오로지' 카테고리의 다른 글

[Linux] 서버의 부하조사  (0) 2011/10/12
[Linux] find  (1) 2011/09/14
구글코드에 google chart  (0) 2011/07/29
[Linex]Hinemos Part3  (0) 2011/04/15
[Linux]Hinemos Part2  (0) 2011/04/15
[Linux]Hinemos Part1  (0) 2011/04/15
Posted by 동경불나방

카렌다를 설정해 보자

배치화일들은 동작에 일정 규칙을 가지고 있으므로 광범위하게 쓰이는 카렌다는 미리 만들어 놓는것도 괞찮을것 같다

예를 들면 평일 오후2시에서 4시사이라든가, 토요일 오전 8시10분에서 8시20까지라든가.

다만 요일설정일 경우 축일이 문제가 된다.

월요일 부터 금요일까지 모두 영업일은 아니기 때문이다.

 

5월5일은 어린이날이므로 놀아야한다.(평일일경우)

이런부분도 제어를 해주어야 한다.

 

조작 – 공통 – 카렌다 – 카렌다일람을 클릭하면 다음과 같은 화면을 볼수 있다

image

 

작성버튼을 누르면

image

 

카렌다가 작성된다.

여기에 두가지를 설정해 주어야 한다. 실행해야하는 일과 예외일이다.

위의 카렌다를 만들었다면 일람에서 선택한 상태에서 조작 – 공통 – 카렌다 – 실행규칙을 선택한다.

image

요일별로 작성해 보았다 월요일 부터 금요일까지 하루종일이다.

실행유저는 hinemos유저이다

위의 예제라면 토요일과 일요일은 실행이 되지 않는다.

그러면 예외를 넣어보자

축일설정을 넣으면 된다.

조작 – 공통 – 카렌다 – 실행예외를 선택

image

 

축일이 설정되었다.

년단위이므로 귀찮지만 어느정도의 미래까지 기입을 해야한다. 잊어먹으면 축일임에도 실행이 되어버리니까

양력이라면 매년 같을텐데.. 년마다 등록을 해줘야하는점은 무척 귀찮은 일이 아닐수 없지만…

어쩔수 없다. 한개 한개 설정을 해보다. 축일 몇일 있지도 않은데 뭐….

 

참고로 배치중에 영업일 실행후 익일 새벽시간에 실행되는 배치라면 다음과 같은 지정으로 커버가 가능하다.

예를 들어 2010년 11월3일이 문화의 날로 축일이다.

새벽배치는 새벽이 실행되나 일반 실행예외라면 11월4일은 축일이 아니므로 실행을 하게된다.

그럼 어떻게 해야할까

의뢰로 간단하다. +1 하면 되지 않는가

아래와 같이 11월3일에 1일더한값을 넣으면 된다. 설명란에 이부분을 기입하면 다른이들도 이해하기

쉬울것이다.

image

'테크노오로지' 카테고리의 다른 글

[Linux] find  (1) 2011/09/14
구글코드에 google chart  (0) 2011/07/29
[Linex]Hinemos Part3  (0) 2011/04/15
[Linux]Hinemos Part2  (0) 2011/04/15
[Linux]Hinemos Part1  (0) 2011/04/15
[Linux]ipcs,pstreeについて  (0) 2010/09/02
Posted by 동경불나방

서버의 도입이 끝났으니 클라이언트인스톨후 각종 설정을 해보겠다.

 

 

도입이 끝난후의 화면(윈도우XP)

image

 

 

조작 – 공통 – 리포지토리 에서 신규리포지토리 등록(노드)

image

 

 

 

히네모스 관리서버 아이피 등록

 

 

 

 

리포지토리 아이디와 이름을 등록

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

조작 – 공통 통지일람확인  신규통지 설정

image 추가버튼을 누르고 이벤트통지를 클릭

image

'테크노오로지' 카테고리의 다른 글

구글코드에 google chart  (0) 2011/07/29
[Linex]Hinemos Part3  (0) 2011/04/15
[Linux]Hinemos Part2  (0) 2011/04/15
[Linux]Hinemos Part1  (0) 2011/04/15
[Linux]ipcs,pstreeについて  (0) 2010/09/02
CentOS 또는 RHEL에서 CA 인증서와 Server/Client용 인증서 생성하기  (0) 2010/08/25
Posted by 동경불나방

미들웨어로 오픈소스 프로젝트인 히네모스는 시스템전반의 강력한 관리능력을 가지고 있다.

이를 활용해 보고자 나의 장난감?머신에 도입해 보았다.

 

システムにセットアップ

 

1.パッケージダウンロード

sorceforge.jp から Hinemosのパッケージを入手する。
http://sourceforge.jp/projects/hinemos/)

2010.1.20時点で最新版は 3.2.1(2011.4.15リリース)

クライアント(Windows):HinemosClientInstaller-3.2.1.msi
エージェント(RHEL5) :hinemos_agent-3.2.1_rhel5_32.tar.gz
マネージャ(RHEL5) :hinemos_manager-3.2.1_rhel5_32.tar.gz

2.マネージャノードセットアップ

・セットアップはrootユーザで行う
・マネージャノードにはhinemosマネージャとhinemosエージェントをセットアップする。
hinemosマネージャを先にセットアップする必要がある。

2.1 マネージャ

(1) マネージャパッケージを任意のディレクトリで展開(/tmp/hinemos下に展開した場合)
# cd /tmp/hinemos
# tar -zxvf hinemos_manager-3.2.1_rhel5_32.tar.gz

(2) インストーラの実行
# cd /tmp/hinemos/Hinemos_Manager-3.2.1_rhel5_32
# ./manager_installer_JP.sh

【対話型インストーラの入力項目】
・ユーザhinemosのパスワード > 任意
・マネージャのIPアドレス > 自ノードのIPアドレス
・JBossの起動ユーザ > hinemos
(snmpトラップを使用する場合はrootとする必要あるが今回使用しない)

(3) マネージャの起動・停止
マネージャの起動・停止はhinemosユーザで行う
# su - hinemos
~起動~
$ /opt/hinemos/bin/hinemos_start.sh
~停止~
$ /opt/hinemos/bin/hinemos_stop.sh

(4) .pgpassファイルの作成
PostgreSQLのメンテナンスバッチのためにパスワードファイルを作成する。

$ vi /opt/hinemos/.pgpass
localhost:24001:hinemos:hinemos:hinemos

$ chmod 600 /opt/hinemos/.pgpass

2.2 エージェント

(1) エージェントパッケージを任意のディレクトリで展開(/tmp/hinemos下に展開した場合)
# cd /tmp/hinemos
# tar -zxvf hinemos_agent-3.1.4_rhel5_32.tar.gz

(2) インストーラの実行
# cd /tmp/hinemos/Hinemos_Agent-3.1.4_rhel5_32
# ./agent_installer_JP.sh

【対話型インストーラの入力項目】
・マネージャのIPアドレス > マネージャノードのIPアドレス

(3) エージェントの起動・停止
エージェントの起動・停止はrootユーザで行う
~起動~
# /opt/hinemos_agent/bin/agent_start.sh
~停止~
# /opt/hinemos_agent/bin/agent_stop.sh

(4) syslog-ngの停止☆ Hinemosはsyslog-ngなしで問題ないか?
ログ監視機能を使用しないため、syslogに戻す
# service syslog-ng stop
# service syslog start

rcの設定戻し
# chkconfig --list | grep syslog
syslog          0:off   1:off   2:off   3:off   4:off   5:off   6:off
syslog-ng       0:off   1:off   2:on    3:on    4:on    5:on    6:off
# chkconfig --level 2345 syslog on
# chkconfig --level 2345 syslog-ng off
# chkconfig --list | grep syslog
syslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off
syslog-ng       0:off   1:off   2:off   3:off   4:off   5:off   6:off

3.エージェントノードセットアップ

マネージャノードセットアップの "2.2 エージェント" を実行

4.クライアント

インストーラに従いインストール

5.Snmpdのログ抑止

snmpdがsyslogdに対して大量のメッセージを出力するため、ログレベルを調整する。
/etc/sysconfig/snmpd.optionsを編集する。
OPTIONS="-LS 4 d -p /var/run/snmpd.pid -a"
snmpdを再起動
# service snmpd restart

Posted by 동경불나방
 
まあ、つかえるでしょう。。
 
IPCリソース機能についての情報を表示するコマンドです。共有メモリなどのチェックに利用します。普段,共有メモリを使わない場合は,
あまり使用しません。
 
Linux> ipcs -m
------ Shared Memory Segments --------
key        shmid     owner     perms     bytes     nattch    status
0x00000000 0         wmaster   600       52228     8         dest

------ Semaphore Arrays --------
key       semid     owner     perms     nsems     status

------ Message Queues --------
key       msqid     owner     perms     used-bytes  messages
0x00000000 0         root      700       0           0

 

pstree は実行中のプロセスをツリー形式で表示する。

同じ内容の分岐があると、 pstree はそれらを [] で括り、繰り返し数を前に付けてまとめる。例えば

init-+-getty
     |-getty
     |-getty
     ‘-getty

はinit---4*[getty]

となる。

Posted by 동경불나방

출처:훅크선장의 전함 원본

 

이틀간 많은 문서를 뒤졌지만, 도저히 쉽게 설명한 문서가 없어서 애를 먹었습니다.

다행히 삽질을 통해서, 성공하였습니다. 

가장 많이 참고한 문서는

http://yyman.tistory.com/entry/1-OpenSSL-개념-소개-및-인증서-생성-및-루트-기관-생성과정-강좌  입니다.

디렉토리 위치 설명이 잘 안되어 있었습니다.

CentOS 에서는 시작 위치가 /usr/share/ssl/  입니다. 이곳에 openssl.cnf 가 존재합니다.

RHEL 에서는 시작 위치가 /etc/pki/tls/ 입니다. 이곳에 openssl.cnf가 존재합니다.

모든 인증서 작업은 이 디렉토리에서 이루어져야만 합니다.


CentOS에서는 openssl.cnf를 수정할 필요가 없지만, RHEL은 약간 수정이 필요합니다.

기존 파일을 백업하고, 다음과 같이 수정하면 됩니다. (꼭 디렉토리 명을 demoCA로 할 필요는 없습니다. openssl.cnf를 잘 이해한다면, 디렉토리 위치나 디렉토리명은 알아서 설정하면 됩니다.)

[root@localhost tls]# cp openssl.cnf openssl.cnf.org

[root@localhost tls]# vi openssl.cnf

modify :

dir             = ../../CA              # Where everything is kept

->

dir             = ./demoCA

[root@localhost tls]# sync

[root@localhost tls]# ls

cert.pem  certs  misc  openssl.cnf  openssl.cnf.org  private

이제부터 필요한 디렉토리와 파일들을 생성합니다. CA로써 가져야되는 디렉토리와 파일들입니다.

디렉토리들과 파일들은 demoCA라는 디렉토리 밑에 생성되어야 합니다.

[root@localhost tls]# mkdir demoCA

[root@localhost tls]# cd demoCA

[root@localhost demoCA]# mkdir certs

[root@localhost demoCA]# mkdir crl

[root@localhost demoCA]# mkdir newcerts

[root@localhost demoCA]# mkdir private

[root@localhost demoCA]# touch index.txt

[root@localhost demoCA]# echo "0001" > serial

[root@localhost demoCA]# echo "0001" > crlnumber

[root@localhost demoCA]# ls

certs  crl  crlnumber  index.txt  newcerts  private  serial

환경이 완료되었으면, 원래 작업 디렉토리로 돌아옵니다.

그리고, CA용 비밀키와 인증서를 생성합니다.

[root@localhost demoCA]# cd ..

[root@localhost tls]# ls

cert.pem  certs  demoCA  misc  openssl.cnf  openssl.cnf.org  private

비밀키를 생성할 때는 반드시 패스워드가 필요합니다.(확인을 위해서, 두 번 넣습니다.)

[root@localhost tls]# openssl genrsa -des3 -out ca.key 1024

Generating RSA private key, 1024 bit long modulus

.............++++++

...++++++

e is 65537 (0x10001)

Enter pass phrase for ca.key:

Verifying - Enter pass phrase for ca.key:

비밀키를 기반으로 인증서를 만듭니다. 앞에서 넣었던 비밀키 패스워드를 입력해야 합니다.

인증서에는 국가, 지역, 도시, 기관, 부서, 시스템 명과 이메일 주소를 넣어줘야 합니다.

어떤 값을 넣어줘도 상관은 없습니다만,  국가, 지역, 도시, 기관명은 반드시 CA가 인증해주는 다른 인증서를 만들 때도 동일하게 하여야합니다. 잘 기억해야 됩니다. 밑에 보이는 것을 참고해서 넣으면 됩니다.

[root@localhost tls]# openssl req -new -x509 -days 365 -key ca.key -out ca.crt

Enter pass phrase for ca.key:

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [GB]:KR

State or Province Name (full name) [Berkshire]:Daejeon

Locality Name (eg, city) [Newbury]:Daejeon

Organization Name (eg, company) [My Company Ltd]:ETRI

Organizational Unit Name (eg, section) []:Research

Common Name (eg, your name or your server's hostname) []:RHEL

Email Address []:hook@ensec.re.kr

이것으로 CA용 비밀키와 인증서가 생성되었습니다.

[root@localhost tls]# ls

ca.crt  ca.key  cert.pem  certs  demoCA  misc  openssl.cnf  openssl.cnf.org  private

이제 서버용으로 사용할 비밀키와 인증서를 만듭니다.

비밀키는 패스워드를 꼭 두 번 넣습니다.

[root@localhost tls]# openssl genrsa -des3 -out server.key 1024

Generating RSA private key, 1024 bit long modulus

.........++++++

........++++++

e is 65537 (0x10001)

Enter pass phrase for server.key:

Verifying - Enter pass phrase for server.key:

서버용 인증서 요청파일을 만듭니다. 바로 인증서가 만들어지지 않는 것은 CA의 서명을 받아야 하기 때문입니다.

먼저 비밀키의 패스워드를 입력합니다.

CA 인증서를 만들 때와 비슷하게, 국가, 지역, 도시, 기관, 부서, 시스템 명과 이메일 주소를 넣어야 합니다.

국가, 지역, 도시, 기관명은 반드시 CA 인증서와 동일하게 넣어야 합니다. 그렇지 않으면, CA의 서명을 받을 수 없습니다.

부서, 시스템 명과 이메일 주소를 알아서 넣습니다. (CA 랑 동일해도 상관없습니다.)

요청을 하기 위한 추가속성을 입력하라고 합니다. 아무 값이나 넣어도 상관없습니다.

[root@localhost tls]# openssl req -new -days 365 -key server.key -out server.csr

Enter pass phrase for server.key:

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [GB]:KR

State or Province Name (full name) [Berkshire]:Daejeon

Locality Name (eg, city) [Newbury]:Daejeon

Organization Name (eg, company) [My Company Ltd]:ETRI

Organizational Unit Name (eg, section) []:Research

Common Name (eg, your name or your server's hostname) []:MyServer

Email Address []:hook@ensec.re.kr

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:password

An optional company name []:None

인증서 요청파일이 완성되었으면, CA의 서명과정을 거칩니다.

CA 비밀키의 패스워드를 입력합니다.

그러면, CA 서명을 할 것인지를 물어보고, 또 한번 발급할 것인가를 물어봅니다. 모두 y 로 응답합니다.

[root@localhost tls]# openssl ca -in server.csr -out server.crt -keyfile ca.key -cert ca.crt

Using configuration from /etc/pki/tls/openssl.cnf

Enter pass phrase for ca.key:

Check that the request matches the signature

Signature ok

Certificate Details:

        Serial Number: 1 (0x1)

        Validity

            Not Before: Aug 24 05:48:50 2010 GMT

            Not After : Aug 24 05:48:50 2011 GMT

        Subject:

            countryName               = KR

            stateOrProvinceName       = Daejeon

            organizationName          = ETRI

            organizationalUnitName    = Research

            commonName                = MyServer

            emailAddress              = hook@ensec.re.kr

        X509v3 extensions:

            X509v3 Basic Constraints:

                CA:FALSE

            Netscape Comment:

                OpenSSL Generated Certificate

            X509v3 Subject Key Identifier:

                CB:4E:81:5A:58:79:98:76:89:B3:B1:5C:6F:B5:77:CD:8C:9D:3B:01

            X509v3 Authority Key Identifier:

                keyid:35:82:E4:7B:71:D1:F5:10:72:C2:0F:A5:0E:54:34:E3:C9:39:63:60

Certificate is to be certified until Aug 24 05:48:50 2011 GMT (365 days)

Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y

Write out database with 1 new entries

Data Base Updated

이것으로 CA 인증을 받은 서버의 인증서가 생성되었습니다.


아래의 과정은 클라이언트용 비밀키와 인증서의 생성과정으로 서버용 만들기와 동일합니다.

동일한 과정으로 여러 개의 비밀키와 인증서를 만들 수 있습니다.

[root@localhost tls]# openssl genrsa -des3 -out client.key 1024

Generating RSA private key, 1024 bit long modulus

...++++++

..............++++++

e is 65537 (0x10001)

Enter pass phrase for client.key:

Verifying - Enter pass phrase for client.key:

[root@localhost tls]# openssl req -new -days 365 -key client.key -out client.csr

Enter pass phrase for client.key:

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [GB]:KR

State or Province Name (full name) [Berkshire]:Daejeon

Locality Name (eg, city) [Newbury]:Daejeon

Organization Name (eg, company) [My Company Ltd]:ETRI

Organizational Unit Name (eg, section) []:Research

Common Name (eg, your name or your server's hostname) []:MyClient

Email Address []:hook@ensec.re.kr

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:password

An optional company name []:None

[root@localhost tls]# openssl ca -in client.csr -out client.crt -keyfile ca.key -cert ca.crt

Using configuration from /etc/pki/tls/openssl.cnf

Enter pass phrase for ca.key:

Check that the request matches the signature

Signature ok

Certificate Details:

        Serial Number: 2 (0x2)

        Validity

            Not Before: Aug 24 05:50:19 2010 GMT

            Not After : Aug 24 05:50:19 2011 GMT

        Subject:

            countryName               = KR

            stateOrProvinceName       = Daejeon

            organizationName          = ETRI

            organizationalUnitName    = Research

            commonName                = MyClient

            emailAddress              = hook@ensec.re.kr

        X509v3 extensions:

            X509v3 Basic Constraints:

                CA:FALSE

            Netscape Comment:

                OpenSSL Generated Certificate

            X509v3 Subject Key Identifier:

                B0:CE:BA:FD:1D:17:4B:DF:4F:9A:36:37:DB:D8:8E:7A:A8:7C:C9:FF

            X509v3 Authority Key Identifier:

                keyid:35:82:E4:7B:71:D1:F5:10:72:C2:0F:A5:0E:54:34:E3:C9:39:63:60

Certificate is to be certified until Aug 24 05:50:19 2011 GMT (365 days)

Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y

Write out database with 1 new entries

Data Base Updated

현재까지 발급된 상황을 보면, CA용 비밀키와 인증서가 생성되었고,

서버용과 클라이언트용 비밀키와 인증서가 생성되었습니다.

CA가 관리하는 내용을 한번 검토해 봅니다.

[root@localhost tls]# ll

total 132

-rw-r--r-- 1 root root 1257 Aug 24 14:47 ca.crt

-rw-r--r-- 1 root root  963 Aug 24 14:46 ca.key

lrwxrwxrwx 1 root root   19 Jun  3 20:14 cert.pem -> certs/ca-bundle.crt

drwxr-xr-x 2 root root 4096 Aug 24 13:43 certs

-rw-r--r-- 1 root root 3209 Aug 24 14:50 client.crt

-rw-r--r-- 1 root root  757 Aug 24 14:50 client.csr

-rw-r--r-- 1 root root  963 Aug 24 14:49 client.key

drwxr-xr-x 6 root root 4096 Aug 24 14:50 demoCA

drwxr-xr-x 2 root root 4096 Jun  3 20:14 misc

-rw-r--r-- 1 root root 9828 Aug 24 14:43 openssl.cnf

-rw-r--r-- 1 root root 9828 Aug 24 14:42 openssl.cnf.org

drwxr-xr-x 2 root root 4096 Jul 23 10:06 private

-rw-r--r-- 1 root root 3209 Aug 24 14:48 server.crt

-rw-r--r-- 1 root root  757 Aug 24 14:48 server.csr

-rw-r--r-- 1 root root  963 Aug 24 14:47 server.key

[root@localhost tls]# cd demoCA

[root@localhost demoCA]# ll

total 88

drwxr-xr-x 2 root root 4096 Aug 24 14:44 certs

drwxr-xr-x 2 root root 4096 Aug 24 14:44 crl

-rw-r--r-- 1 root root    5 Aug 24 14:45 crlnumber

-rw-r--r-- 1 root root  212 Aug 24 14:50 index.txt

-rw-r--r-- 1 root root   20 Aug 24 14:50 index.txt.attr

-rw-r--r-- 1 root root   21 Aug 24 14:48 index.txt.attr.old

-rw-r--r-- 1 root root  106 Aug 24 14:48 index.txt.old

drwxr-xr-x 2 root root 4096 Aug 24 14:50 newcerts

drwxr-xr-x 2 root root 4096 Aug 24 14:45 private

-rw-r--r-- 1 root root    3 Aug 24 14:50 serial

-rw-r--r-- 1 root root    3 Aug 24 14:48 serial.old

[root@localhost demoCA]# ls certs/

[root@localhost demoCA]# ls crl

[root@localhost demoCA]# ls newcerts/

01.pem  02.pem

[root@localhost demoCA]# ll newcerts

total 16

-rw-r--r-- 1 root root 3209 Aug 24 14:48 01.pem

-rw-r--r-- 1 root root 3209 Aug 24 14:50 02.pem

[root@localhost demoCA]# ll private/

total 0

index.txt 파일에는 발급된 인증서에 대한 간략 정보가 기록되어 있습니다.

[root@localhost demoCA]# cat index.txt

V       110824054850Z           01      unknown /C=KR/ST=Daejeon/O=ETRI/OU=Research/CN=MyServer/emailAddress=hook@ensec.re.kr

V       110824055019Z           02      unknown /C=KR/ST=Daejeon/O=ETRI/OU=Research/CN=MyClient/emailAddress=hook@ensec.re.kr

[root@localhost demoCA]# cat index.txt.attr

unique_subject = no

serial 파일에는 발급된 인증서의 개수가 기록되어 있습니다. 총 3개의 인증서가 발급되었음을 알 수 있습니다.

[root@localhost demoCA]# cat serial

03

[root@localhost demoCA]#

Posted by 동경불나방

Option Explicit

Const CELL_PURPOSE = "$B$2"  ' リリース目的セル
Const CELL_WORKER = "$B$3"   ' 作業者セル
Const CELL_RDAY = "$B$4"     ' 作業日(リリース日)セル
Const CELL_PLACE = "$B$5"    ' リリース場所(DEV/STG/PRO)セル
Const BEGIN_RELEASE_LIST = 9 ' リリースリスト開始行

' --------------------------
'  リリース設定ファイル出力
' --------------------------
Sub OutputCfgFile()
    Dim purpose As String
    Dim name As String
    Dim worker As String
    Dim place As String
    Dim rday As String

    purpose = Trim(Range(CELL_PURPOSE))
    worker = Trim(Range(CELL_WORKER))
    place = Trim(Range(CELL_PLACE))
    rday = Trim(Range(CELL_RDAY))
    If Not IsDate(rday) Then
        MsgBox "日付が不正です。", vbInformation
        Range(CELL_RDAY).Activate
        Exit Sub
    End If
    rday = Format(rday, "yymmdd")
    ' -----------------------
    ' 保存ファイル名称
    ' -----------------------
    Dim defaultName As String
    defaultName = "release_" & StrConv(place, vbLowerCase) & "_" & rday & ".cfg"
    name = Application.GetSaveAsFilename(InitialFileName:=defaultName)
    If StrConv(name, vbUpperCase) = "FALSE" Then Exit Sub
    Dim myADOstr
    Set myADOstr = CreateObject("ADODB.Stream")
    myADOstr.Charset = "EUC-JP"
    myADOstr.Open

    ' -----------------------
    ' 基本リリース情報の出力 改行コード LFタイプ
    ' -----------------------
    myADOstr.WriteText "PURPOSE:" & purpose & vbLf
    myADOstr.WriteText "WORKER:" & worker & vbLf
    myADOstr.WriteText "RDAY:" & rday & vbLf
    myADOstr.WriteText "PLACE:" & place & vbLf
    ' --------------------
    ' ファイルリストの出力
    ' --------------------
    Dim i As Long
    Dim last As Integer
    i = BEGIN_RELEASE_LIST
    last = Cells.SpecialCells(xlCellTypeLastCell).Row
    Dim serverType As String
    Dim directory As String
    Do Until i > last
        Dim module As String
        module = Trim(Cells(i, 3).Value)
        If module = "" Then Exit Do
        Dim temp As String
        temp = Trim(Cells(i, 1).Value)
        serverType = IIf(temp = "", serverType, temp)
        temp = Trim(Cells(i, 2).Value)
        directory = IIf(temp = "", directory, temp)
        myADOstr.WriteText "RELEASE:" & serverType & ":" & directory & ":" & module & vbLf
        i = i + 1
    Loop

    'ファイル名は適切に指定。後ろの「2」は上書きモード
    myADOstr.SaveToFile name, 2
    myADOstr.Close
    Set myADOstr = Nothing
End Sub

Posted by 동경불나방

서버와 서버간의 파일전송을 하는데 이상하게 속도가 나지 않습니다. 두대의 서버가 모두 동일한 스위치에 그것도 기가비트 포트에 물려있는데 보장되어야 할 속도가 나오지 않는다 의심될때 가장 먼저 해봐야 할일은 실제 통신 속도를 측정하는 일일 것입니다.
정 말 간단하게 테스트하고 싶다면 어떤 방법이 있을까요? 여기에 정말 좋은 솔루션이 있습니다. 그것도 무료네요.
http://sourceforge.net/projects/iperf/
iperf는 두대의 서버 사이에 한대는 서버, 한대는 클라이언트로 접속하여 속도를 측정합니다.
다음과 같이 설치를 하도록 합니다. 이 글을 쓰는 시점에서는 2.0.4가 최신버젼입니다만 적정한 최신 버젼을 사용하시면 됩니다.

> tar -zxvf iperf-2.0.4.tar.gz
> cd iperf-2.0.4
> ./configure
> make; make install

이 제 두대의 서버간의 속도를 측정해 보도록 하겠습니다.
* 서버 실행하기
> iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

* 클라이언트 실행하기
iperf -c 192.168.0.2
------------------------------------------------------------
Client connecting to 192.168.0.2, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.0.3 port 55881 connected with 192.168.0.2 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 1.10 GBytes 942 Mbits/sec


위 의 결과를 통해 두 서버간의 통신속도는 942 Mbit/sec 라는것을 알았습니다. 기가비트 포트의 속도가 거의 보장되고 있었네요^^

 

출처 : http://theeye.pe.kr/399

Posted by 동경불나방