首页 > 编程知识 正文

双因子身份认证(authenticator安卓能用吗)

时间:2023-05-03 11:22:20 阅读:81555 作者:2953

说明:

在信息安全等级保护等级3的系统中,双因子认证登录是在主机安全身份认证模块中明确请求,同时使用两种以上的认证技术。

承运人的典型远程管理服务器使用的是ssh远程管理服务器,默认的ssh登录只需要输入帐户和密码就可以通过认证。 很明显,这种方式不能满足信息安全注册保护的双因素认证登录。 在这次实验中,您必须使用谷歌认证器(Google认证器)输入帐户和密码以添加动态验证码,然后输入正确的帐户、密码和动态验证码才能登录。 这样就实现了双因子认证登录。 谷歌认证器(Google认证器)的动态验证码从手机“freetop”app APP获取(缺省每30秒更新一次) ) )。

# #系统信息:

sysroot @ Ubuntu :至$ LSB _ release-a

sysroot @ Ubuntu :~$ cat/proc /版本

sysroot@ubuntu:~$ uname --m

# #依赖支持软件的安装

sysroot @ Ubuntu :~$ sudo apt-getinstallunzipautoconfautomakelibtoollibpam0g-dev build-Essentialqrencode

下载谷歌认证器的源代码

sysroot @ Ubuntu :~$ wget https://代码加载. github.com /谷歌/谷歌-身份验证/库/zip /主

谷歌认证器”解压源包

sysroot @ Ubuntu :至$ unzip master

进入解压目录

sysroot @ Ubuntu :~$ CD谷歌-身份验证器- libpam -主机/

sysroot @ Ubuntu :~~ /谷歌-身份验证器- libpam -主机$./bootstrap.sh

# #生成编辑文件

sysroot @ Ubuntu :~~ /谷歌-身份验证器- libpam -主机$./配置

# #编译源代码

sysroot @ Ubuntu :~~ /谷歌-身份验证器- libpam -主机$ make

安装“谷歌认证器”

sysroot @ Ubuntu :~~ /谷歌-身份验证器- libpam -主机$ Sudomakeinstall

# #生成动态验证码

# #在手机上安装“自由OTP”应用程序

sysroot @ Ubuntu :~~ /谷歌-身份验证器- libpam -主机$谷歌-身份验证器

基于ouwantauthenticationtokenstobetime-based (y/n ) y

# #是否要根据时间选择认证令牌“y”

warning : pastingthefollowingurlintoyourbrowserexposestheotpsecrettogoogle 3360

3359 www .谷歌. co

m/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/sysroot@ubuntu%3Fsecret%3DILTAJB2B4KWHRO6T6YMZY5YQVA%26issuer%3Dubuntu

Your new secret key is: ILTAJB2B4KWHRO6T6YMZY5YQVA

#如果不想使用"FreeOTP"APP扫描上面"二维码"的方式添加,可以手动输入这个key码,手动添加。

Enter code from app (-1 to skip): -1

Code confirmation skipped

Your emergency scratch codes are:

#系统会生成5个紧急验证码,当无法获取动态验证码或验证码不能使用时,可以使用这5个紧急验证码登录,5个紧急验证码是一次性的,不能重复使用。

48504801

93223955

82645854

10580754

57959419

#提示是否要更新验证文件,选择"y"

Do you want me to update your "/home/sysroot/.google_authenticator" file? (y/n) y

#禁止使用相同口令登录,口令30秒只允许登录一次,选择"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

#默认动态验证码在30秒内有效,由于客户端和服务器可能会存在时间差,可将时间增加到最长4分钟,是否要这么做,选择"y"

By default, a new token is generated every 30 seconds by the mobile app.

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. This allows for a

time skew of up to 30 seconds between authentication server and client. If you

experience problems with poor time synchronization, you can increase the window

from its default size of 3 permitted codes (one previous code, the current

code, the next code) to 17 permitted codes (the 8 previous codes, the current

code, and the 8 next codes). This will permit for a time skew of up to 4 minutes

between client and server.

Do you want to do so? (y/n) y

#是否限制尝试次数,每30秒只能尝试最多3次,选择:"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

#配置ssh登录服务调用"google authenticator"认证

1:编辑"/etc/pam.d/sshd"文件

sysroot@ubuntu:~/google-authenticator-libpam-master$ sudo vim /etc/pam.d/sshd

增加以下内容

auth required pam_google_authenticator.so no_increment_hotp

2:编辑"/etc/ssh/sshd_config"文件

sysroot@ubuntu:~/google-authenticator-libpam-master$ sudo vim /etc/ssh/sshd_config

修改以下参数,将"no"改为"yes"

ChallengeResponseAuthentication no

#查看"pam_google_authenticator.so"文件

sysroot@ubuntu:~/google-authenticator-libpam-master$ ll /usr/local/lib/security/

#源码安装的配置文件路径为"/usr/local/lib/security/"目录,需要创建"/lib/security/"目录

sysroot@ubuntu:~/google-authenticator-libpam-master$ sudo mkdir -p /lib/security/

#将"pam_google_authenticator.so"文件软连接或者cp复制到"/lib/security/"目录下

sysroot@ubuntu:~/google-authenticator-libpam-master$ sudo ln -s /usr/local/lib/security/pam_google_authenticator.so /lib/security/pam_google_authenticator.so

#重启ssh服务

sysroot@ubuntu:~/google-authenticator-libpam-master$ sudo service ssh restart

sysroot@ubuntu:~/google-authenticator-libpam-master$

#使用ssh工具测试:

1.Putty

2、SecureCRT

身份验证选择"键盘交互"

3、Xshell

#ssh用户身份证选择"使用键盘输入用户身份验证"

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。