LoginSignup
2
3

More than 1 year has passed since last update.

ログインの失敗回数の設定

Posted at

指定の回数ログインに失敗した場合にロックがかかる設定を入れたかったのですが、
プロファイルを作成し、password-authsystem-authファイルを編集しただけでは上手くロックがかからなかったので、調べてみたところこちらのサイトを見つけ、同じように設定したところ上手くいきました!

現在の設定確認

# authselect current
Profile ID: sssd
Enabled features:
- with-silent-lastlog

Faillock を有効にする

# authselect enable-feature with-faillock
Make sure that SSSD service is configured and enabled. See SSSD documentation for more information.

設定が追加された事が分かります。

# authselect current
Profile ID: sssd
Enabled features:
- with-silent-lastlog
- with-faillock

次に、以下の設定ファイルを書き換えて保存します。
今回は、5回失敗するとロックをかけ、自動ロック解除はしないように設定します。(管理者が手動でロックを解除)

# vi /etc/security/faillock.conf

★ロックする連続失敗回数を設定
# deny = 3
deny = 5

★自動ロック解除される時間 (秒)
※自動ロック解除しない場合は0秒を指定
# unlock_time = 600
unlock_time = 0

わざと5回パスワードを間違え、正しいパスワードを入力してもログインできないことを確認します。

以下のコマンドで、現在のログイン失敗回数を確認できます。

# faillock --user <ユーザ名>

そして、以下のコマンドでロックを解除します。

# faillock --user <ユーザ名> --reset

これで再度ログインできるようになっていると思います!

ここまで、設定を追加する方法を紹介しましたが、まだプロファイルを作成していない場合は作成時に指定することも可能です。

★プロファイルの作成
authselect create-profile <プロファイル名> -b sssd

★作成したプロファイルの選択(ここでwith-faillockを指定)
authselect select custom/<プロファイル名> with-silent-lastlog with-faillock

上手くロックがかからない!という場合はこちらを試してみてください!

ではまた:wave:

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3