FTP サーバー : Vsftpd over SSL/TLS2025/11/27 |
|
Vsftpd を SSL/TLS で利用できるように設定します。 |
|
| [1] | 自己署名の証明書を作成します。 Let's Encrypt 等の信頼された正規の証明書を使用する場合は当作業は不要です。 |
|
www:~ # cd /etc/ssl/private www:/etc/ssl/private # openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp384r1) -keyout vsftpd.pem -out vsftpd.pem -days 3650 ----- 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 # 管理者アドレスwww:/etc/ssl/private # chmod 600 vsftpd.pem |
| [2] | Vsftpd の設定です。事前にこちらを参照して基本的な設定を実施しておきます。 |
|
www:~ #
vi /etc/vsftpd.conf # 195行目 : SSL/TLS 有効化 ssl_enable=YES rsa_cert_file=/etc/ssl/private/vsftpd.pem dsa_cert_file=/etc/ssl/private/vsftpd.pem force_local_data_ssl=YES force_local_logins_ssl=YESwww:~ # systemctl restart vsftpd |
| [3] | Firewalld を有効にしている場合は、パッシブポートの許可が必要です。 |
|
www:~ #
vi /etc/vsftpd.conf # 204行目 : 追記 pasv_min_port=30000 pasv_max_port=30100 pasv_enable=YES
www:~ #
systemctl restart vsftpd
# 固定したパッシブポートを許可 www:~ # firewall-cmd --add-port=30000-30100/tcp success www:~ # firewall-cmd --runtime-to-permanent success |
FTP クライアント : SUSE |
|
FTP クライアントの設定です。 |
|
| [4] | FTP クライアントインストール済みを前提として、以下のように追加設定して FTPS に接続します。接続後は通常通りの操作でファイル転送可能です。 |
|
suse@node01:~>
vi ~/.lftprc # create new 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 nosuse@node01:~> lftp -u suse www.srv.world Password: lftp suse@www.srv.world:~> |
FTP クライアント : Windows |
| [5] | Windows にインストールした FileZilla での FTPS 接続の設定です。 [ファイル] - [サイトマネージャ] を開きます。 |
|
| [6] | [新しいサイト] ボタンをクリックし、サーバーに接続する情報を入力して接続します。[暗号化] には [明示的な FTP over TLS を使用] を選択します。 |
|
| [7] | 自己署名の証明書の場合は以下のような警告が表示されますが、問題はないので [OK] ボタンをクリックして先へ進めます。 |
|
| [8] | 設定に問題なければ以下のように接続できます。問題なくファイル転送ができるか等々確認しておくとよいでしょう。 |
|
| Sponsored Link |
|
|