欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          Google Authenticator實(shí)現(xiàn)Linux用戶登錄雙認(rèn)證

          系統(tǒng):CentOS 7.5 X64

          #安裝開發(fā)者工具

          yum groupinstall “Development Tools” -y

          #安裝pam 開發(fā)包

          yum install pam-devel -y

          #安裝chrony軟件,chrony 是網(wǎng)絡(luò)時間協(xié)議的(NTP)的另一種實(shí)現(xiàn),因?yàn)閯討B(tài)口令再驗(yàn)證時用到了時間,所以要保持時間上的一致性

          yum install chrony -y

          vi /etc/chrony.conf

          server 2.cn.pool.ntp.org iburst

          systemctl restart chronyd

          chronyc sources

          #如果時區(qū)不對的話,可以拷貝你當(dāng)前地區(qū)所在地的時區(qū)到系統(tǒng)運(yùn)行的時區(qū)

          #cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

          ###安裝google-authenticator

          cd /opt

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

          cd google-authenticator-libpam/

          ./bootstrap.sh

          ./configure

          make && make install

          ln -s /usr/local/lib/security/pam_google_authenticator.so /usr/lib64/security/pam_google_authenticator.so

          #配置系統(tǒng)PAM模塊,修改sshd支持谷歌的認(rèn)證,在sshd文件的第一行

          vi /etc/pam.d/sshd

          auth      required pam_google_authenticator.so

          vi /etc/ssh/sshd_config

          ChallengeResponseAuthentication yes

          #安裝二維碼生成工具,這步也可以省略,如果不裝的話,因?yàn)橄乱徊缴傻亩S碼就會成一個鏈接,

          #到時將鏈接復(fù)制到你的瀏覽器中,也是可以出現(xiàn)二維碼的,到時利用智能手機(jī)打開google author 進(jìn)行掃描。

          cd /opt

          yum -y install libpng libpng-devel

          wget -c https://fukuchi.org/works/qrencode/qrencode-4.0.2.tar.bz2

          tar jxvf qrencode-4.0.2.tar.bz2

          cd qrencode-4.0.2

          ./configure

          make && make install

          #運(yùn)行g(shù)oogle-authenticator命令,它將會在當(dāng)前登陸用戶的家目錄中生成一個新的密鑰

          cd ~

          google-authenticator

          #Your emergency scratch codes are:

          #  98627355

          #  45083255

          #  48589468

          #  91373042

          #  22191496

          #上述共需回答5個y

          #第1個:問你是否想做一個基于時間的令×××y

          #第2個:是否更新你的google認(rèn)證文件,由于第一次設(shè)置,所以一定選y 

          #第3個:是否禁止口令多用,這里選擇y,禁止它,以防止中間人欺騙。y

          #第4個:默認(rèn)情況,1個口令的有效期是30s,這里是為了防止主機(jī)時間和口令客戶端時間不一致,設(shè)置的誤差,可以選擇y,也可選n,看要求嚴(yán)謹(jǐn)程度y

          #第5個:是否打開嘗試次數(shù)限制,默認(rèn)情況,30s內(nèi)不得超過3次登陸測試,防止別人暴力破解。y

          #并且上面這些設(shè)置將被存儲在用戶的/.google_authenticator文件中,emergency scratch codes 中的5個代碼是緊急代碼,務(wù)必牢記,

          #這是在你的動態(tài)口令無法使用的情況下使用的,記住,用一個失效一個。后期可以登陸上去后,重新生成!

          #此時打開手機(jī)上的Google Authenticator應(yīng)用掃描二維碼

          #最后重啟sshd服務(wù)

          systemctl restart sshd

          ###— secureCRT設(shè)置keyboard interactive需要放在第一位 —###

          Google Authenticator實(shí)現(xiàn)Linux用戶登錄雙認(rèn)證

          ### 解決內(nèi)網(wǎng)主機(jī)跳過二次認(rèn)證

          #編輯pam.d下的sshd 文件,在第一行增加內(nèi)容,主要是指定允許的主機(jī)信息文件

          more -2 /etc/pam.d/sshd

          auth [success=1 default=ignore] pam_access.so accessfile=/etc/security/access-localhost.conf

          auth      required pam_google_authenticator.so no_increment_hotp

          #然后在/etc/security/目錄下創(chuàng)建access-localhost.conf文件

          cat /etc/security/access-localhost.conf

          # skipped local network for google auth…

          + : ALL : 192.168.11.0/24

          + : ALL : LOCAL

          – : ALL : ALL

          #最后重啟sshd服務(wù)

          systemctl restart sshd

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號