SSLを使用したファイルのやりとりを行う設定をします。
FTP通信をSSLで暗号化することによって、セキュアなファイル転送方式を取ることができます。
(1)サーバ証明書の作成を行う。
[root@example ~]# mkdir -p /etc/pki/ssl/certs [root@example ~]# cd /etc/pki/ssl/certs/ [root@example certs]# openssl md5 /usr/bin/* > rand.dat [root@example certs]# openssl genrsa -rand rand.dat -des3 2048 > server.key 42436 semi-random bytes loaded Generating RSA private key, 2048 bit long modulus ....................................+++ ........+++ e is 65537 (0x10001) Enter pass phrase: # 秘密鍵パスワード入力 Verifying - Enter pass phrase: # 秘密鍵パスワード入力 [root@example certs]# openssl req -new -key server.key -out server.csr Enter pass phrase for server.key: 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]:Shinagawa-ku # 市区町村 Organization Name (eg, company) [My Company Ltd]:hogehoge # 組織 Organizational Unit Name (eg, section) []:system1 # 部門 Common Name (eg, your name or your server's hostname) []:example.com # サーバのURL Email Address []: # Emailアドレス Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: # 不要 An optional company name []: # 不要 [root@example certs]# openssl x509 -in server.csr -out server.crt -req -signkey server.key Signature ok subject=/C=JP/ST=Tokyo/L=Shinagawa-ku/O=hogehoge/OU=system1/CN=example.com Getting Private key Enter pass phrase for server.key: 秘密鍵のパスワード [root@example certs]# openssl rsa -in server.key -out server.nopass.key Enter pass phrase for server.key: 秘密鍵のパスワード writing RSA key # パスワードを鍵に埋め込む [root@example certs]# cat server.nopass.key >> server.crt
(2)「vsFTPd」の設定変更を行う。
[root@example ~]# vi /etc/vsftpd/vsftpd.conf #--最終行にでも追加-- # SSL Setting. ssl_enable=YES # SSL通信を有効化 ssl_sslv3=YES # sslv3を有効化 rsa_cert_file=/etc/pki/ssl/certs/server.crt # サーバ証明書を指定 force_local_logins_ssl=YES # ログイン時にSSLを強制 force_local_data_ssl=YES # データ通信時にSSLを強制
(3)「vsFTPd」の再起動をする。
[root@example certs]# /etc/rc.d/init.d/vsftpd restart vsftpd を停止中: [ OK ] vsftpd 用の vsftpd を起動中: [ OK ]
(4)FTP over SSL/TLSが利用できるFTPクライアントソフトを利用して接続する。
対応ソフトでは、FileZillaがある。下記アドレスからダウンロードできる。
http://sourceforge.jp/projects/filezilla/releases/
1. FileZillaをダウンロードしたら、解凍して立ち上げる。

2. 必要情報を入力する。

・必要情報、設定
◎ホストIP or Domain
◎ポート番号 21
◎Encryption:は【Require explicit FTP over TLS】
◎ユーザー名とパスワードを入力し接続をクリックする。
3. オレオレ証明書のため警告が表示される。

必要であれば、「今後もこの証明書を常に信用する(A)」にチェックを入れてOKをクリックする。
これで、接続ができれば問題ありません。