實現基于 SSL 的 FTPS
查看是否支持SSL
ldd `which vsftpd` #查看到libssl.so
范例:
[root@centos8 ~]#ldd `which vsftpd`|grep libssl
libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f8878e2c000)
創建自簽名證書
#CentOS 7 上可以實現直接生成一個包括私鑰和證書的文件
[root@centos7 ~]#cd /etc/pki/tls/certs/
[root@centos7 ~]#make vsftpd.pem
[root@centos7 ~]#openssl x509 -in vsftpd.pem -noout –text
#在CentOS8上手動分別生成一個證書和私鑰文件,再合并成一個文件
[root@centos8 ~]#mkdir /etc/vsftpd/ssl
[root@centos8 ~]#cd /etc/vsftpd/ssl
[root@centos8 ssl]#
openssl req -x509 -nodes -keyout vsftpd.key -out vsftpd.crt -days 365 -newkey rsa:2048
[root@centos8 ssl]#cat vsftpd.crt vsftpd.key > vsftpd.pem
配置vsftpd服務支持SSL:
[root@centos8 ~]#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/pki/tls/certs/vsftpd.pem #一個包括證書和私鑰兩個內容的文件
#rsa_private_key_file /path/file #此項如果沒有指定,私鑰也在證書文件中
#ssl_tlsv1=YES
#ssl_sslv2=NO
#ssl_sslv3=NO
#require_ssl_reuse=NO
#ssl_ciphers=HIGH
[root@centos8 ~]#systemctl restart vsftpd
[root@centos7 ~]#ftp 192.168.100.8
Connected to 192.168.100.8 (192.168.100.8).
220-welcome to magedu
220
Name (192.168.100.8:root): wang
530 Non-anonymous sessions must use encryption.
Login failed.
421 Service not available, remote server has closed connection
#用filezilla等工具測試
本文鏈接:http://www.thecarconnectin.com/35979.html
網友評論comments