简介:

ftps是一种多传输协议,相当于加密版的FTP。当你在FTP服务器上收发文件的时候,你面临两个风险。第一个风险是在上载文件的时候为文件加密。第二个风险是,这些文件在你等待接收方下载的时候将停留在FTP服务器上,这时你如何保证这些文件的安全。你的第二个选择(创建一个支持SSL的FTP服务器)能够让你的主机使用一个FTPS连接上载这些文件。这包括使用一个在FTP协议下面的SSL层加密控制和数据通道。一种替代FTPS的协议是安全文件传输协议(SFTP)。这个协议使用SSH文件传输协议加密从客户机到服务器的FTP连接。

FTPS是在安全套接层使用标准的FTP协议和指令的一种增强型TFP协议,为FTP协议和数据通道增加了SSL安全功能。FTPS也称作“FTP-SSL”和“FTP-over-SSL”。SSL是一个在客户机和具有SSL功能的服务器之间的安全连接中对数据进行加密和解密的协议。

首先安装抓包工具:

[root@localhost ~]# yum list all |grep wireshark    搜索wireshark包

wireshark.i386                         1.0.8-1.el5_3.1       rhel-server       
wireshark-gnome.i386 (在桌面环境下)1.0.8-1.el5_3.1       rhel-server

安装包:wireshark

[root@localhost ~]# yum install -y wireshark

[root@localhost ~]# rpm -ql wireshark |less

实现抓包功能在:/usr/sbin/tshark

一定要启动vsftpd:service vsftpd start

[root@localhost ~]# tshark –ni eth0 –R “tcp.dsport eq 21”

在windows上的命令行模式下输入:

在linux上也可以登录:

ftps的步骤:

建立CA

[root@localhost ~]# cd /etc/pki/
[root@localhost pki]# ll
total 36
drwx------ 3 root root 4096 Feb  9 00:16 CA
drwxr-xr-x 4 root root 4096 Mar 20 10:27 dovecot
drwxr-xr-x 2 root root 4096 Feb  9 00:15 nssdb
drwxr-xr-x 2 root root 4096 Feb  9 00:15 rpm-gpg
drwxr-xr-x 5 root root 4096 Mar 20 19:37 tls
[root@localhost pki]# vim tls/openssl.cnf

[root@localhost pki]# cd CA   切换到CA目录
[root@localhost CA]# mkdir certs crl newcerts     创建3个目录
[root@localhost CA]# touch index.txt serial    创建2个文档
[root@localhost CA]# echo "01" >serial    赋予serial初始值
[root@localhost CA]# ll       查看
total 24
drwxr-xr-x 2 root root 4096 Mar 20 20:08 certs
drwxr-xr-x 2 root root 4096 Mar 20 20:08 crl
-rw-r--r-- 1 root root    0 Mar 20 20:08 index.txt
drwxr-xr-x 2 root root 4096 Mar 20 20:08 newcerts
drwx------ 2 root root 4096 Jun 30  2009 private
-rw-r--r-- 1 root root    3 Mar 20 20:09 serial
创建CA的私钥:

[root@localhost CA]# openssl genrsa 1024 >private/cakey.pem
Generating RSA private key, 1024 bit long modulus
..........++++++
.++++++
e is 65537 (0x10001)
创建CA的证书:

[root@localhost CA]# openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3650
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) [GB]:CN
State or Province Name (full name) [Berkshire]:BEIJING
Locality Name (eg, city) [Newbury]:BEIJING
Organization Name (eg, company) [My Company Ltd]:SECCENTER     
Organizational Unit Name (eg, section) []:tec
Common Name (eg, your name or your server's hostname) []:rootca.net.net
Email Address []:
[root@localhost CA]# ll
total 28
-rw-r--r-- 1 root root 1155 Mar 20 20:17 cacert.pem
drwxr-xr-x 2 root root 4096 Mar 20 20:08 certs
drwxr-xr-x 2 root root 4096 Mar 20 20:08 crl
-rw-r--r-- 1 root root    0 Mar 20 20:08 index.txt
drwxr-xr-x 2 root root 4096 Mar 20 20:08 newcerts
drwx------ 2 root root 4096 Mar 20 20:11 private
-rw-r--r-- 1 root root    3 Mar 20 20:09 serial
[root@localhost CA]# chmod 600 private/cakey.pem      更改钥匙权限
[root@localhost CA]# mkdir /etc/vsftpd/certs      创建目录
[root@localhost CA]# cd /etc/vsftpd/certs/     切换到目录
[root@localhost certs]# ll     查看
total 0
产生钥匙:

[root@localhost certs]# openssl genrsa 1024 >vsftpd.key      
Generating RSA private key, 1024 bit long modulus
...........++++++
.++++++
e is 65537 (0x10001)
根据钥匙做请求文件:

[root@localhost certs]# openssl req -new  -key vsftpd.key -out vsftpd.csr          
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) [GB]:CN    
State or Province Name (full name) [Berkshire]:HENAN
Locality Name (eg, city) [Newbury]:ZHENGZHOU
Organization Name (eg, company) [My Company Ltd]:zzdx
Organizational Unit Name (eg, section) []:tec
Common Name (eg, your name or your server's hostname) []:ftp.zzdx.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
根据钥匙请求文件得到证书:

[root@localhost certs]# openssl ca -in vsftpd.csr -out vsftpd.cert
Using configuration from /etc/pki/tls/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 1 (0x1)
        Validity
            Not Before: Mar 20 12:27:04 2012 GMT
            Not After : Mar 20 12:27:04 2013 GMT
        Subject:
            countryName               = CN
            stateOrProvinceName       = HENAN
            organizationName          = zzdx
            organizationalUnitName    = tec
            commonName                = ftp.zzdx.com

        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            Netscape Comment:
                OpenSSL Generated Certificate
            X509v3 Subject Key Identifier:
                54:FA:EA:A7:E0:8B:72:DF:57:37:4E:41:84:AA:BA:1A:AB:C4:B7:C9
            X509v3 Authority Key Identifier:
                keyid:8F:9B:34:8D:DA:DD:63:D5:0B:07:AF:F4:E4:E0:C9:6C:04:44:65:CC

Certificate is to be certified until Mar 20 12:27:04 2013 GMT (365 days)
Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated

[root@localhost certs]# ll     查看证书
total 12
-rw-r--r-- 1 root root 3075 Mar 20 20:27 vsftpd.cert
-rw-r--r-- 1 root root  647 Mar 20 20:23 vsftpd.csr
-rw-r--r-- 1 root root  887 Mar 20 20:19 vsftpd.key

[root@localhost certs]# chmod 600 *     更改证书的权限
[root@localhost certs]# ll
总计 12
-rw------- 1 root root 3075 03-21 11:01 vsftpd.cert
-rw------- 1 root root  647 03-21 10:57 vsftpd.csr
-rw------- 1 root root  887 03-21 10:52 vsftpd.key

ftp服务器+证书

[root@localhost certs]# vim /etc/vsftpd/vsftpd.conf

[root@localhost certs]# service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]

用户登陆:

[root@localhost ~]# tshark -ni eth0 -R "tcp.dstport eq 21"

转载于:https://blog.51cto.com/1184394769/811915

ftps(ftp+ssl)相关推荐

  1. Java实现文件上传到服务器(FTP方式)

    Java实现文件上传到服务器(FTP方式) 1,jar包:commons-net-3.3.jar 2,实现代码: //FTP传输到数据库服务器private boolean uploadServerB ...

  2. .NET 针对465加密端口 加密协议SSL(Implicit SSL)进行的邮件发送

    项目中遇到一个邮件发送功能,使用常用的的SmtpClient进行发送,在本地进行了126的邮箱进行测试通过,客户发来对应的邮箱信息后告知是使用的是465加密端口,SSL加密协议,再把相关信息进行配置替 ...

  3. FTP两种模式: 主动(FTP Port)模式和被动(FTP Passive)模式

    FTP(File Transfer Protocol)是文件传输协议的简称.正如其名所示:FTP的主要作用,就是让用户连接上一个远程计算机(这些计算机上运行着FTP服务器程序)察看远程计算机有哪些文件 ...

  4. 在Virtualbox环境下win10与虚拟机通过FileZilla传输文件(FTP传输)

    在Virtualbox环境下win10与虚拟机通过FileZilla传输文件(FTP传输) 使用FileZilla传输文件(FTP传输)好处 什么是FTP传输 需要的环境以及软件等 使用FileZil ...

  5. .Net框架集WebClient类向WinCE平台上传文件(FTP方式)延迟15秒释疑

    年前在做嵌入式组态时,有一个组态下载功能,该功能就是采用FTP上传功能把组态配置文件上传到触摸屏(WinCE4.2平台,已开FTP服务器)中的.所用到的指令就是WebClient类的UploadFil ...

  6. 基于Apache(without ssl)的svn环境搭建

    搭建的过程是按照tortersSVN的教程,特别注意的是要额外下载一个sspi的so文件. 提示:XP sp2已经还有了sp1 ps 遇到的问题,还是遇到了一些问题,网搜了下,列在这儿: 1.出现&q ...

  7. linux系统文件中转站(ftp服务)项目—实现在2台不同主机之间

    (1)写项目需用到的知识点和实现的功能: 1.linux系统编程:进程,文件,socket网络编程等 2.C语言编程:函数调用.字符串函数.结构体等 3.实现的功能: (1)获取服务端的文件:get ...

  8. 网络嗅探与欺骗(FTP部分)

    第三部分 FTP协议分析 1. 两个同学一组,A和B. 2.A同学架设FTP服务器,并设置用户名和密码,例如wbx /wbx 3.B同学在机器中安装Wireshark,并将其打开:之后用用户名和密码登 ...

  9. Linux FTP命令全集(ftp指令)

    hash是启用分段下载? hash是指散列的文件,FTP的下载并不是将文件的从前都后依次复制,而是为提高下载速率而分成很多小段同时复制,所以下载回来的文件是分成N段的,要重新整合成完整的文件,在下载工 ...

最新文章

  1. 提取图片名称 c 语言,【图片】给词法元素分析提取的程序跪了【c语言吧】_百度贴吧...
  2. 预编译头文件来自编译器的早期版本,或者预编译头为 C++ 而在 C 中使用它(或相反)
  3. [置顶] 状态压缩DP 简单入门题 11题
  4. javascript之Partial Application
  5. ubuntu 18.04可以连接内网,无法连接外网
  6. 未来五年,iOS 开发如何前行?
  7. php怎么代表不同行,php – 单击按钮时显示数据库的不同行
  8. spring boot框架学习2-spring boot核心(1)
  9. 手机窃取PC信息,APT基础。
  10. linux的I/O多路转接select的fd_set数据结构和相应FD_宏的实现分析
  11. asp.net + MVC5 入门完整教程一
  12. 通过url获取域名和协议,一级域名,二级域名 python
  13. 冶金矿山数字化价值链分析
  14. oracle alter database,alter database操作
  15. ml5.js入门二(介绍)+featureExtractor特征提取器
  16. 如何保持session一致性?
  17. java获取docx_java使用poi读取doc和docx文件的实现示例
  18. python Plot 画图用法
  19. Linux实现基于Loopback的NVI(NAT Virtual Interface)
  20. 立创eda学习笔记三十:布局传递

热门文章

  1. 如何正确看待LeCun工作调整?听听FAIR研究员们现身说法
  2. 下载安装 Ubuntu 19.04 “Disco Dingo”
  3. Vue实现简书导航栏效果
  4. Android 性能优化工具 TraceView 简单使用
  5. centos7.3 kvm虚拟化全自动化部署(0915金测OK)
  6. 服务器模型---总结
  7. openstack network
  8. 找出符合下图的互联网产品实例
  9. Linux负载均衡软件LVS(概念篇)
  10. gssapiauthentication