2009년 2월 22일

fedora 8에 bridge방식으로 openvpn설정

bridge방식의 openvpn설정법은 자세히 나와있는 블로그를 보지 못했다.
아래 간략한 설치방법을 소개한다.

1.openvpn 관련 패키지 설치

yum install openvpn
yum install openssl
yum install lzo

2. brdige util설치
yum install bridge-utils

3.*easy-rsa디렉토리는 아래와 같다.
아래 디렉토리의 내용을 /etc/openvpn에 복사한다.

/var/share/openvpn/easy-rsa/2.0

4.var설정및 ca, key, dh생성

. ./vars
./clean-all
./build-ca

* build-ca생성시 common name은 'ca'로 넣는다.

./build-key-server server

* server key생성시 common name은 'server'로 넣는다.

./build-key client1

* client key생성시 common name은 'clinet1'로 넣는다.(client2가 있으면 client2처럼 각각의 common name을 다르게 넣는다)

./build-dh

*diffe hellman parameter를 생성한다.

5. 서버 config 생성

# Tunnel options
mode server # Set OpenVPN major mode
proto tcp-server # Setup the protocol (server)
port 1194 # TCP/UDP port number
dev tap0 # TUN/TAP virtual network device
keepalive 3600 7200 # Simplify the expression of --ping
daemon # Become a daemon after all initialization
verb 3 # Set output verbosity to n
comp-lzo # Use fast LZO compression

# OpenVPN server mode options
client-to-client # tells OpenVPN to internally route client-to-client traffic
duplicate-cn # Allow multiple clients with the same common name
#crl-verify /etc/openvpn/keys/crl.pem

# TLS Mode Options
tls-server # Enable TLS and assume server role during TLS hands
ca /etc/openvpn/keys/ca.crt # Certificate authority (CA) file
dh /etc/openvpn/keys/dh1024.pem # File containing Diffie Hellman param
cert /etc/openvpn/keys/server.crt # Local peer's signed certificate
key /etc/openvpn/keys/server.key

#TCP 1194포트를 기준으로 만들었다. 각각의 key들의 디렉토리를 본인의 서버에 맞게 변경한다.
#crl인증은 사용자 접속을 제한할때 사용한다.


6. startup스크립트 작성
#!/bin/bash
br="br0"
tap="tap0"
eth="eth0"
eth_ip="192.168.0.*"
eth_netmask="255.255.255.0"
eth_broadcast="192.168.0.255"
for t in $tap; do
openvpn --mktun --dev $t
done

brctl addbr $br
brctl addif $br $eth
for t in $tap; do
brctl addif $br $t
done
for t in $tap; do
ifconfig $t 0.0.0.0 promisc up
done
ifconfig $eth 0.0.0.0 promisc up
ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast

7. openvpn시작
openvpn /etc/openvpn/sever.conf

*위와같은 bridge.start 와 openvpn start 명령을 /etc/rc.local에 추가하여 boot시 시작되도록한다.
/etc/openvpn/bridge.start
openvpn /etc/openvpn/sever.conf


*참고
bridge stop스크립트

br="br0"
tap="tap0"
ifconfig $br down
brctl delbr $br
for t in $tap; do
openvpn --rmtun --dev $t
done

2009년 1월 26일

openvpn에서 crl.pem의 역할

openvpn의 client인증서를 강제로 revoke시키려 할때는 아래와 같은 방법으로 revoke시킨다.

. ./vars
./revoke-full client2

그러면 아래와 같은 메세지를 볼수 있다.

Using configuration from /root/openvpn/20/openvpn/tmp/easy-rsa/openssl.cnf
DEBUG[load_index]: unique_subject = "yes"
Revoking Certificate 04.
Data Base Updated
Using configuration from /root/openvpn/20/openvpn/tmp/easy-rsa/openssl.cnf
DEBUG[load_index]: unique_subject = "yes"
client2.crt: /C=KG/ST=NA/O=OpenVPN-TEST/CN=client2/emailAddress=me@myhost.mydomain
error 23 at 0 depth lookup:certificate revoked

마지막 error 23은 revoke된 인증서의 인증이 실패했다라는 의미이다.

세부적으로 revoke-full script는 CRL(certificate revocation list)이라고 불리는 crl.pem파일을 key디렉토리 하위에 생성한다.

openvpn server configuration파일에 아래 option을 추가하여 crl인증을 매 client인증때마다 수행하여 crl에 revoke된 정보가 들어있다면 connection을 drop시키도록 한다.

이러한 crl파일의 update는 openvpn서버가 실행되고 있는동안에도 수행될수 있으며 매 한시간 마다 update되며 매번 client가 접속시마다 체크된다.
crl-verify crl.pem

openvpn의 revoke-full시 에러가 날때

아래처럼 openvpn의 인증서를 revoke할때 에러가 날경우는...

# ./revoke-full nick2
Using configuration from /etc/openvpn/easy-rsa/openssl.cnf
error on line 282 of config file '/etc/openvpn/easy-rsa/openssl.cnf'
21626:error:0E065068:configuration file routines:STR_COPY:variable has no value:conf_def.c:629:line 282
Using configuration from /etc/openvpn/easy-rsa/openssl.cnf
error on line 282 of config file '/etc/openvpn/easy-rsa/openssl.cnf'
21627:error:0E065068:configuration file routines:STR_COPY:variable has no value:conf_def.c:629:line 282
nick2.crt: OK

openssl.cnf의 pkcs11_section을 아래와 같이 주석처리 하면된다.

#[ pkcs11_section ]
#engine_id = pkcs11
#dynamic_path = /usr/lib/engines/engine_pkcs11.so
#MODULE_PATH = $ENV::PKCS11_MODULE_PATH
#PIN = $ENV::PKCS11_PIN
#init = 0

-끝-

2009년 1월 20일

backtrack3(slackware)에서의 휠마우스(scroll mouse) 사용

Backtrack관련 글을 오랫만에 게시하는군요..

Backtrack을 사용하다보면 불편한점이 몇가지 있지요..

그중하나가 휠마우스(scroll wheel)의 사용입니다.

/etc/X11/xorg.conf 파일을 아래와 같이 수정하고 X를 재시작하면 휠마우스를 사용하실수 있습니다.

# Identifier and driver

Identifier "Mouse1"
Driver "mouse"

Option "Protocol" "IMPS/2"
Option "Device" "/dev/mouse"
Option "ZAxisMapping" "4 5"
Option "Buttons" "5"

감사합니다.