linux google Authenticator

linux google Authenticator

yum install -y chrony
vim /etc/chrony.conf
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
systemctl restart chronyd
chronyc sources

安装依赖组件

 yum install -y git automake libtool pam-devel

下载谷歌认证模块

git clone https://github.com/google/google-authenticator-libpam.git

安装谷歌认证模块

cd google-authenticator-libpam/
./bootstrap.sh
./configure
 make && make install

修改pam配置文件

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

修改sshd配置文件

vim /etc/ssh/sshd_config
asswordAuthentication yes

重启sshd

systemctl restart sshd

执行初始化谷歌认证模块

google-authenticator

Do you want authentication tokens to be time-based (y/n) y
#你想做的认证令牌是基于时间的吗?
Do you want me to update your “/root/.google_authenticator” file? (y/n) y
your chances to notice or even prevent man-in-the-middle attacks (y/n) 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
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

查看日志信息

tail -n10 /var/log/secure

配置手机app

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值