Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows-generated fingerprint output #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

beldmit
Copy link

@beldmit beldmit commented Mar 19, 2021

ssh-keygen -l mangles the output for the keys generated on Windows machine because of '\r' EOL. This patch fixes it.

@WSLUser
Copy link

WSLUser commented Apr 2, 2021

This should either be fixed downstream at Win32 within https://github.com/PowerShell/openssh-portable/tree/latestw_all/contrib/win32/win32compat or (since this file doesn't exist in that directory) this should be pushed upstream and verify Linux and BSD are unaffected by the change. Otherwise you'll need to add logic (through an ifdef windows) so that it only applies to Windows.

@beldmit
Copy link
Author

beldmit commented Apr 3, 2021

Let me disagree. As the public key file is a text file, it's always a chance that it will be opened with a windows text editor, so non-Linux version should be ready to deal with '\r\n' EOLs.

@WSLUser
Copy link

WSLUser commented Apr 5, 2021

I should call out that plain old Notepad built into Windows has line ending support for Linux (thanks to WSL's existence). So users will always have a way (plus most good text editors support multiple platforms such as VS Code, which can read line endings from Mac, Linux, and Windows).

@glebfm
Copy link

glebfm commented Feb 1, 2022

Yesterday I reported the same issue here: mindrot#3385 (thanks @jakubjelinek for pointing out it's duplicate).

Let me copy my description here:

$ ./ssh-keygen -l -f test.pub 
3072 SHA256:Fh8V9v/JyBFlGI0ZqvWMb6480Ldm9dF0XJGTZFnoosI test@test (RSA)
$ unix2dos -q test.pub
$ ./ssh-keygen -l -f test.pub 
 (RSA)HA256:Fh8V9v/JyBFlGI0ZqvWMb6480Ldm9dF0XJGTZFnoosI test@test
$ read -r key < test.pub
$ printf '%s\r9999 SHA256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdea good@key\n' "$key" > bad.pub
$ ./ssh-keygen -l -f bad.pub 
9999 SHA256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdea good@key (RSA)
$ ./ssh-keygen -l -f bad.pub | less
3072 SHA256:rDIBjjZQEjZTzR3GIp/KERSlnMtsxeFrAbeye6TRoI0 test@test^M9999 SHA256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdea good@key (RSA)

@glebfm
Copy link

glebfm commented Feb 1, 2022

(thanks @jakubjelinek for pointing out it's duplicate).
Sorry, I meant @Jakuje. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants