[svc]ssh+gg二步认证
1,安装依赖
yum install python-pip -y
pip install docutils
yum install gcc python-devel subversion pam pam-devel -y
2,下载git包
cd /home/lanny/tools/
unzip google-authenticator-master.zip
cd google-authenticator-master
cd libpam/
./bootstrap.sh
./configure
make
make install
3,配置文件
ll /lib64/security
google-authenticator,则复制到/usr/local/bin
ll /usr/local/bin/google-authenticator
#pl2pm /usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so openvpn
4,为root用户生成google验证码
[root@vpnserver ~]# google-authenticator
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/root@vpnserver%3Fsecret%3D7ZSEKQI6W7GJXDDBEBJJINHY3Q%26issuer%3Dvpnserver
Your new secret key is: 7ZSEKQI6W7GJXDDBEBJJINHY3Q
Your verification code is 496552
Your emergency scratch codes are:
70752164
63976717
73442435
67261408
95454901
修改pam.d
[root@vpnserver pam.d]# cat /etc/pam.d/sshd
#%PAM-1.0
auth required pam_google_authenticator.so <---追加
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session optional pam_keyinit.so force revoke
session include password-auth
=================================================
修改ssh配置:
vim /etc/ssh/sshd_config
83 ChallengeResponseAuthentication yes
测试:手机下载google身份验证器,登陆(root用户哦)
====================================================
为jss生成:
jss 密码 sss
===============
[jss@vpnserver ~]$ google-authenticator
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/jss@vpnserver%3Fsecret%3DLNS6P7ONML6LCOFPKXW4OFWYS4%26issuer%3Dvpnserver
Your new secret key is: LNS6P7ONML6LCOFPKXW4OFWYS4
Your verification code is 755883
Your emergency scratch codes are:
41886633
49746589
44517353
13151010
41992403
=========================
注意:
1.如果无法登陆
cp /usr/local/lib/security/pam_google_authenticator.so /lib64/security/
2,
Google身份验证器每隔三十秒就会变的。这就实现了动态验证码的功能。
3,5个紧急验证码,用一个少一个.
4,
默认情况下,令牌只在30秒内有效,由于客户端和服务器时间不完全一致的因素,可以将时间窗口加大到最长4分钟
5,是否限制尝试次数,每30秒只能尝试最多3次:
6, google-authenticator针对单用户
回滚为初始ssh状态
[root@vpnserver ~]# cat /etc/pam.d/ssh
cat: /etc/pam.d/ssh: No such file or directory
[root@vpnserver ~]# cat /etc/pam.d/sshd
#%PAM-1.0
#auth required pam_google_authenticator.so # 注释掉即可
[svc]ssh+gg二步认证的更多相关文章
- [svc]centos6上部署openvpn+gg二步认证
最近又发现个新的vpn: wireguard 为了满足员工在家办公的需求.需要 openvpn+gg方案 在centos6上部署openvpn 参考 1.安装前准备 wget -O /etc/yum. ...
- TOTP算法实现二步验证
概念 TOTP算法(Time-based One-time Password algorithm)是一种从共享密钥和当前时间计算一次性密码的算法. 它已被采纳为Internet工程任务组标准RFC 6 ...
- SSH的通讯和认证
SSH的通讯和认证 转自:http://blog.sina.com.cn/s/blog_4e9440910100zxk0.html 之前一直对SSH的认证模棱两可,今天对SSH的通讯,认证和配置有了进 ...
- 给 SSH 启用二次身份验证
转载自:https://mp.weixin.qq.com/s/ssuhFbfaHxxzGmLg6Y2MjA 目前来说,二次验证(这里就不做过多解释了)是比较常用的安全手段,通过设置二次验证(谷歌或其他 ...
- HTTP协议 (二) 基本认证
HTTP协议 (二) 基本认证 http协议是无状态的, 浏览器和web服务器之间可以通过cookie来身份识别. 桌面应用程序(比如新浪桌面客户端, skydrive客户端)跟Web服务器之间是如何 ...
- Coding 两步认证技术介绍
什么是两步认证 在介绍两步认证之前,首先来看下目前主流的几种认证方式. 上图中的认证方式大体上可以分为三大类 1.You know : 比如密码,这种只有我们知道的 2.You are : 比如指纹, ...
- ssh登录二次验证,让服务器更安全。
码云地址 sshdTwoVerification 介绍 ssh登录二次验证 问题:现在很多人的Linux服务器可能会被攻击,只校验一次后台用户名密码登录变得不再保险. 当然大家首先要做的是修改ssh服 ...
- JHipster生成微服务架构的应用栈(二)- 认证微服务示例
本系列文章演示如何用JHipster生成一个微服务架构风格的应用栈. 环境需求:安装好JHipster开发环境的CentOS 7.4(参考这里) 应用栈名称:appstack 认证微服务: uaa 业 ...
- java实现谷歌二步验证 (Google Authenticator)
准备: 一个谷歌二步验证APP, 我用的是ios 身份宝 资料: 1.Google Authenticator 原理及Java实现 //主要参考 https://blog.csdn.net/li ...
随机推荐
- 从JSF看XPages的优点
我们都知道XPages基于JSF,或者可以说XPages是JSF标准的实现(implementation)之一.JSF从2004年的1.0到现在的2.0,已经经历了很大的变化和发展.XPages最初开 ...
- 使用Adobe Audition 处理声音步骤
软件: Adobe Audition 3.0 处理声音 插件:单独安装各种DirectX音效处理插件 一.录音 * 录音笔.手机 * Adobe Audition专业的录音软件 二..润 ...
- 【TP5.0】tp5.0实现连接多个数据库,实现类似3.2M(‘table’,'prefix_','db_config2')的CURD操作
1.db_connect的name链式操作,类似于3.2的M('table','prefix_','db_config2') /** * db_connect的name链式操作,类似于3.2的M('t ...
- Dockerfile 构建后端springboot应用并用shell脚本实现jenkins自动构建
Dockerfile 文件构建docker镜像 FROM centos MAINTAINER zh*****eng "z*******ch.cn" ENV LANG en_US.U ...
- (原)PyTorch中使用指定的GPU
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/6836568.html PyTorch默认使用从0开始的GPU,如果GPU0正在运行程序,需要指定其他G ...
- js精确计算(js浮点数精度问题)
转自:http://talentluke.iteye.com/blog/1767138 大多数语言在处理浮点数的时候都会遇到精度问题,但是在JS里似乎特别严重,来看一个例子 alert(45.6*13 ...
- struts2基本配置详解2
接上篇struts2基本配置详解,还有一些配置没有讲到,下面将继续. struts.xml <package name="com.amos.web.action" names ...
- memcached完全剖析--1. memcached的基础
翻译一篇技术评论社的文章,是讲memcached的连载.fcicq同学说这个东西很有用,希望大家喜欢. 发表日:2008/7/2 作者:长野雅广(Masahiro Nagano) 原文链接:http: ...
- java 实现唯一ID生成器
2014-11-08 内容存档在evernote,笔记名"java 实现唯一ID生成器"
- 对IT技术开发职业生涯的思考
对职业生涯的思考 从刚毕业到目前所在公司,差不多6年了,想想这六年里面,自己的能力和刚毕业比有了很大的提升,但是现在在什么能力上,我不知道,毕竟没有去过别的公司.最近也在思考自己未来,算是比较迷茫阶段 ...