Dell Optiplex GXa Solaris 8  x86  6/00

戻る




Proftpd-1.2.7



必要なソフトウェア:

	proftpd-1.2.7.tar.gz   (05.Dec.2002 Release)
	ftp://ftp.proftpd.org/distrib/source/


準 備:

作業ディレクトリを作成する。
	$ mkdir /opt/src/proftpd125

作成したディレクトリに移る。
	$ cd /opt/src/proftpd125

アーカイブをダウンロードする。
	$ wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.7.tar.gz

解凍展開する。
	$ tar xozf proftpd-1.2.7.tar.gz

展開されたディレクトリに移動する。
	$ cd proftpd-1.2.7


セキュリティ を高めるため、FTPでアクセスされた時の応答メッセージ
(ftpd名とバージョン)を変える。
もしも自分が使っているバージョンにセキュリティホールが見つかってしまっ
た場合、クラッカーはその情報を元に攻撃を仕掛けてくる可能性があるので、
ソースを少々書き換えて、表示させるftpd名とバージョンを架空のFTPDにして
しまう。

includeディレクトリのversion.hをviで開く。
	$ vi ./include/version.h

4行目の「#define VERSION	"1.2.7"」を以下のように適当に書き換えて保存する。
	#define PROFTPD_VERSION_TEXT	"2.3.6"

srcディレクトリのmain.cをviで開く。
	$ vi ./src/main.c

1007行目から1009行目までを以下のように適当に書き換えて保存する。

	/* ### 変更前 ### */
	  send_response("220", "ProFTPD " ROFTPD_VERSION_TEXT " Server ready.");
	else
	  send_response("220", "ProFTPD " ROFTPD_VERSION_TEXT " Server (%s) [%s]",

	/* ### 変更後 ### */
	  send_response("220", "domain1.com Orignal FTPD " ROFTPD_VERSION_TEXT " Server ready.");
	else
	  send_response("220", "domain1.com Orignal FTPD " ROFTPD_VERSION_TEXT " Server (%s) [%s]",



インストール:

最適化させる。(Solarisの場合、認証にPAMを使用しないようにPrefixをつける。こうしな
いとmessagesにエラーが残るようになってしまう。)
	$ ./configure --disable-pam

コンパイルする。
	$ make

SuperUserになってインストールする。
	$ su
	password:
	# make install

	
/usr/local/sbin/ に proftpd ftpshut の2つが、
/usr/local/bin/ に ftpcount ftpwho の2つが、
/usr/local/etc/ に proftpd.conf(設定見本)が、
その他、manがインストールされた。


proftpdのシンボリックリンクを/usr/sbin/内に張る。
	# ln -s /usr/local/sbin/proftpd /usr/sbin/proftpd 


設 定

設定ファイルproftpd.confはSolarisの場合は/etc/ではなく、/usr/local/etc/内で設定さ
れる。

viで/usr/local/etc/proftpd.confを開き、以下のように編集する。

=========================================================
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

# ServerName                    "ProFTPD Default Installation"
ServerName                      "ftp.domain.com"

# ServerType                    standalone
ServerType                      inetd
DefaultServer                   on

# "group1"に属するユーザーがftpでログインした場合は、chrootさせ
# DefaultRootをそのユーザーのディレクトリ内に制限し、自分が属する
# グループ "mygroup" に属するユーザーの場合は制限しない設定。(「!」をつける)
# (グループに関わらず全てchrootさせたい場合は、グループの記述は必要ない。)
DefaultRoot                     ~       group1,!mygroup

# Port 21 is the standard FTP port.
Port                            21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                           022

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances                    30

# Set the user and group that the server normally runs at.
User                            nobody
# Group                         nogroup
Group                           nobody

# タイムアウトまでの各アイドル時間を指定しておく。
TimeoutNoTransfer               600
TimeoutStalled                  600
TimeoutIdle                     1200

# Overwriteを設定しておかないと、上書きアップロードができない。
AllowOverwrite on

# syslog proftpdに関するすべてのログをsyslogではない別のファイルに書き出す。
#(この設定をすることによって指定したファイル
#のみに全てのログが書き出される。)これによってログインしてきたユーザー名やクライ
#アントのIPアドレスなどの詳細も記録されるのでセキュリティを考慮して設定すべきであ
#る。
SystemLog                       /var/log/proftpd.log

# Normally, we want files to be overwriteable.
# <Directory /*>
#  AllowOverwrite               on
#</Directory>
#
# A basic anonymous configuration, no upload directories.
#<Anonymous ~ftp>
#  User                         ftp
#  Group                                ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
#  UserAlias                    anonymous ftp
#
#  # Limit the maximum number of anonymous logins
#  MaxClients                   10
#
#  # We want 'welcome.msg' displayed at login, and '.message' displayed
#  # in each newly chdired directory.
#  DisplayLogin                 welcome.msg
#  DisplayFirstChdir            .message
#
#  # Limit WRITE everywhere in the anonymous chroot
#  <Limit WRITE>
#    DenyAll
#  </Limit>
#
#</Anonymous>

# Solarisの場合、WtmpLogをOFFにしておかないとエラーが出る。
WtmpLog off
=========================================================


/etc/hosts.allowをviで開き、今までwu_fptd用に "in.ftpd" と書いていた部分を全て
"proftpd"に置換する。
	proftpd : IPAddress

/etc/inetd.confをviで開き、今までのFTPの部分をコメントアウトし、proftpd用記述を足
す。
	#ftp  stream tcp  nowait  root  /usr/local/sbin/tcpd  in.ftpd -a
	ftp   stream tcp  nowait  root  /usr/local/sbin/tcpd  proftpd

今までwu_ftpdを使用していた関係で、/etc/passwd の各ユーザーにShellを与えていたが、
Proftpdはその必要はない。FTPは使うが、Telnetをする必要はないユーザーのShellを
falseにする。また、wu_ftpdではDefaultRootをユーザーのディレクトリ内に制限する
(chroot)ためユーザーのディレクトリ指定に特別な記述"/./" をしていたが、それも必要
なくなった。viで/etc/passwdを開き、Shellの必要のないユーザーの行を以下のように書き
換える。
	user:x:1002:10::/export/home/user:/bin/false

proftpd.conf の DefaultRoot でグループによってchrootするかしないかを分けたので、
/etc/passwd の各ユーザーのグループを揃える。

inetdにHungUpを送る。
	# pkill -HUP inetd
	# exit