安全方向—第一次作业

一、作业要求

1 、大家新建虚拟机一( 2 ~3 ) 台
2 、一台用来搭建httpd 服务, ( 1 ~2 ) 台用来做客户端访问测试
3 、要求, 针对httpd 服务节进行安全防护配置, 要求能够让客户端访问页面, 但尽量不要被攻击。

二、项目要求(思路)

新建三台虚拟机,其中一台命名为localhost,用于建立http服务
另外的两台分别命名为client1和client2。client1用于访问端页面,但是不能进行ssh连接。client2用于模拟攻击localhost,localhost需要禁止client2的访问来防止client2的攻击

三、项目架构

  1. 新建三台虚拟机:localhost,client1和client2
  2. 三台虚拟机的IP地址为:locallhost:192.168.6.130 ;client1:192.168.6.131; client2:192.168.6.132
    在这里插入图片描述

四、执行方案

1、在localhost的/var/www/html/下新建index.html

		执行命令为:
		`[root@localhost html]# vi index.html
         [root@localhost html]# cat index.html 
         执行的结果为:

在这里插入图片描述

2、

	执行以下命令:
	[root@localhost firewalld]# cd /etc/firewalld/
	[root@localhost firewalld]# cd /etc/firewalld/services
	[root@localhost services]# firewall-cmd --list-all
	命令执行结果如下

请添加图片描述

3、添加并开启http服务

	执行以下命令:
	[root@localhost services]# systemctl start httpd
	[root@localhost services]# firewall-cmd --add-service=http --permanent
	[root@localhost services]# firewall-cmd reload
	执行结果如下:

在这里插入图片描述
在这里插入图片描述

4、阻塞client2的访问

	执行以下命令:
	[root@localhost services]# firewall-cmd --add-rich-rule="rule family='ipv4' source address='192.168.6.132' reject" --permanent
	[root@localhost services]# firewall-cmd --reload
	[root@localhost services]# firewall-cmd --list-all
	执行结果如下:

请添加图片描述
在这里插入图片描述
在这里插入图片描述

5、在client2端进连接localhost(192.168.6.130)操作

执行以下命令:
[root@client2 ~]# ping 192.168.6.130
[root@client2 ~]# ssh 192.168.6.130
[root@client2 ~]# curl 192.168.6.130
执行结果如下:

请添加图片描述

6、关闭client1(192.168.6.131)的ssh服务

执行以下命令:
[root@localhost services]# firewall-cmd --add-rich-rule="rule family='ipv4' source address='192.168.6.131' service name='ssh' reject" --permanent
[root@localhost services]# firewall-cmd --reload
[root@localhost services]# firewall-cmd --list-all
执行结果如下:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

7、client1(192.168.6.131)对localhost进行访问

执行以下命令:
[root@client1 ~]# curl 192.168.6.130
[root@client1 ~]# ssh 192.168.6.130
[root@client1 ~]# ping 192.168.6.130
执行结果如下:

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值