« ジーザス! | メイン | USBあったか手袋&スリッパ »

pure-ftpdのテスト

pure-ftpdを2.6なRedhatLinuxに入れてみた。

$ wget 'ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.20.tar.gz'
$ tar zxvf pure-ftpd-1.0.20.tar.gz
$ cd pure-ftpd-1.0.20

さて、どうconfigureしてやろうか。まずは目に付いた奴だけ有効にしてみる。
http://homepage.mac.com/proc/pureftpd/pureftpd-option.html#configure-usage ここ参照。

$ ./configure --with-paranoidmsg --with-largefile --with-tls --with-privsep --with-ftpwho --with-uploadscript --with-throttling --with-peruserlimits --with-virtualchroot --without-inetd --with-diraliases

--with-paranoidmsg

ユーザ不在時の認証失敗のメッセージとパスワードの誤りによる認証失敗のメッセージとを同一にする

一応セキュリティのために。

--with-largefile

32bitアーキテクチャで2GB以上のファイルのダウンロードに対応する。

一応。

--with-tls

AUTH TLSに対応する。詳細はREADME.TLSを参照のこと。

暗号化のTLSね。ちなみに --with-certfile= で指定するらしい。
とりあえずデフォルトの /etc/ssl/private/pure-ftpd.pem で。

--with-privsep

OpenSSHのようなprivilege separation機能を有効にする。詳細はREADMEの「PRIVILEGE SEPARATION」を参照のこと。

念のため。

--with-ftpwho

pure-ftpwhoコマンドによるftpwho機能を有効にする。この機能はメモリを余分に消費する。

proftpdに足りないのはコレですよコレ

--with-uploadscript

ファイルがアップロードされた時に外部スクリプトを呼び出すpure-uploadscript機能を有効にする。

セキュリティ上問題になるけど便利なので有効に

--with-throttling

帯域制限機能を有効にする。

一応。

--with-peruserlimits

同一ユーザの同時アクセス数制限機能を有効にする

これは必要かと

--with-virtualchroot

chroot()を使わない仮想chroot機能を有効にする。このオプションを指定しなければ一般的なchroot機能が標準で有効になる。chroot領域外へのシンボリックリンクを作りたい人のための機能。

chroot外を見に行けた方が便利……かね?

--without-inetd

inetdからの起動に対応しない。スタンドアロンのみでの運用の場合に使う。

inetdは使わないので。

--with-diraliases

ディレクトリエイリアス(ショートカット)機能を有効にする。詳細はREADMEファイルの「DIRECTORY ALIASES」を参照のこと。

なんか便利そうだ


というわけでごー。
$ ./configure --with-paranoidmsg --with-largefile --with-tls --with-privsep --with-ftpwho --with-uploadscript --with-throttling --with-peruserlimits --with-virtualchroot --without-inetd --with-diraliases

通った。

$ make

これも通った。

$ sudo make install

さくっと終了。


・設定のコピー
$ sudo cp ./configuration-file/pure-ftpd.conf /etc/pureftpd.conf

・んで編集
$ sudo emacs /etc/pureftpd.conf


// 以下変更点だけ

# Maximum number of sim clients with the same IP address

MaxClientsPerIP 2

1つのIPにつき許可するクライアント数。5->2

# Disallow anonymous connections. Only allow authenticated users.

NoAnonymous yes

AnonymousFTPにはしないので no->yes

# Maximum idle time in minutes (default = 15 minutes)

MaxIdleTime 5

421タイムアウトになるまでの時間。15->5

# IP address/port to listen to (default=all IP and port 21).

# Bind 127.0.0.1,21
Bind 0.0.0.0,1021

使用するIPアドレスとポート番号。
既にproftpdが動いてる上での動作テストなので
全IPアドレス:1021をバインドするようにしてみる。

# Port range for passive connections replies. - for firewalling.

PassivePortRange 10000 10099

PASVモードで使うポートの下限と上限。デフォルト30000-50000から適当に変更。


# Force an IP address in PASV/EPSV/SPSV replies. - for NAT.
# Symbolic host names are also accepted for gateways with dynamic IP
# addresses.

# ForcePassiveIP 192.168.0.1
ForcePassiveIP www.syonbori.net

PASVモードでの応答に使うIPアドレス。DDNSアドレスを指定してもOK

# If your pure-ftpd has been compiled with pure-uploadscript support,
# this will make pure-ftpd write info about new uploads to
# /var/run/pure-ftpd.upload.pipe so pure-uploadscript can read it and
# spawn a script to handle the upload.

CallUploadScript yes

アップロード後にスクリプトを呼ぶ機能の設定。コメントアウトする。

# This option can accept three values :
# 0 : disable SSL/TLS encryption layer (default).
# 1 : accept both traditional and encrypted sessions.
# 2 : refuse connections that don't use SSL/TLS security mechanisms,
# including anonymous sessions.
# Do _not_ uncomment this blindly. Be sure that :
# 1) Your server has been compiled with SSL/TLS support (--with-tls),
# 2) A valid certificate is in place,
# 3) Only compatible clients will log in.

TLS 1

TLS接続の設定。1にする(=コメントアウトする)
0: SSL/TLSを使わない
1: SSL/TLSでも、通常の暗号化されないものも許可する
2: SSL/TLS以外受け付けない

・起動
pure-config.pl から起動って書いてあるけど /usr/local/sbin にないのでコピー
$ sudo cp ./configuration-file/pure-config.pl /usr/local/sbin/
$ sudo chmod 755 /usr/local/sbin/pure-config.pl

・今度こそ起動
$ sudo /usr/local/sbin/pure-config.pl /etc/pureftpd.conf
Running: /usr/local/sbin/pure-ftpd -A -c50 -B -C2 -D -E -fftp -H -I15 -L2000:8 -m4 -p10000:10099 -Pwww.syonbori.net -s -S0.0.0.0,1021 -U133:022 -u100 -o -k99 -Z -Y1
[sid@gruen pure-ftpd-1.0.20]$ ps -aux
root 8494 0.0 0.4 6540 1208 ? S 22:59 0:00 /usr/local/sbin/pure-ftpd -A -c50 -B -C2 -D -E -fftp -H -I15 -L2000:8 -m4 -p10000:10099 -Pwww.syonbori.net -s -S0.0.0

よし、起動してるようだ。
次はローカルからテスト。

$ ftp
ftp> open 127.0.0.1 1021
Connected to 127.0.0.1 (127.0.0.1).
220 Please login with valid ID and Pass.
Name (127.0.0.1:sid): sid
331 Password required for sid.
Password:
230 User sid logged in.
Remote system type is UNIX.
Using binary mode to transfer files.

はいれた。lsも見えるな。


・LAN内からテスト
同一LAN内のWindowsクライアントからテスト。
SmartFTPでのぞいてみると…あっけなくログイン完了。

・日本語ファイル名
やっぱダメでした。さてどうするか。

投稿者 Zawa : 2005年12月29日 21:44

トラックバック

このエントリーのトラックバックURL:
http://zawa.s18.xrea.com/x/mt-tb.cgi/113

コメント

コメントしてください




保存しますか?