Linux+vsftp+openssl實現ftp服務加密

2016年11月19日00:27:37 發表評論 5,938 ℃

首先需要關閉selinux

#setenforce 0 //臨時關閉,不需要重啟服務器

#vim /etc/sysconfig/selinux

把里邊的一行改為

SELINUX=disabled  //此方法重啟生效

1.創建CA認證機構

#cd /etc/pki/CA

#(umask 077; openssl genrsa -out private/cakey.pem)#生成一對密鑰

#openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3667 #生成自簽證書,然后填寫相關信息,后面生成證書頒發請求時候填寫的信息要一致。

Linux+vsftp+openssl實現ftp服務加密

#vim /etc/pki/tls/openssl.cnf  #編輯此文件

找到[ CA_default ]

將下面的 dir             = ../../CA 

改成絕對路徑: dir         = /etc/pki/CA 

#mkdir certs crl newcerts

#touch index.txt

#echo 00 > serial  //設置序列號

2、安裝vsftpd

#yum install -y vsftpd

3、創建密鑰

#mdkir /etc/vsftp/ssl

#cd /etc/vsftpd/ssl

#(umask 077; openssl genrsa 1024 >ftp.amd5.key) // 創建一對1024位長度的密鑰

#openssl req -new -key ftp.amd5.key -out ftp.amd5.csr //生成證書頒發請求此處填寫的信息要和前面CA生成自簽證書時候填寫的信息要一致

#openssl ca -in ftp.amd5.csr -out ftp.amd5.crt -days 3655  //簽署此證書10年的有效期

4、配置vsftp.conf

#vim /etc/vsftpd/vsftp.conf

在文檔尾部添加:

    # ssl or tls

    ssl_enable=YES

    ssl_sslv3=YES

    allow_anon_ssl=NO

    force_local_data_ssl=YES

    force_local_logins_ssl=YES

    rsa_cert_file=/etc/vsftpd/ssl/ftp.amd5.crt

    rsa_private_key_file=/etc/vsftpd/ssl/ftp.amd5.key

#useradd -s /sbin/nologin -d /tmp/tom tom

#echo "12344321" | passwd --stdin tom

#/ect/init.d/vsftpd restart

vsftpd詳細設置,可以參考阿湯博客教程:Centos環境下安裝配置vsftpd

5、使用flashfxp工具連接測試

Linux+vsftp+openssl實現ftp服務加密

Linux+vsftp+openssl實現ftp服務加密

Linux+vsftp+openssl實現ftp服務加密

Linux+vsftp+openssl實現ftp服務加密

【騰訊云】云服務器、云數據庫、COS、CDN、短信等云產品特惠熱賣中

發表評論

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: