首页 » 谷歌 » 谷歌身份验证器生成的是动态验证码,并关闭2.安装依赖软件包

谷歌身份验证器生成的是动态验证码,并关闭2.安装依赖软件包

 

一般大家都是使用账号和密码通过SSH远程登录管理服务器的。但是,SSH 账号和密码很容易被泄露,或者经常被暴力破解。咨询了目前正在使用 的前同事 Sai Sai。查看 的 URL 和其他在线文档以重新组织。

生成动态验证码,默认 30 秒更新一次。修改配置,SSH登录必须输入动态验证码才能输入密码。即使账号密码泄露,验证码输入错误,仍然无法登录。苹果或安卓手机可以安装验证器App读取验证码。

1.禁用并关闭

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/configsetenforce 0

2.安装依赖包

yum -y install gcc make pam-devel libpng-devel libtool wget git

3.添加阿里云epel源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

谷歌账号登录验证身份_谷歌账号电话无法验证_谷歌浏览器不能登录谷歌账号

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

4.安装, 需要调用这个程序让终端生成并显示二维码

yum -y install qrencode

5.安装谷歌验证器

mkdir -p /App/src
cd /App/src
git clone 
cd google-authenticator/libpam/
./bootstrap.sh
./configure
make
make install
cp .libs/pam_google_authenticator.so /lib64/security/

6./etc/pam.d/sshd 第一行后添加 PAM模块配置

auth       required     pam_google_authenticator.so

谷歌账号登录验证身份_谷歌浏览器不能登录谷歌账号_谷歌账号电话无法验证

7.修改SSH服务配置/etc/ssh/

sed -i 's#^ChallengeResponseAuthentication no#ChallengeResponseAuthentication yes#' /etc/ssh/sshd_config

8.重启SSH服务

service sshd restart

systemctl restart sshd.service

9.终端切换到需要二次认证的系统用户,运行认证器程序-,遇到(y/n)可以输入y,为每个需要远程SSH登录的用户生成一个动态密码

Do you want authentication tokens to be time-based (y/n) y
https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/[email protected]%3Fsecret%3DX3PYDDGPI4BF3DMIVTZ33IRQI4%26issuer%3Dlocalhost.localdomain
二维码
Your new secret key is: X3PYDDGPI4BF3DMIVTZ33IRQI4
Your verification code is 318806
Your emergency scratch codes are:
  34181847
  33327793
  54307163
  36901756
  21117069
Do you want me to update your "/home/songsong/.google_authenticator" file (y/n) y
Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) y
By default, tokens are good for 30 seconds. In order to compensate for
possible time-skew between the client and the server, we allow an extra
token before and after the current time. If you experience problems with
poor time synchronization, you can increase the window from its default
size of +-1min (window size of 3) to about +-4min (window size of
17 acceptable tokens).
Do you want to do so? (y/n) y
If the computer that you are logging into isn't hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting (y/n) y

10.苹果手机打开App Store搜索,安卓手机打开App Store搜索验证器,安装对应App

11.打开手机上安装好的app点击开始设置

使用谷歌身份验证器增强SSH安全_ssh

12.点击扫描条码,扫描终端显示的二维码。需要安装专用条码扫描器,微信和电报扫二维码都不行

使用谷歌身份验证器增强SSH安全_ssh_02

13.修改连接属性,右键选择已有的主机连接谷歌账号登录验证身份,在新弹窗点击SSH2,将中的顺序调整到第一行

使用谷歌身份验证器增强SSH安全_linux_03

终端运行验证器程序——内容描述:

Do you want authentication tokens to be time-based (y/n)

输入y生成基于时间的鉴权密码,输入n生成计数器模式的鉴权密码。

https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/[email protected]%3Fsecret%3DX3PYDDGPI4BF3DMIVTZ33IRQI4%26issuer%3Dlocalhost.localdomain

显示二维码图片的地址,需要尝试能访问谷歌,可以使用×××,或者找到没有被中国防火墙屏蔽的谷歌公网IP地址,然后修改系统主机文件地址映射。

二维码

如果未安装,将不会显示二维码。

Your new secret key is: X3PYDDGPI4BF3DMIVTZ33IRQI4

如果二维码不显示,生成的谷歌二维码图片地址无法访问,进入移动终端认证设备设置,点击输入提供的密钥,填写运行程序的账户名和符号:下面的 key 可以达到同样的效果。

使用谷歌身份验证器增强SSH安全_linux_04

Your verification code is 318806

临时生成的6位验证码,默认30秒过期。

Your emergency scratch codes are:
  34181847
  33327793
  54307163
  36901756
  21117069

生成的5组应急备用验证码谷歌账号登录验证身份,每个验证码只能使用一次,使用后立即失效。重复使用后手机APP显示的验证码失效时使用,保存备用。

防范措施:

如果使用默认的基于时间的方式生成动态密码,请确保安装谷歌验证器的服务器时间与手机系统时间一致,否则无法登录系统。因此,服务器和手机系统会定期同步公网暴露的时间服务器,以保证两者时间一致。

谷歌锁区号/谷歌邮箱老号-购买商城
谷歌play地区代改
Google Voice号码支持自助购买
谷歌锁区号购买商城]
如果您还有其他问题可以加我电报交流。
电报号:telegram:@tianmeiapp
需要解决问题的人很多,为了更好的处理网友的问题
>拒绝白嫖
>劝君莫做伸手党
>不要下次一定

原文链接:谷歌身份验证器生成的是动态验证码,并关闭2.安装依赖软件包,转载请注明来源!

0