無線LAN環境を作ろう!で無線LAN環境を構築したのですが、電波を傍受されると、POP3のパスワードがばれてしまい、通信が乗っ取られてしまう危険があるため、とても不安でした。そんな時、zebedeeというソフトウェアの存在を知り、使ってみることにしました。
zebedeeとは、サーバとクライアントの間に暗号化したトンネルを掘るソフトウェアです。さらに、サーバ側では、トンネルから受け取ったパケットを、ポートごとに設定された転送先に送ることもできます。
さらに、zebedeeはUNIX用とWindows用とが開発されているため、ThinkPadをFreeBSDで起動している時も、Windowsで起動している時も、zebedeeで暗号化したトンネルを使えそうです。
今回は、このzebedeeを使って、ルータとクライアントPC間のWaveLAN上に暗号化したトンネルを張り、POP3のパケットがその中を通るように設定することで、POP3のパスワードやメールの内容を傍受・盗聴から保護します。
イメージ図
+------+ +------+ +---+
|Host a|===========|Host b|--------------|ISP|
+------+ +------+ +---+
|<-WaveLAN->| |<-wired line->|
zebedee tunnel
(encrypted)
まず、以下のパッチを当てます。
*** Makefile.org Thu Jun 19 22:58:07 2003 --- Makefile Thu Sep 11 22:23:28 2003 *************** *** 42,70 **** # Location of Blowfish include and library # You can use the versions from OpenSSL if you have it installed, as follows: ! # BFINC = /usr/include/openssl ! # BFLIB = -lcrypto ! BFINC = -I../blowfish-0.9.5a ! BFLIB = ../blowfish-0.9.5a/libblowfish.a # Location of zlib include and library ! ZINC = -I../zlib-1.1.4 ! ZLIB = ../zlib-1.1.4/libz.a # Location of bzlib include and library # Set these empty if you don't want bzib2 support ! BZINC = -I../bzip2-1.0.1 ! BZLIB = ../bzip2-1.0.1/libbz2.a # # Tools needed for Perl "POD"-format documentation conversion. # PERL_$(OS) = perl PERL_win32 = c:/perl/bin/perl # Avoid Cygwin port ! PERL = $(PERL_$(OS)) BAT_win32 = .bat --- 42,74 ---- # Location of Blowfish include and library # You can use the versions from OpenSSL if you have it installed, as follows: ! BFINC = -I/usr/include/openssl ! BFLIB = -lcrypto ! # BFINC = -I../blowfish-0.9.5a ! # BFLIB = ../blowfish-0.9.5a/libblowfish.a # Location of zlib include and library ! # ZINC = -I../zlib-1.1.4 ! # ZLIB = ../zlib-1.1.4/libz.a ! ZINC = -I/usr/include ! ZLIB = /usr/lib/libz.a # Location of bzlib include and library # Set these empty if you don't want bzib2 support ! # BZINC = -I../bzip2-1.0.1 ! # BZLIB = ../bzip2-1.0.1/libbz2.a ! BZINC = -I/usr/include ! BZLIB = /usr/lib/libbz2.a # # Tools needed for Perl "POD"-format documentation conversion. # PERL_$(OS) = perl PERL_win32 = c:/perl/bin/perl # Avoid Cygwin port ! PERL = /usr/bin/perl BAT_win32 = .bat *************** *** 73,79 **** # Installation directories for the Linux/Solaris/*NIX World ! ROOTDIR = /usr BINDIR = $(ROOTDIR)/bin ZBDDIR = $(ROOTDIR)/lib/zebedee MANDIR = $(ROOTDIR)/man/man1 --- 77,83 ---- # Installation directories for the Linux/Solaris/*NIX World ! ROOTDIR = /usr/local BINDIR = $(ROOTDIR)/bin ZBDDIR = $(ROOTDIR)/lib/zebedee MANDIR = $(ROOTDIR)/man/man1
次に、コンパイルします。zebedeeはOSごとにmakeのオプションが分かれているため、FreeBSDでは以下のように指定します。
% make OS=freebsd
最後にインストールします。インストールも同様にオプションを指定して実行します。
# make OS=freebsd install
Windowsへのインストールはとても簡単!ダウンロードしてきたzbd251setup.exeをダブルクリックするだけです。特に選択するところで迷うこともないと思います。
まずは、クライアントを認証するための秘密鍵を生成します。
# zebedee -p > client1.key # mv client1.key /usr/local/lib/zebedee/
次に、生成した秘密鍵からハッシュ値?を生成します。
# zebedee -P -f client1.key > client1_id
さらに、設定ファイルを編集します。/usr/local/lib/zebedee以下のvncviewer.zbdをclient.zbdという名前でコピーし、編集します。この例では、11025番ポートへのアクセスをISP1のsmtpポートへ、11110番ポートへのアクセスをISP1のpop3ポートへ、121025番ポートへのアクセスをISP2のsmtpポートへ、12110番ポートへのアクセスをISP2のpop3ポートへ、13025番ポートへのアクセスをISP3のsmtpポートへ、13110番ポートへのアクセスをISP3のpop3ポートへ、それぞれ転送します。
*** vncviewer.zbd Fri Apr 13 03:07:44 2001 --- client.zbd Fri Sep 12 22:54:12 2003 *************** *** 9,22 **** server false # It's a client detached true # Detach from terminal ! message "Starting VNC viewer" # On Windows systems you might use the following: ! command '"c:\Program Files\ORL\VNC\vncviewer.exe" localhost:%d' # On UNIX systems you might use the following: # command 'vncviewer localhost:%d' compression zlib:6 # Request normal Zlib compression --- 9,42 ---- server false # It's a client detached true # Detach from terminal ! # message "Starting VNC viewer" # On Windows systems you might use the following: ! # command '"c:\Program Files\ORL\VNC\vncviewer.exe" localhost:%d' # On UNIX systems you might use the following: # command 'vncviewer localhost:%d' compression zlib:6 # Request normal Zlib compression + # zebedee server + serverhost xxx.xxx.xxx.xxx + localsource true + include /usr/local/lib/zebedee/client1.key + + # SMTP to ISP1 + tunnel 11025:smtp.isp1.ne.jp:25 + # POP3 to ISP1 + tunnel 11110:pop3.isp1.ne.jp:110 + + # SMTP to ISP2 + tunnel 12025:smtp.isp2.ne.jp:25 + # POP3 to ISP2 + tunnel 12110:pop3.isp2.ne.jp:110 + + # SMTP to ISP3 + tunnel 13025:smtp.isp3.ne.jp:25 + # POP3 to ISP3 + tunnel 13110:pop3.isp3.ne.jp:110
最後に、起動スクリプトを準備します。
#!/bin/sh
zebedee=/usr/local/bin/zebedee
zebedee_config=/usr/local/lib/zebedee/client.zbd
if [ ! -x $zebedee ] ; then
echo "Can\'t find $zebedee."
elif [ ! -f $zebedee_config ] ; then
echo "Can\'t find $zebedee_config."
else
$zebedee -f $zebedee_config
fi
FreeBSDで生成したclient1.keyをc:\Program Files\zebedee\以下にコピーし、設定ファイルも同様に編集します。
次に、Windowsのエクスプローラーからショートカットを作成し、プロパティを編集します。
"c:\Program Files\zebedee\zebedee.exe"
となっているのを、以下のように直します。
"c:\Program Files\zebedee\zebedee.exe" -f client.zbd
最小化を選択します。
スタートボタンを右クリックし、開くを選択、プログラム、スタートアップと開いて、ショートカットを移動します。
クライアントで生成したハッシュ値?を/usr/local/lib/zebedee/clients.idに書き込みます。
# # Example IDs matching client1.key and client2.key # ba077f6a42bea502f517cab5685e476a713d9621 client1
次に設定ファイル/usr/local/lib/zebedee/server.zbdを編集します。
*** server.zbd.org Fri Jun 20 17:16:14 2003
--- server.zbd Sat Sep 13 11:38:17 2003
***************
*** 13,19 ****
message "DEFAULT CONFIGURATION FILE -- EDIT BEFORE USE"
! detached false # You will probably want this 'true' for normal
# use but I want to make sure that you see the
# preceding message if you haven't edited this.
--- 13,19 ----
message "DEFAULT CONFIGURATION FILE -- EDIT BEFORE USE"
! detached true # You will probably want this 'true' for normal
# use but I want to make sure that you see the
# preceding message if you haven't edited this.
***************
*** 22,27 ****
--- 22,28 ----
compression zlib:9 # Allow maximum zlib compression
keylength 256 # Allow keys up to 256 bits
+ minkeylength 256
keylifetime 36000 # Shared keys last 10 hours
maxbufsize 16383 # Allow maximum possible buffer size
***************
*** 31,37 ****
#
# Or to log to the system logging facility uncomment this:
#
! # logfile SYSLOG
keygenlevel 2 # Generate maximum strength private keys
--- 32,38 ----
#
# Or to log to the system logging facility uncomment this:
#
! logfile SYSLOG
keygenlevel 2 # Generate maximum strength private keys
***************
*** 48,61 ****
# To validate the identity of clients use a line something like
# the following:
#
! # checkidfile './clients.id'
# The "redirect" expression can be use to set the default ports
# allowed when a target specification consists of a hostname but
# no other ports. The "redirect none" statement prohibits
# tunnelling anywhere by default.
! redirect none
# Set up allowed targets. Note that there are NO targets allowed
# by this file by default. You must explicitly edit it to enable
--- 49,62 ----
# To validate the identity of clients use a line something like
# the following:
#
! checkidfile './clients.id'
# The "redirect" expression can be use to set the default ports
# allowed when a target specification consists of a hostname but
# no other ports. The "redirect none" statement prohibits
# tunnelling anywhere by default.
! # redirect none
# Set up allowed targets. Note that there are NO targets allowed
# by this file by default. You must explicitly edit it to enable
***************
*** 92,94 ****
--- 93,111 ----
# the default unless overridden on the command line.
target localhost
+
+ # SMTP to ISP1
+ target smtp.isp1.ne.jp:25
+ # POP3 to ISP1
+ target pop3.isp1.ne.jp:110
+
+ # SMTP to ISP2
+ target smtp.isp2.ne.jp:25
+ # POP3 to ISP2
+ target pop3.isp2.ne.jp:110
+
+ # SMTP to ISP3
+ target smtp.isp3.ne.jp:25
+ # POP3 to ISP3
+ target pop3.isp3.ne.jp:110
最後に、起動スクリプトを準備します。
#!/bin/sh
zebedee=/usr/local/bin/zebedee
zebedee_config=/usr/local/lib/zebedee/server.zbd
if [ ! -x $zebedee ] ; then
echo "Can\'t find $zebedee."
elif [ ! -f $zebedee_config ] ; then
echo "Can\'t find $zebedee_config."
else
$zebedee -f $zebedee_config
fi
以下の抜粋のように、SMTPサーバとPOP3サーバ、各ポートの設定を変更します。
(setq mew-config-alist
'(("isp1"
; ("smtp-server" . "smtp.isp1.ne.jp")
("smtp-server" . "localhost")
("smtp-port" . "11025")
; ("pop-server" . "pop3.isp1.ne.jp")
("pop-server" . "localhost")
("pop-port" . "11110")
)
("isp2"
; ("smtp-server" . "smtp.isp2.ne.jp")
("smtp-server" . "localhost")
("smtp-port" . "12025")
; ("pop-server" . "pop3.isp2.ne.jp")
("pop-server" . "localhost")
("pop-port" . "12110")
)
("isp3"
; ("smtp-server" . "smtp.isp3.ne.jp")
("smtp-server" . "localhost")
("smtp-port" . "13025")
; ("pop-server" . "pop3.isp3.ne.jp")
("pop-server" . "localhost")
("pop-port" . "13110")
)
))
設定を確認したら、zebedee serverとzebedee clientを起動し、mewを再起動します。tcpdumpやetherealで暗号化されていることを確認してみましょう。