
Ubuntu日本語フォーラム

ログインしていません。
※1. Ubuntu 12.04 64bit Plain上にインストールしたFTPサーバvsftpdの設定項目に
一部どのような値を指定しておけばよいのかがリファレンス(※3)等からよくわからなかった点、および
※2. 現状までの設定内容でvsftpdサービスを起動してもプロセスの起動および起動失敗が確認されない点
(サービスの開始を行うとvsftpd start/pre-start, process 1854の表示が出たのちそのIDのプロセスの軌道は確認されず、
停止・再起動などを行うとstop: Unknown instance:が表示されます。
またサービスに何らかの動作があれば出力されると思われる/var/log/vsftpd.logもファイル自身がまだ生成されていません)
で伺いたい点があり、投稿させていただきました。
※1. 1. listen_port … コメントアウトしている。指定すべきポート番号は21でよいかわからない。
2. pasv_max_port … コメントアウトしている。指定すべきポート番号をどのように決めればよいのかわからない。
3. pasv_min_port … 同上
4. そのほかの設定項目の設定状況 … 以下『vsftpd.conf』ファイル設定内容ご参照。149行目以降が独自に加えた設定内容
ファイア・ウォールは外しています。
※2. 設定ファイル『vsftpd.conf』の設定内容が適切でないためサービスvsftpdが起動しないのではないかと思っています。
service vsftpd startを実行した際t一度だけ現状の設定内容でstart/runningが表示されたことがありましたが、その後起動したプロセスは確認されませんでした。
※3 http://www005.upp.so-net.ne.jp/develop-tom/deb/vsftpd-deb.html
----------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------
『vsftpd.conf』ファイル設定内容
----------------------------------------------------------------------------------------------------------------------------------------
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
listen_ipv6=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES
ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/pvivate/ssl-cert-snakeoil.key
#ssl_cipthers=HIGH
#require_ssl_reuse=NO
#
#
#
#
#
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.user_list
local_root=pubic_html
ssl_enable=YES
force_local_data_ssl=NO
force_local_logins_ssl=NO
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES
implicit_ssl=YES
#listen_port=990
#pasv_max_port=60009
#pasv_min_port=1024
local_root=public_html
userlist_deny=NO
----------------------------------------------------------------------------------------------------------------------------------------
オフライン
vsftpdサービスはより正確には起動が予約された状態で
それ以上進まず止まっている(stop/prestart)
のような状態に見えます。
#ps ax | grep vsftpdで以下のような表示が返ってきます。
1706 pts/0 S+ 0:00 grep --color=auto vsftpd
ファイアウォールは外していますが、
プロセスが起動できないこの他の理由がお分かりになりましたら
教えていただけませんでしょうか。
オフライン
直感的には、 ssl_enable=YES しているのに証明書ファイルがない、ということは無いでしょうか。
手元でラフに試してみた限り、(有効な証明書がない状態で?)この行が入ると同じ症状になってしまうようです。
それはそれとして「どう設定するべきか」の部分がうまく解釈できなかったのですが、このFTPサーバーが備えるべき要件はどのようなものなのでしょうか?
オフライン
ご回答ありがとうございます。
vsftpd.conf を ssl_enable=NO にすると vsftpd サービスの起動に成功 (start/runningを表示) しましたが、
vsftpd.conf を ssl_enable=YES に戻すと再び vsftpd サービスの起動に成功しませんでした (start/prestart でrunningに至らない)。
SSL証明書は、
make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/private/vsftpd.pem
chown root:ssl-cert /etc/ssl/prvate/vsftpd.pem
chmod 640 /etc/ssl/private/vsftpd.pem
を実行して作成しています。
/etc/ssl/private/vsftpd.pem
を削除し、上記手順で再作成後、vsftpd.conf を ssl_enable=YES にして vsftpd サービスを起動しようとしましたが、やはり起動に至りませんでした。
また、ssl_enable=NO だと起動しました。
適切なSSL証明書の再作成方法を知りたいです。
一般ユーザにImplicitモードでのSSLでFTPログインのみを許容し、ユーザごとのホーム・ディレクトリ配下にファイル・アップロード、ファイル・ダウンロード、ファイル編集、ディレクトリ作成、ディレクトリ削除等を許容する利用者アクセス制御を目指したいと考えております。
オフライン
SSL証明書作成方法は
http://www005.upp.so-net.ne.jp/develop-tom/deb/vsftpd-deb.html
を参照しました。
有効なSSL証明書の再作成方法をご存知でしたら
教えていただけますと有り難く存じます。
オフライン
ykobayashi による投稿:
make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/private/vsftpd.pem
chown root:ssl-cert /etc/ssl/private/vsftpd.pem
chmod 640 /etc/ssl/private/vsftpd.pem
された、ということなのですが、/etc/ssl/private/vsftpd.pemはPRIVATE KEYとCERTIFICATEがともに含まれたファイルになっています。ということは、
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/pvivate/ssl-cert-snakeoil.key
と指定すると、証明書とキーのペアがマッチしていない気がします。
rsa_cert_file=/etc/ssl/private/vsftpd.pem rsa_private_key_file=/etc/ssl/private/vsftpd.pem
でいいように見えます。
# あとrsa_private_key_file のパス名が「pvivate」になっています。
まずこの状態で、SFTPアクセスができるかテストしてから先に進むのが良さそうです。
オフライン
ご指摘大変ありがとうございます。
/etc/vsftpd.conf の
rsa_private_key_file=/etc/ssl/pvivate/ssl-cert-snakeoil.key
を
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
に変えてvsftpdサービスを起動しなおしたところstart/runningが表示され
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 0 1994 1871 20 0 8104 924 pipe_w S+ pts/1 0:00 grep --color=auto vsftpd
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 869/vsftpd
FTPのサービスは起動に成功したようです。
FTPユーザによるSSL(Implicit)接続を試みようとしています。
オフライン
Sat Oct 12 00:46:49 2013 [pid 2] FTP response: Client "xxx.xx.xxx.xxx", "220 (vsFTPd 2.3.5)"
Sat Oct 12 00:46:49 2013 [pid 2] FTP command: Client "xxx.xx.xxx.xxx", "USER 作成したユーザ"
Sat Oct 12 00:46:49 2013 [pid 2] [作成したユーザ] FTP response: Client "xxx.xx.xxx.xxx", "331 Please specify the password."
Sat Oct 12 00:46:49 2013 [pid 2] [作成したユーザ] FTP command: Client "xxx.xx.xxx.xxx", "PASS <password>"
Sat Oct 12 00:46:52 2013 [pid 1] [作成したユーザ] FAIL LOGIN: Client "xxx.xx.xxx.xxx"
Sat Oct 12 00:46:53 2013 [pid 2] [作成したユーザ] FTP response: Client "xxx.xx.xxx.xxx", "530 Login incorrect."
Sat Oct 12 00:46:53 2013 [pid 2] DEBUG: Client "xxx.xx.xxx.xxx", "Connection terminated without SSL shutdown - buggy client?"
ftpユーザを作成しFTPプロセスの起動されたUbuntuサーバにftp接続した際のvsfptdログが上記です。
Sat Oct 12 00:46:53 2013 [pid 2] [作成したユーザ] FTP response: Client "xxx.xx.xxx.xxx", "530 Login incorrect."
はこのユーザに対するホーム・ディレクトリの設定が未完了なためかと思っています。
オフライン
目指す利用者アクセス制御(FTPユーザにSSL Implicit 接続を許容しユーザごとのホーム・ディレクトリにログインさせその配下のみを操作できるようにする)
を施すべくvsftpd.confを編集していたところ、再びvsftpd サービスがstart/prestartの状態からrunningに起動しなくなりました。
vsftpdのアンインストールと再インストールを次に試みようと思いますが、
設定内容のどこに問題があってプロセスが起動しないかがお分かりになりましたら教えていただきたく存じます。
-----------------------
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=002
dirmessage_enable=YES
use_localtime=NO
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=NO
log_ftp_protocol=YES
ascii_upload_enable=YES
ascii_download_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.user_list
local_root=/home/ftproot
ssl_enable=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES
implicit_ssl=YES
listen_port=21
pasv_max_port=60009
pasv_min_port=1024
userlist_deny=NO
pasv_promiscuous=YES
-----------------------
オフライン
vsftpdを設定ファイルごと削除し再インストールして設定しなおしましたがやはりプロセスが起動しません。
オフライン
$ sudo service vsftpd restart
の直後に、以下の様なログが出力されていませんか?
$ dmesg | tail か dmesg | grep vsftpd [ 1247.700290] init: vsftpd main process (2877) terminated with status 1 [ 1247.700391] init: vsftpd main process ended, respawning [ 1247.721674] init: vsftpd main process (2880) terminated with status 1 [ 1247.721778] init: vsftpd main process ended, respawning [ 1247.743187] init: vsftpd main process (2883) terminated with status 1 [ 1247.743294] init: vsftpd main process ended, respawning [ 1247.763240] init: vsftpd main process (2886) terminated with status 1 [ 1247.763329] init: vsftpd main process ended, respawning [ 1247.781065] init: vsftpd main process (2889) terminated with status 1 [ 1247.781145] init: vsftpd respawning too fast, stopped
コンフィグレーション(vsftpd.conf)に間違いがあると出力されたりします。
#9に投稿されているコンフィグレーションを見る限りスペルミスとかは無さそうですが、気になった所をコメント的に書いて見ました。
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=002
dirmessage_enable=YES
use_localtime=NO
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=NO
log_ftp_protocol=YES
ascii_upload_enable=YES
ascii_download_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list # 空でも作成する(パスとスペルミスに注意)
ls_recurse_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem # 既に助言されている様に、証明書と鍵が一体となっているので指定してもしなくても可
userlist_enable=YES
userlist_deny=NO # 重複設定されている(どちらか削除)
userlist_file=/etc/vsftpd.user_list # 作成済み?(パスとスペルミスに注意)
local_root=/home/ftproot # 作成済み?(パスとスペルミスに注意)
ssl_enable=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES
implicit_ssl=YES
listen_port=21 # implicitでは通常990?(クライアントの対応が必要だと思います)
pasv_max_port=60009
pasv_min_port=1024 # どのくらいのアクセスを想定してるのか不明ですが範囲が広すぎなのでは?
userlist_deny=NO # 重複設定されている(どちらか削除)
pasv_promiscuous=YES # manページには、やっている事を理解しているなら設定すると書いてある。
怪しいと思う所を1個づつコメントアウトして起動試験を繰り返すのも手かと思います。
設定ファイルのご確認およびご指摘誠にありがとうございます。
オフライン