2008년 1월 22일 화요일

SSH 터널링 팁

유닉스 SSH 명령어 터널링 방법
예제자신의 로컬 포트 2222 로 내부 서버인 특정 서버 특정 포트로 연결할수 있다.
-N IP 옵션은 외부와 연결가능한 서버이다.

예제
외부와 연결할수 있는 192.168.0.10 의 SSH 를 이용하여 내부서버인 192.168.0.72 로 직접 퍼워딩하는 기능
ssh -f -C -L2222:192.168.0.72:22 -N 192.168.0.10

SecureCRT, PuTTY 에서도 가능 하다.


역 터널링 팁

보통의 내부 서버들은 기본적으로 OutBound NAT 정책이 막혀 있어 외부와 통신이 어렵다. 각 내부 서버에서 외부랑 통신이 가능한 GW 서버를 경유하여 외부와 접근이 가능하다.

예제 192.168.0.10 이 외부와 통신가능한 GW 서버이고
192.168.0.72 서버가 외부와 통신이 불가능한 내부통신이다. 이 서버내에 특정 외부 IP 인 192.168.10.17 로 22번 포트를 접속 할수 있다.

192.168.0.72 번 서버내에서 아래와 같은 명령으로 접속 가능
ssh -f -C -L2222:192.168.10.17:22 -N 192.168.0.10

이제 192.168.0,72 번 서버는 Localhost 2222 번 포트를 통해 외부 192.168.10.17 22번 포트와 접속 가능

2008년 1월 11일 금요일

X-Window 에서 한영 키 잡기

/etc/X11/Xmodmap 파일을 열어 아래와 같은 라인 두개 추가 후 X-Window 재시작.

keycode 209 = Hangul_Hanja
keycode 210 = Hangul

VMWare GuestOS 한영키 잡기

X 윈도우가 한영 키보드를 인식하게 설정이 되어야 한다.

/etc/vmware/config 파일에 다음 두 설정 값을 추가한다.

xkeymap.keysym.Hangul = 0x0f2
xkeymap.keysym.Hangul_Hanja = 0x0f1

추가후 VMware 를 재구동하면 VMWare GuestOS 에서도 한영 키가 사용 가능하다.

이 기종간 키보드 마우스 공유하기

Synergy - http://synergy2.sourceforge.net/

Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It's intended for users with multiple computers on their desk since each system uses its own monitor(s).

Redirecting the mouse and keyboard is as simple as moving the mouse off the edge of your screen. Synergy also merges the clipboards of all the systems into one, allowing cut-and-paste between systems. Furthermore, it synchronizes screen savers so they all start and stop together and, if screen locking is enabled, only one screen requires a password to unlock them all. Learn more about how it works.

Synergy is open source and released under the GNU Public License (GPL).

System Requirements
  • Microsoft Windows 95, Windows 98, Windows Me (the Windows 95 family)
  • Microsoft Windows NT, Windows 2000, Windows XP (the Windows NT family)
  • Mac OS X 10.2 or higher
  • Unix
    X Windows version 11 revision 4 or up
    XTEST extension(use "xdpyinfo grep XTEST" to check for XTEST)
All systems must support TCP/IP networking.

"Unix" includes Linux, Solaris, Irix and other variants. Synergy has only been extensively tested on Linux and may not work completely or at all on other versions of Unix. Patches are welcome (including patches that package binaries) at the patches page.

The Mac OS X port is incomplete. It does not synchronize the screen saver, only text clipboard data works (i.e. HTML and bitmap data do not work), the cursor won't hide when not on the screen, and there may be problems with mouse wheel acceleration. Other problems should be filed as bugs.

자세한 사용 방법은 아래의 블로그 참조
http://jwmx.tistory.com/833

2008년 1월 9일 수요일

CentOS5 (RedHat Linux 5) 에서 구버전 PHP 컴파일 하기

OS 버전이 올라감에 따라서 GCC 라든지 GLIBC 버전도 올라가기 때문에과거 버전의 소스 컴파일이 불가능할때가 있다.
예를 들어 php-5.0.2 를 최신 CentOS5 에서 컴파일 하면 다음과 같은 에러가 나는데

makegcc -Iext/libxml/ -I/home/contehm/mydownloads/php-5.0.3/ext/libxml/ -DPHP_ATOM_INC -I/home/contehm/mydownloads/php-5.0.3/include -I/home/contehm/mydownloads/php-5.0.3/main -I/home/contehm/mydownloads/php-5.0.3 -I/home/contehm/mydownloads/php-5.0.3/Zend -I/usr/include/libxml2 -I/home/contehm/mydownloads/php-5.0.3/TSRM -g -O2 -c /home/contehm/mydownloads/php-5.0.3/ext/libxml/libxml.c -o ext/libxml/libxml.o && echo > ext/libxml/libxml.loIn file included from /home/contehm/mydownloads/php-5.0.3/Zend/zend_API.h:26,from /home/contehm/mydownloads/php-5.0.3/main/php.h:38,from /home/contehm/mydownloads/php-5.0.3/ext/libxml/libxml.c:28:/home/contehm/mydownloads/php-5.0.3/Zend/zend_modules.h:34: error: array type has incomplete element type/home/contehm/mydownloads/php-5.0.3/Zend/zend_modules.h:35: error: array type has incomplete element type/home/contehm/mydownloads/php-5.0.3/Zend/zend_modules.h:36: error: array type has incomplete element type/home/contehm/mydownloads/php-5.0.3/Zend/zend_modules.h:37: error: array type has incomplete element type/home/contehm/mydownloads/php-5.0.3/Zend/zend_modules.h:38: error: array type has incomplete element typemake: *** [ext/libxml/libxml.lo] Error 1
다음과 같이 처리 한다.
../Zend/zend_modules.h 에 #include "zend_compile.h" 추가

#include "zend.h"
#include "zend_compile.h"
#define INIT_FUNC_ARGS int type, int module_number TSRMLS_DC

#define INIT_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC