Fedora 28
Sponsored Link

FTPサーバー : Pure-FTPd Over SSL/TLS2018/05/09

 
Pure-FTPd を SSL/TLS で利用できるように設定します。
[1] 自己署名の証明書を作成します。Let's Encrypt 等の信頼された正規の証明書を使用する場合は当作業は不要です。
[root@www ~]#
cd /etc/pki/tls/certs

[root@www certs]#
openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/pki/tls/certs/pure-ftpd.pem -out /etc/pki/tls/certs/pure-ftpd.pem

Generating a 2048 bit RSA private key
.....+++
...................+++
writing new private key to '/etc/pki/tls/certs/pure-ftpd.pem'
-----
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) [XX]:JP   # 国コード
State or Province Name (full name) []:Hiroshima    # 地域(県)
Locality Name (eg, city) [Default City]:Hiroshima  # 都市
Organization Name (eg, company) [Default Company Ltd]:GTS  # 組織名
Organizational Unit Name (eg, section) []:Server World     # 組織の部門名
Common Name (eg, your name or your server's hostname) []:www.srv.world  # サーバーのFQDN
Email Address []:root@srv.world   # 管理者アドレス

[root@www certs]#
chmod 600 pure-ftpd.pem

[2] Pure-FTPd の設定です。 事前にこちらを参照して基本的な設定を実施しておきます
[root@www ~]#
vi /etc/pure-ftpd/pure-ftpd.conf
# 418行目:コメント解除

TLS       1
# 434行目:コメント解除して変更

CertFile      
/etc/pki/tls/certs/pure-ftpd.pem
[root@www ~]#
systemctl restart pure-ftpd

[3] Firewalld を有効にしている場合は FTP サービスの許可が必要です。
[root@www ~]#
vi /etc/pure-ftpd/pure-ftpd.conf
# 179行目:コメント解除して固定するPASVポート範囲を指定

PassivePortRange      
21000 21010
[root@www ~]#
systemctl restart pure-ftpd
[root@www ~]#
firewall-cmd --add-service=ftp --permanent

success
[root@www ~]#
firewall-cmd --add-port=21000-21010/tcp --permanent

success
[root@www ~]#
firewall-cmd --reload

success
FTPクライアント : Fedora
 
FTPクライアントの設定です。
[4] FTP クライアントインストール済みとして、Fedora クライアントの場合、以下のように設定して FTPS に接続します。接続後は通常通りの操作でファイル転送可能です。
[redhat@dlp ~]$
vi ~/.lftprc
# 新規作成

set ftp:ssl-auth TLS
set ftp:ssl-force true
set ftp:ssl-protect-list yes
set ftp:ssl-protect-data yes
set ftp:ssl-protect-fxp yes
set ssl:verify-certificate no
[redhat@dlp ~]$
lftp -u fedora www.srv.world

Password:
lftp fedora@www.srv.world:~>
FTPクライアント : Windows
[5] Windows にインストールした FileZilla での FTPS 接続の設定です。
[ファイル] - [サイトマネージャ] を開きます。
[6] 以下のようにサーバーに接続する情報を入力して接続します。[暗号化] には [明示的な FTP over TLS が必要] を選択します。
[7] 接続ユーザーのパスワードを入力します。
[8] 自己署名の証明書の場合、以下のような警告が表示されますが、問題ないので [OK] ボタンをクリックして先へ進めます。
[9] 接続できました。
関連コンテンツ