搭建支持SSL加密传输的vftpd
阅读原文时间:2023年07月08日阅读:1

让vsftpd支持SSL

必须让OPENSSL≥0.9.6版本还有就是本身vsftpd版本是否支持

查询vsftpd软件是否支持SSL       
[root@localhost vsftpd]# ldd /usr/sbin/vsftpd |grep libssl        
        libssl.so.6 => /lib/libssl.so.6 (0xf7f27000)   == 说明此版本支持

如没有输出libssl.so.6 => /lib/libssl.so.6 (0xf7f27000)类似文本,说明此vsftpd版本不支持SSL

生成CA的公钥和私钥文件,有效期10年(RSA 1024bits)。

[root@localhost ~]# openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/vsftpd/vsftpd.pem -out

Generating a 1024 bit RSA private key
………………………………………………………++++++
………..++++++
writing new private key to '/etc/vsftpd/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]:                                                     #国家
State or Province Name (full name) []:                                                 #省份
Locality Name (eg, city) [Default City]:                                               #城市
Organization Name (eg, company) [Default Company Ltd]:                            #单位名称
Organizational Unit Name (eg, section) [ ]:                                             #部门
Common Name (eg, your name or your server's hostname) [ ]:192.168.159.136     #域名/主机名/IP地址
Email Address [ ]:                                                                        #邮件地址

注意:域名/主机名/IP地址这块需要填写你主机的真实信息。

编辑Vsftpd的配置文件,添加SSL支持。(中间不能有空格,否则会报错)

ssl_enable=YES                               #启用SSL支持
force_local_logins_ssl=YES                #对本地用户登录启用ssl加密
force_local_data_ssl=YES                  #对本地用户数据传输启用ssl加密
rsa_cert_file=/etc/vsftpd/vsftpd.pem   #RSA密钥文件保存位置
ssl_tlsv1=YES                                #启用TLS V1加密
ssl_ciphers=HIGH                          #启用高级加密方式,若不启用此项,会导致Filezilla报错
pam_service_name=vsftpd                 #不加这个linux下lftp无法连接


主动模式&被动模式图例

主动

被动

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章