惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
I
InfoQ
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
博客园_首页
罗磊的独立博客
V
V2EX
李成银的技术随笔
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
True Tiger Recordings
Vercel News
Vercel News
Cyberwarzone
Cyberwarzone
Cisco Talos Blog
Cisco Talos Blog
F
Fox-IT International blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
M
Microsoft Research Blog - Microsoft Research
Know Your Adversary
Know Your Adversary
爱范儿
爱范儿
The Register - Security
The Register - Security
G
Google Developers Blog
The Hacker News
The Hacker News
Malwarebytes
Malwarebytes
S
Securelist
博客园 - 三生石上(FineUI控件)
Jina AI
Jina AI
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
SegmentFault 最新的问题
博客园 - 叶小钗
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
博客园 - 聂微东
T
Threatpost
博客园 - 【当耐特】
D
Docker
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
V
Visual Studio Blog
C
Cisco Blogs
IT之家
IT之家
S
Security Archives - TechRepublic
Latest news
Latest news
阮一峰的网络日志
阮一峰的网络日志

叶泯希

海的那边,真的是自由吗? | 叶泯希 放学打球 因 LeanCloud 停止对外服务,对数据迁移至 Vercel 。 2025:得与失 世事无常,珍惜眼前 “花怎么会落呢” “世界充满分歧,所以要学会尊重别人” “死亡不是永别,遗忘才是” “爱就像蓝天白云晴空万里突然暴风雨” | 叶泯希 “小雨天气” | 叶泯希 快下雨,别打雷了,赶紧的,热! 寄博客一周年 出门不要摔跤容易烫伤 Windows 安装 Docker 部署 Immich 主题魔改——Solitude主题 自定义表盘导航软件——对小米手环9的折腾 | 叶泯希 武汉之旅 | 叶泯希 关于我在2024年做了这件事... | 叶泯希 2024.11.24 | 叶泯希 他乡纵有当头月,不及家乡一盏灯 | 叶泯希 Vercel+Aiven 自建Umami统计 | 叶泯希 侧边栏——Solitude主题 | 叶泯希 弹幕留言板——Solitude主题 | 叶泯希 2024.11.13 | 叶泯希 2024.11.12 | 叶泯希 好像还没写过日常 | 叶泯希 给自己的网站加上Do you like me 小组件 网站数据库中表的设计 | 叶泯希 听山河把春风酿成千言万语吹过旧人故里 | 叶泯希 网站页面规划设计 | 叶泯希 你出现又幻灭是错觉 | 叶泯希 网站功能设计 | 叶泯希 •ᴗ• | 叶泯希 相机喜欢镜头前的每一个故事 | 叶泯希 白茶记异品,天曹玉玲珑 | 叶泯希 岁月的年轮,再诚恳。也渡不过红尘《宿命》 | 叶泯希 云朵偷喝了酒,于是映红了半边天。 | 叶泯希 用太多的精力因为上天自有安排 | 叶泯希 我一脚踏空,我就要飞起来了。 | 叶泯希 日落是永远拍不完的浪漫 | 叶泯希 风吹过我的头发 | 叶泯希 童话里的王国住着巫婆 | 叶泯希 “晚风吹起你鬓间的白发” | 叶泯希 人性的背后都是白云苍狗 | 叶泯希 蒲公英的约定 | 叶泯希 我捡到过一束光,日落时还给了太阳。 | 叶泯希 去拥抱陌生,期待惊喜,所有的不期而遇都在 | 叶泯希 人生天地间,忽如远行客 | 叶泯希 少年的征途应是星辰大海,而非烟尘人间 | 叶泯希 数据库表结构 | 叶泯希 第八章 Centos 7 Linux配置mariadb 实训任务:部署数据库 第六章 Centos 7 Linux配置web 实训任务:Apache服务器部署 第五章 Centos 7 Linux配置dns 实训任务:部署DNS服务器 第四章 Centos 7 Linux配置dhcp 实训任务1:使用DHCP中继部署多子网环境 第三章 Centos 7 Linux配置samba 实训任务1:配置Samba服务 第二章_Centos 7 Linux配置ssh 实训任务:SSH的安全配置 | 叶泯希 第一章 VMware Workstation Pro 17安装Centos 7 安装虚拟机及简单配置 Hello World | 叶泯希
第七章 Centos 7 Linux配置ftp 实训任务1:FTP服务器加密传输
2024-05-28 · via 叶泯希

前言

==前面的DNS一定要成功才能做!!!==

实训任务1:FTP服务器加密传输 任务情境描述,某公司在需要使用vsftpd搭建一台FTP服务器,用于web站点资料的更新和公司公用文件的存放。为了保证客户机和服务器之间传输数据的保密性和完整性,公司决定使用SSL/TLS协议加固FTP服务器,客户机和服务器之间采用SSL/TLS协议加密数据。

虚拟机需求:1台DNS服务器(Server)、1台Web服务器(Ftp Server)、1台客户端(Client1)

在第五章的基础上继续实训

任务情境描述
某公司在需要使用vsftpd搭建一台FTP服务器,用于web站点资料的更新和公司公用文件的存放。为了保证客户机和服务器之间传输数据的保密性和完整性,公司决定使用SSL/TLS协议加固FTP服务器,客户机和服务器之间采用SSL/TLS协议加密数据。

任务要求:

1. 禁止使用不安全的FTP,请使用“CA”证书颁发机构,颁发的证书,启用FTPS服务;

Country Name (2 letter code) [XX]:CN
State or Province Name (fullname) []:GD
Locality Name (eg, city) [Default City]:GuangZhou
Organization Name (eg, company) [Default Company Ltd]:mydomain.com
Organizational Unit Name (eg, section) []:Operations Departments
Common Name (eg, your name or your server’s hostname)[]:ftp.mydomain.com

2. 使用ftp.mydomian.com域名访问服务器;

3. 用户webadmin,登录ftp服务器,根目录为/webdata/;

4. 登录后限制在自己的根目录;

5. 允许WEB管理员上传和下载文件,但是禁止上传后缀名为.doc .docx .xlsx的文件;

6. 限制用户的下载最大速度为100kb/s;最大同一IP在线人数为2人;

7.用于通过工具或者浏览器下载的最大速度不超过100kb/s;

8. 一个IP地址同时登陆的用户进程/人数不超过2人。

一、配置Ftp服务器(Ftp Server)的IP地址

1
2
3
4
5
6
BOOTPROTO=static
IPADDR=192.168.1.100
GATEWAY=192.168.1.2
NETMASK=255.255.255.0
DNS1=192.168.1.10
DNS2=202.96.128.86

二、 为Ftp服务器(Ftp Server)安装vsftp服务

1
2
3
yum -y install vsftpd //安装vsftp服务
systemctl start vsftpd //开启vsftp服务
systemctl enable vsftpd //开机自启

三、Ftp服务器(Ftp Server)生成证书

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
创建目录[root@webserver webserver]# mkdir /etc/ssl/serverkey
生成证书[root@webserver webserver]# openssl req -x509 -nodes -keyout /etc/ssl/serverkey/vsftpd.pem -out /etc/ssl/serverkey/vsftpd.pem -days 365 -newkey rsa:2048
Generating a 2048 bit RSA private key
................+++
.....+++
writing new private key to '/etc/ssl/serverkey/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) [CN]:
State or Province Name (full name) [China]:GD
Locality Name (eg, city) [GuangZhou]:
Organization Name (eg, company) [ymx.com]:
Organizational Unit Name (eg, section) []:Operations Departments
Common Name (eg, your name or your server's hostname) []:ftp.ymx.com
Email Address []:
[root@webserver webserver]#

图片打反了 别按照图片 按上面的文本

四、 Ftp服务器(Ftp Server)防火墙设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
允许ftp通过[root@webserver webserver]# firewall-cmd --permanent --zone=public --add-service=ftp
success
允许端口通过[root@webserver webserver]# firewall-cmd --permanent --zone=public --add-port=990/tcp
success
允许端口通过[root@webserver webserver]# firewall-cmd --permanent --zone=public --add-port=990/udp
success
允许端口通过[root@webserver webserver]# firewall-cmd --permanent --zone=public --add-port=40000-50000/tcp
success
允许端口通过[root@webserver webserver]# firewall-cmd --permanent --zone=public --add-port=40000-50000/udp
success
重启防火墙[root@webserver webserver]# firewall-cmd --reload
success
[root@webserver webserver]#

五、 Ftp服务器(Ftp Server)配置vsftp文件

1
vim /etc/vsftpd/vsftpd.conf

最后插入

1
2
3
4
5
6
7
8
9
10
11
12
ssl_enable=yes
ssl_tlsv1=yes
ssl_sslv2=no
ssl_sslv3=no
rsa_private_key_file=/etc/ssl/serverkey/vsftpd.pem
rsa_cert_file=/etc/ssl/serverkey/vsftpd.pem
allow_anon_ssl=no
force_local_logins_ssl=yes
force_local_data_ssl=yes
pasv_min_port=40000
pasv_max_port=50000
systemctl restart vsftpd //重启

图片打错了请按照上面文本打

六、创建用户和根目录以及虚拟用户(详情看学习通ftp虚拟用户章节 这里不做过多解释)

看不懂去看ppt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[root@webserver webserver]# useradd webadmin -s /sbin/nologin 
[root@webserver webserver]# useradd admin -s /sbin/nologin
[root@webserver webserver]# passwd --stdin webadmin
更改用户 webadmin 的密码 。
root
passwd:所有的身份验证令牌已经成功更新。
[root@webserver webserver]# passwd --stdin admin
更改用户 admin 的密码 。
root
passwd:所有的身份验证令牌已经成功更新。
[root@webserver webserver]# vim /etc/vsftpd/vusr.txt
webadmin
root
admin
root
[root@webserver webserver]# mkdir -p /var/ftp/pub/ /webdata
[root@webserver webserver]# chmod 777 /webdata
[root@webserver webserver]# chown webadmin /var/ftp/pub/ /webdata
[root@webserver webserver]# rpm -qf /usr/bin/db_load
libdb-utils-5.3.21-24.el7.x86_64
[root@webserver webserver]# db_load -T -t hash -f /etc/vsftpd/vusr.txt /etc/vsftpd/vusr.db
[root@webserver webserver]# file /etc/vsftpd/vusr.db
/etc/vsftpd/vusr.db: Berkeley DB (Hash, version 9, native byte-order)
[root@webserver webserver]# chmod 600 /etc/vsftpd/vusr.*
[root@webserver webserver]# cp -p /etc/pam.d/vsftpd /etc/pam.d/vsftpd-vusr
[root@webserver webserver]# vim /etc/pam.d/vsftpd-vusr
auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vusr
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vusr
[root@webserver webserver]# vim /etc/vsftpd/vsftpd.conf
local_enable=yes
chroot_local_user=yes
pam_service_name=vsftpd-vusr
guest_enable=yes
guest_username=webadmin
user_config_dir=/etc/vsftpd/vconfig
virtual_use_local_privs=yes
allow_writeable_chroot=yes
[root@webserver webserver]# mkdir /etc/vsftpd/vconfig/
[root@webserver webserver]# vim /etc/vsftpd/vconfig/webadmin
local_root=/webdata
[root@webserver webserver]# vim /etc/vsftpd/vconfig/admin
local_root=/webdata
write_enable=no
[root@webserver webserver]# setsebool -P ftpd_full_access on
[root@webserver webserver]# systemctl restart vsftpd

七、 使用域名登录要在Dns服务器(Dns Server)上正反向加上一条(略过)

八、任务需求后四项Ftp服务器(Ftp Server)上修改配置文件

1
2
3
4
5
6
7
8
9
10
vim /etc/vsftpd/vsftpd.conf

deny_file={*.doc,*.docx,*.xlsx}

local_max_rate=102400

max_per_ip=2

max_clients=2
systemctl restart vsftpd

九、客户端(client1)测试

1. 安装ftp服务和FileZilla

1
2
yum -y install epel-release
yum -y install filezilla

2. 创建测试文件

1
2
3
4
5
6
7
[root@client server]# mkdir /home/server/test /*server是我的用户名,看情况来*/
[root@client server]# chmod 777 /home/server/test
[root@client server]# cd /home/server/test/
[root@client test]# vim test.txt
[root@client test]# vim test.doc
[root@client test]# vim test.docx
[root@client test]# vim test.xlsx

3. 尝试域名带证书CA登录ftp





登录成功!

4. 尝试禁止上传文件类型上传


上传失败!

5. 尝试下载文件


成功!

6. 单IP多用户登录


最多只能2个不能再多了!

结尾

至此,实验结束。希望对你有所帮助,有任何问题请在下方留言。可以关注我的 公众号以及订阅我的文章 ,感谢你的支持,是对我最大的动力,当然了,更多的是因为热爱。

叶泯希

见过花开就好

赞赏作者

本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自叶泯希

最近发布