开发者

Erlang, SSH and authorized_keys

开发者 https://www.devze.com 2022-12-22 23:35 出处:网络
Playing with the ssh and public_key application in Erlang, I\'ve discovered a nice feature. I was trying to connect to my running Erlang SSH daemon by using a rsa key, but the authentication was fail

Playing with the ssh and public_key application in Erlang, I've discovered a nice feature.

I was trying to connect to my running Erlang SSH daemon by using a rsa key, but the authentication was failing and I was prompted for a 开发者_开发百科password.

After some debugging and tracing (and a couple of coffees), I've realized that, for some weird reason, a non valid key for my user was there. The authorized_keys file contained two keys. The wrong one was at some point in the file, while the correct one was appended at the end of the file.

Now, the Erlang SSH application, when diffing the provided key with the ones contained in the authorized_keys, it was finding the first entry (completely ignoring the second on - the correct one). Then, it was switching to different authentication mechanism (at first it was trying dsa instead of rsa and then it was prompting for a password).

The question is: Is this behavior intended or should the SSH server check for multiple entries for the same user in the authorized_keys file? Is this a generic SSH behaviour or it's just specific to the Erlang implementation?


Yes, its a 'first failure' authentication, and I came across your issue several times. As far as implementation goes, it was explained to me that the demon iterated over the authorised_keys file looking for a matching login, and THEN checked the key.

This seems to be the standard implementation,

0

精彩评论

暂无评论...
验证码 换一张
取 消