passwd делает паузу после ввода неверного пароля

543
neubert

Скажем, вы вводите пароль и вводите неправильный пароль. Заметная задержка между сообщением о том, что пароль был неверным, и вводом его. Есть идеи, почему? Кажется странным ...

Вот сообщение, которое я получаю при вводе неверного пароля:

passwd: Authentication token manipulation error passwd: password unchanged 

Может быть, он пытается защитить себя от попыток перебора, уменьшив скорость, с которой можно пробовать новые пароли?

В любом случае есть ли где-нибудь обсуждение этого поведения? Я не вижу заметок об этом на странице руководства ..

1

2 ответа на вопрос

6
Dennis

Yes, this is to prevent brute force attacks.

An alphanumeric 6 character password can have up to 36 bits of entropy (6 bits per character). If a computer can check 1 billion passwords per second, it will need only 2 ^ 36 / 1 billion = 69 seconds to try all possible passwords. A delay of one second means that only one password can be tried per second. Trying all possible passwords would take 2179 years now...

The delay isn't handled by passwd itself, but by the Pluggable Authentication Modules.

The delay can be disabled for passwd by adding the option nodelay to the line

password [success=2 default=ignore] pam_unix.so obscure sha512 

in /etc/pam.d/common-password. Since this would affect all other programs using that configuration file as well, you could copy it over /etc/pam.d/passwd and disable the delay only there.

See also: man pam_unix

5
Paul

Yes, the delay is a protection against brute force, and is around 3 seconds.

The reason why it doesn't appear in the passwd man, is because it is controlled by the authentication backend - usually pam.

man pam_unix 

Shows you can set a nodelay to eliminate the delay. You can also set applications specific delays in pam_faildelay

man pam_faildelay 

These settings are all managed in

/etc/pam.d/*