网站优化报告,哈国际现货交易平台,惠州网站建设公司曾,网站建设合同 简单要求如下#xff1a; 一个小时内#xff0c;连续密码错误4次。 Linux lastb 命令用于列出登入系统失败的用户相关信息。 实验过程如下#xff1a; 1. 创建两个IP地址不同的干净环境#xff0c;分别是#xff1a;192.168.46.101 Rocky 2 和 192.168.46.120 openEuler 2. 2.… 要求如下 一个小时内连续密码错误4次。 Linux lastb 命令用于列出登入系统失败的用户相关信息。 实验过程如下 1. 创建两个IP地址不同的干净环境分别是192.168.46.101 Rocky 2 和 192.168.46.120 openEuler 2. 2. 在192.168.46.101 Rocky 2上使用ssh远程登录并且4次输错密码创建实验环境。 [rootlocalhost ~]# ssh root192.168.46.120
The authenticity of host 192.168.46.120 (192.168.46.120) cant be established.
ED25519 key fingerprint is SHA256:0yjHp21zOpFhOEawwT35iA0huZMZTxvnVnCn28UUI3Y.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 192.168.46.120 (ED25519) to the list of known hosts.Authorized users only. All activities may be monitored and reported.
root192.168.46.120s password:
Permission denied, please try again.
root192.168.46.120s password:
Permission denied, please try again.
root192.168.46.120s password:
root192.168.46.120: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
[rootlocalhost ~]# ssh root192.168.46.120Authorized users only. All activities may be monitored and reported.
root192.168.46.120s password:
Permission denied, please try again.
root192.168.46.120s password:
Permission denied, please try again.
root192.168.46.120s password:
root192.168.46.120: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
[rootlocalhost ~]#
[rootlocalhost ~]#在192.168.46.120 openEuler 2上进行查看。-- linux系统SSH 登录失败的内容会记录到/var/log/secure文件。 发现实验环境已经创建成功 3. 根据题目编写shell脚本。 --- 在192.168.46.120 openEuler 2上的/mnt/目录下创建deny_ip_v2.sh 编写脚本。 #!/bin/bashlastb | egrep -v ^btmp|^$|Fri | awk {IP[$3]} END {for (k in IP)if (IP[k]4) print k} deny_ip.txtwhile read line
doiptables -L -n | tr -s | awk -F[ :] /^DROP/ $NF22 {print $4} | sort -u temp_ip.txtif ! grep -w $line temp_ip.txt /dev/nulltheniptables -I INPUT -p tcp --dport 22 -s $line -j DROPfidone deny_ip.txtrm -f deny_ip.txt temp_ip.txt4. 进行测试 在192.168.46.101 Rocky 2上进行登录发现登陆失败。 到此试验结束