FTP+SSL 實現Ftps
操作系統:Centos7 直接實現一個包括私鑰和證書的文件
首先安裝好vsftpd包 yum -y install vsftpd
ldd `which vsftpd` | grep libssl 查看是否支持SSL
[root@centos7-1 ~]$mkdir /etc/vsftpd/ssl
[root@centos7-1 ~]$cd /etc/pki/tls/certs/
[root@centos7-1 certs]$make /etc/vsftpd/ssl/vsftpd.pem
[root@centos7-1 certs]$ll /etc/vsftpd/ssl/vsftpd.pem
-rw------- 1 root root 3011 Sep 13 15:27 /etc/vsftpd/ssl/vsftpd.pem
[root@centos7-1 certs]$openssl x509 -in /etc/vsftpd/ssl/vsftpd.pem -noout -text
[root@centos7-1 ssl]$vim /etc/vsftpd/vsftpd.conf
ssl_enable=YES #啟用SSL
allow_anon_ssl=NO #匿名不支持SSL
force_local_logins_ssl=YES #本地用戶登陸加密
force_local_data_ssl=YES #本地用戶數據傳輸加密
rsa_cert_file=/etc/vsftpd/ssl/vsftpd.pem #一個證書和私鑰兩個的文件
[root@centos7-1 ssl]$systemctl restart vsftpd #重啟服務,生效配置文件
操作系統:Centos8 手動生成一個證書和私鑰文件,再合並成一個文件
首先安裝好vsftpd包 yum -y install vsftpd
ldd `which vsftpd` | grep libssl 查看是否支持SSL
[root@centos8-1 ~]$mkdir /etc/vsftpd/ssl
[root@centos8-1 ~]$cd /etc/vsftpd/ssl
[root@centos8-1 ssl]$openssl req -x509 -nodes -keyout vsftpd.key -out vsftpd.crt -days 365 -newkey rsa:2048
[root@centos8-1 ssl]$cat vsftpd.crt vsftpd.key > vsftpd.pem
[root@centos8-1 ssl]$vim /etc/vsftpd/vsftpd.conf
ssl_enable=YES #啟用SSL
allow_anon_ssl=NO #匿名不支持SSL
force_local_logins_ssl=YES #本地用戶登陸加密
force_local_data_ssl=YES #本地用戶數據傳輸加密
rsa_cert_file=/etc/vsftpd/ssl/vsftpd.pem #一個證書和私鑰兩個的文件
[root@centos8-1 ssl]$systemctl restart vsftpd #重啟服務,生效配置文件
使用工具連接測試