[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 ...
随机推荐
- 20160210.CCPP体系具体解释(0020天)
程序片段(01):01.二级指针.c 内容概要:二级指针 #include <stdio.h> #include <stdlib.h> //01.二级指针: // 1.使用场景 ...
- Axure 万年历(日期选择下拉文本框)
百度网盘:http://pan.baidu.com/s/1c1ZjUPq 点击“图1”可呈现出“图2”的效果.(已实现模板化功能,不用去研究去为什么,直接使用即可)
- A. Kyoya and Photobooks(Codeforces Round #309 (Div. 2))
A. Kyoya and Photobooks Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He ...
- Delphi2010怎样获取程序内部自身版本?
用原来的GetFileVersionInfo仅仅能获取Delpi7的程序版本,用在Delphi2010中就无论用了 //------ 获取文件版本 function F_GetFileVersion( ...
- nsTimer的简单用法
//用nstimer的用法 一种用法,要手动加入到NsRunLoop中 NSTimer *time= [NSTimer timerWithTimeInterval: target:self selec ...
- 基于Android的小巫新闻客户端开发系列教程
<ignore_js_op> 141224c6n6x7wmu1aacap7.jpg (27.51 KB, 下载次数: 0) 下载附件 保存到相册 23 秒前 上传 <ignor ...
- jquery添加未来元素时,其绑定事件不起作用解决办法
delegate说起对未来元素是其作用的,于是写下代码: <!DOCTYPE HTML> <html> <head> <meta charset=" ...
- php如何在某个时间上加一天?一小时? 时间加减(转)
<?php date_default_timezone_set('PRC'); //默认时区 echo "今天:",date("Y-m-d",time() ...
- C# 使用系统方法发送异步邮件
项目背景: 最近在对几年前的一个项目进行重构,发现发送邮件功能需要一定的时间来处理,而由于发送是同步的因此导致在发送邮件时无法执行后续的操作 实际上发送邮件后只需要将发送结果写入系统日志即可对其他业务 ...
- C#项目中引入app.manifest管理员权限运行
原文地址:https://blog.csdn.net/qq395537505/article/details/51010962 参考UAC:User Account Control 参考IE保护模式: ...