1. はじめに

私はlinuxのsshログインに多要素認証としてGoogle authenticatorを用いています。
このauthenticatorアプリ上で誤ってlinux sshログイン用のパスワード設定を削除してしまいました。
再設定する必要があり、再設定を実施したのですが、コマンド1つで実施可能でした。

そもそもなのですが、再設定の為にはサーバにログインする必要があります。私はクラウド上のVMサーバへログインする必要がありましたので、リモートアクセス(シリアルポート接続)からアクセスして再設定しました。ローカルでアクセス可能な場合は、ローカル環境から直接アクセスする方が手軽と考えられます。

アクセスする経路が増えると、その分セキュリティが脆弱なポイントが増えますが、いざという時の為の逃げ道は残しておくべきです。私の場合は、リモートアクセス(シリアルポート接続)でした。

2. SSH PAM Google authenticatorの再設定について

Google authenticatorのワンタイムパスワードを再設定したいユーザから以下のコマンドを実施します。インストール時にSSHのPAM設定を実施した後に実施するauthenticator設定を再度実施します。

 $ google-authenticator

Do you want authentication tokens to be time-based (y/n) y
Warning: pasting the following URL into your browser exposes the OTP secret to Google:
https://www.google.com/chart?chs=~
QRコード Your new secret key is: VASBSFI3V5AHZJ2VKY
Enter code from app (-1 to skip): ******

Code confirmed Your emergency scratch codes are:
~ ~ ~ ~ ~
Do you want me to update your “/home/username/.google_authenticator” file? (y/n) 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) n
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

コメントを残す

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)