vm安装centos7_CentOS7下vsftpd over SSL/TLS加密传输配置实践

699a7dc2d7f9e411c0e2ba94ff7da3d1.png

之前有介绍过CentOS下搭建vsftpd服务器,可以参考如下文章

CentOS7下搭建vsftpd服务器(本地用户模式)

下面开启SSL/TLS用于FTP安全加密传输

1、生成自签证书

cd /etc/pki/tls/certs/
openssl req -x509 -nodes -newkey rsa:2048 -keyout vsftpd.pem -out vsftpd.pem -days 365
[root@VM_Server ~]# cd /etc/pki/tls/certs/
[root@VM_Server certs]# ll
total 12
lrwxrwxrwx. 1 root root   49 Jan  4  2020 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
lrwxrwxrwx. 1 root root   55 Jan  4  2020 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
-rwxr-xr-x. 1 root root  610 Oct 31  2018 make-dummy-cert
-rw-r--r--. 1 root root 2516 Oct 31  2018 Makefile
-rwxr-xr-x. 1 root root  829 Oct 31  2018 renew-dummy-cert
[root@VM_Server certs]# openssl req -x509 -nodes -newkey rsa:2048 -keyout vsftpd.pem -out vsftpd.pem -days 365 
Generating a 2048 bit RSA private key
................+++
...........................+++
writing new private key to 'vsftpd.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]:CN
State or Province Name (full name) []:ZheJiang
Locality Name (eg, city) [Default City]:HangZhou      
Organization Name (eg, company) [Default Company Ltd]:WalkingCloud
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:ftp.walkingcloud.cn
Email Address []:yuanfan@walkingcloud.cn
[root@VM_Server certs]# ll
total 16
lrwxrwxrwx. 1 root root   49 Jan  4  2020 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
lrwxrwxrwx. 1 root root   55 Jan  4  2020 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
-rwxr-xr-x. 1 root root  610 Oct 31  2018 make-dummy-cert
-rw-r--r--. 1 root root 2516 Oct 31  2018 Makefile
-rwxr-xr-x. 1 root root  829 Oct 31  2018 renew-dummy-cert
-rw-r--r--  1 root root 3176 Aug  8 09:01 vsftpd.pem

0a9bc3ccb6febaae39f1dfa3ec2b9ad4.png

然后拷贝证书

cd /etc/vsftpd/
cp /etc/pki/tls/certs/vsftpd.pem ./
chmod 600 vsftpd.pem

6ff448a5770da635c533f2a4e98d8dd0.png

2、配置vsftpd.conf

vi /etc/vsftpd/vsftpd.conf 添加如下参数

# enable TLS
rsa_cert_file=/etc/vsftpd/vsftpd.pem
ssl_enable=YES
ssl_ciphers=HIGH
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES

1b157c480b5b7dae57cd9bb5c2e0b37d.png

3、重启vsftpd服务,安装lftp客户端工具测试

service vsftpd restart
yum install -y lftp
lftp -u yuanfan 192.168.31.80

522c825264543b65d724b672eb8aa61d.png

09c5ce24e3486a478c4c89a663e7819e.png

2590e5e91308dead05d432075cc3feb1.png

4、windows下使用Filezilla FTP客户端连接

22e15d12c0e8ad3ba0b55c5e84e289dd.png

fd41ba995d947c634cec5862604764ad.png

c995f1c87272de93664800ec906489f0.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值