設定ファイルのSSLに関するディレクティブを編集
[root@centos ~] vi /etc/vsftpd/vsftpd.conf ssl_enable=YES ※SSLを有効化 rsa_cert_file=/etc/pki/tls/certs/vsftpd.pem ※サーバー証明書を指定 force_local_logins_ssl=NO ※ログイン時にSSLでの通信を強制しない場合 force_local_data_ssl=NO ※データ転送時にSSLでの通信を強制しない場合
サーバー証明書の作成
[root@centos ~]# cd /etc/pki/tls/certs/ [root@centos ~]# make vsftpd.pem umask 77 ; \ PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \ PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \ /usr/bin/openssl req -utf8 -newkey rsa:1024 -keyout $PEM1 -nodes -x509 -days 3650 -out $PEM2 -set_serial 0 ; \ cat $PEM1 > vsftpd.pem ; \ echo "" >> vsftpd.pem ; \ cat $PEM2 >> vsftpd.pem ; \ rm -f $PEM1 $PEM2 Generating a 1024 bit RSA private key .........++++++ .................................................................++++++ writing new private key to '/tmp/openssl.iG2783' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:JP ※国名 State or Province Name (full name) [Berkshire]:Tokyo ※都道府県名 Locality Name (eg, city) [Newbury]:Shinjuku ※市区町村名 Organization Name (eg, company) [My Company Ltd]:linuxserver.jp ※組織名 Organizational Unit Name (eg, section) []:admin ※組織の部署名 Common Name (eg, your name or your server’’s hostname) []:linuxserver.jp ※サーバーホスト名 Email Address []:webmaster@linuxserver.jp ※メールアドレス
vsftpdの再起動
[root@centos ~]# /etc/rc.d/init.d/vsftpd restart
※再起動後は、SSL接続に対応しているFTPクライアントソフトで動作確認を行う。