#是否基于时间的认证,为了防止不同跨时区的问题,这里选择y Do you want authentication tokens to be time-based (y/n) y #然后会跳出一个google的二维码 #红色框框是: 生成的密钥 #绿色框框是: 生成的5个一次性紧急验证码,用于紧急情况下,使用过一次后该验证码即失效了。
#是否更新用户的 Google Authenticator 配置文件,选择 y 才能使上面操作对当前 root 用户生效,其实就是在对应用户的 Home 目录下生成了一个 .google_authenticator 文件,如果你想停用这个用户的 Google Authenticator 验证,只需要删除这个用户 Home 目录下的 .google_authenticator 文件就可以了。 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
#每次生成的令牌30s生成一次,最高允许存在误差4分钟。 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
将google 2FA加到ssh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
1、搭建配置文件(SSH调用及客户端配置,添加pam认证,再配置文件里面的第一行输入以下内容) [root@m01 ~]# vim /etc/pam.d/sshd #%PAM-1.0 auth required pam_google_authenticator.so
#执行命令报错,问题1:缺少pcre的依赖 ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option. #解决办法:安装pcre的依赖 [root@m01 nginx-1.24.0]# yum -y install pcre-devel
# 执行命令报错,问题2:缺少openssl的依赖 ./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl=<path> option. ## 解决方案:安装openssl的依赖 yum install -y openssl-devel
5、生成(第3次生成) [root@m01 app]#./configure --prefix=/opt/nginx-1.24.0 --with-http_ssl_module --with-http_stub_status_module 依赖全部安装完成后,再次生成,出现如下内容代表生成完成 Configuration summary + using system PCRE library + using system OpenSSL library + using system zlib library