i3 / i3lock

improved screen locker
https://i3wm.org/i3lock
BSD 3-Clause "New" or "Revised" License
921 stars 404 forks source link

Print the number of failed attempts to stdout #193

Closed rememberYou closed 6 years ago

rememberYou commented 6 years ago

Hello,

First of all, I want to thank you for providing i3-lock that I use every day. Recently, I had the idea that the fact that we could have a record of when a person tried to connect to his computer was important to know.

For instance, if a person fails to decrypt the password after 5 attempts, it would be nice if in the background, i3lock prints the number of failed attempts to stdout so we can evaluate it in a script to send us an email to ourselves (e.g. to be notified with our mobile phone) or saves in a log file, the time when the attempt took place.

Thanks to this, we could have a better idea of the suspected person and at the same time, strengthen the security of i3-lock.

Implemented this shouldn't be difficult with -f, --show-failed-attempts that allows us to report the number of failed attempts to connect. All it would take to do, it's to output the failed attempts on stdout, I guess and pipe it to a script which will read stdin and take actions.

If you want to make this idea more generic, it would be sufficient to add new option(s) to manage it. Two useful options would be:

  1. Number of attempts before executing a script in the background.
  2. Path to the script.

Or if it is not in the i3-lock scope, we could add the following option: Number of attempts before get notified in a log file.

With this log file, we could be kept informed of the time when the attempt took place and use it in a script where we will try to know if this file exists to execute an action.

What do you think of this idea?

Airblader commented 6 years ago

Thanks for reporting the issue.

Similarly to #190, I think that this is better handled in pam. i3lock essentially acts as a frontend to pam here and we want to keep it as light as possible to avoid potential issues. Doing this kind of stuff in pam itself also has the benefit of working across different lockers, when someone tries to execute commands with sudo, …

Thanks for understanding!