| Summary: | ssh-keygen -R is case-sensitive, but should not be | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Griff Miller II <griff.miller> | ||||||||
| Component: | ssh-keygen | Assignee: | Damien Miller <djm> | ||||||||
| Status: | CLOSED FIXED | ||||||||||
| Severity: | minor | CC: | djm, dtucker | ||||||||
| Priority: | P5 | ||||||||||
| Version: | -current | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 2647 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Griff Miller II
2016-06-18 06:41:00 AEST
Created attachment 2841 [details]
Proposed patch for ssh-keygen -R case sensitivity bug
Ãngel González helped develop this patch.
Created attachment 2847 [details]
lowercase filenames as they are added
I'm wary of changing the semantics for matching, since it's very likely that users are inadvertently depending on this - it has been this way for ~20 years.
I think it would be safer if we lowercase hostnames *as they are added*. This avoids changing semantics for existing hosts but lets new ones be stored in the canonical format.
Does this solve the problem for you?
Hi, Damien.
I guess I can't think of any way a user would depend on "ssh-keygen -R Myhost" not to remove while depending on "ssh-keygen -R myhost" to remove, unless they were doing something insane like trying to use the success or failure of the removal as a means to determine if they had uppercase letters in their indicated hostname. :) The two commands mean exactly the same thing, and should produce the same result.
By the way, the hostnames are already being lowercased when they are added to known_hosts. So thanks, but no, it does not solve the problem for me.
While it's unlikely that a user would interactively type "ssh-keygen -R THEHOST" they do have to know enough inside baseball to code "ssh-keygen -R ${thehost,,}" (bash example) in scripts instead of "ssh-keygen -R $thehost" .
Created attachment 2959 [details]
A couple more cases
always lowercase hostnames before hashing them or adding them unhashed to known_hosts
Patch applied. This will be in OpenSSH 7.5 Close all resolved bugs after release of OpenSSH 7.7. |