CentOS7でyumからGoogle Authenticatorを入れる

ちょっと使おうと思ったら、自分でビルドしてインストールする記事が目に付いたので。

epelからインストールできて、問題なく動くようなのでメモ。

参考資料はこのあたり

手順としてはepelのリポジトリを導入して、

yum install epel-release

Google Authenticatorをインストール
yum install google-authenticator

コマンド”google-authenticator”から対話式に必要な設定をしていく
google-authenticator
Do you want authentication tokens to be time-based (y/n) "Google Authenticatorの類を使うなら 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)
"各tokenを使い切りにするかどうか。よりセキュアにしたいので y。"
By default, tokens are good for 30 seconds. 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. If you experience problems with
poor time synchronization, you can increase the window from its default
size of +-1min (window size of 3) to about +-4min (window size of 17 acceptable tokens).
Do you want to do so? (y/n)
"各tokenの有効時間の設定。yだと有効時間が前後4分程度に増える。そんなに長くなくていいので n。"
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。"

これで、Google Authenticatorの設定が完了し、QRコードや手入力用のkey等が表示されるはずだ。ターミナルエミュレータによってはQRコードとしてきちんと表示されないこともあるが。

このOTPをログインに適用するには、”/etc/pam.d/”にある各種設定ファイルに”auth required pam_google_authenticator.so”を追加すると適用される。

OpenVPN AS や Cockpit等、PAMでの認証がデフォルトになっているツールはちらほらあるのでこういった認証強化をしておくと手軽に多少の安心感は得られそうだ。

コメントを残す