当前位置:首页 > 系统 > CentOS7.6 使用Google身份验证器实现两次认证

CentOS7.6 使用Google身份验证器实现两次认证

系统4年前 (2019-03-26)

CentOS7.6 使用Google身份验证器实现两次认证

CentOS7.6 安装Google Authenticator身份验证器,使用手机上生成两步验证码进行登录


安装验证器

yum install -y epel-release 
yum install -y pam-devel google-authenticator


配置验证器

google-authenticator


第一步

是否希望身份验证令牌基于时间 选y

是否希望升级验证文件 选y

Do you want authentication tokens to be time-based (y/n) y
Warning: pasting the following URL into your browser exposes the OTP secret to Google:
  https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/root@instance-1%3Fsecret%3DXXHW2ZDPU46LQMUQSZKEQLICU4%26issuer%3Dinstance-1

our new secret key is: XXHW2ZDPU46LQMUQSZKEQLICU4
Your verification code is 901904
Your emergency scratch codes are:
  68846222
  58756444
  45247779
  46186145
  10007414

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


第二步

是否禁止多次使用同一身份验证令牌 选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


第三步

是否消除时间误差 选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


第四步

是否要限制登录间隔时间 选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


配置pam

vim /etc/pam.d/sshd
添加
auth       required     pam_google_authenticator.so

CentOS7.6 使用Google身份验证器实现两次认证


配置ssh

vim /etc/ssh/sshd_config

将ChallengeResponseAuthentication no
改为ChallengeResponseAuthentication yes

CentOS7.6 使用Google身份验证器实现两次认证


重启ssh服务

systemctl restart sshd


将SecureCRT中认证方式的键盘交互置顶为第一验证方式

CentOS7.6 使用Google身份验证器实现两次认证


CentOS7.6 使用Google身份验证器实现两次认证

输入google手机验证器中的验证码


CentOS7.6 使用Google身份验证器实现两次认证

输入root用户密码


CentOS7.6 使用Google身份验证器实现两次认证

登录成功

本站所有文章均可随意转载,转载时请保留原文链接及作者。

本文链接:https://www.vos.cn/os/294.html

相关文章

CentOS7安装cacti

CentOS7安装cacti

网上有一种叫cactiez的集成版本,rrd组件一直有问题,版本也太老,于是就想着重新搭建一个环境试试配置环境关闭Selinux vi /etc/selinux/config 将SELI...

利用LVM特性对EVE-NG硬盘分区扩容

利用LVM特性对EVE-NG硬盘分区扩容

下载的EVE-NG镜像中,存放模拟器镜像的分区太小了,上传几个cisco和juniper的模拟器就快满了,所以需要使用lvm特性对ubuntu server的硬盘分区进行扩容,首先先将eve-ng虚拟...

CentOS7 搭建LNMP

CentOS7 搭建LNMP

使用CentOS 1708,其实就是RHEL 7.4,使用YUM搭建LNMP环境(Linux、Nginx、MariaDB、PHP),全部使用新版组件,比如Nginx 1.12.2、MariaDB 10...

CentOS7 NFS配置

CentOS7 NFS配置

网络文件系统(Network File System)是一种将远程主机上的分区(目录)经网络挂载到本地的一种机制,通过对网络文件系统的支持,用户可以在本地系统上像操作本地分区一样来对远程主机的共享分区...

RHEL6.5 + Oracle11g + RAC + ASM

RHEL6.5 + Oracle11g + RAC + ASM

实验环境操作系统:RedHat Enterprise Linux 6.5虚拟机:VMware-workstation 14.1.1数据库:Oracle Database11g 11.2.0.4存储:O...

Centos 7切换阿里源并安装EPEL/IUS/REMI仓库

Centos 7切换阿里源并安装EPEL/IUS/REMI仓库

切换国内源cd /etc/yum.repo.d/mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-...