You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
curl tries to read known_hosts from wrong location #8033
although host.domain.tld is contained in known_hosts there's an error message:
curl: (60) SSL peer certificate or SSH remote key was not OK
AFAICT, curl tries to load known_hosts from %APPDATA%\.ssh (user\AppData\Roaming\.ssh), while it should look at %USERPROFILE%\.ssh (user\.ssh), which is user's actual home folder and is used by OpenSSH integrated in Windows as well.
BTW, would be great to have an example of how to get the hash for --hostpubmd5 and --hostpubsha256 in the documentation (ie, what data to hash exactly).
changed the title [-]curl tries to read known_hosts from wrong location (Windows)[/-][+]curl tries to read known_hosts from wrong location[/+]on Nov 19, 2021
Is this practice/order documented or mandated somewhere official? curl has preferred APPDATA to USERPROFILE for finding the user's "home dir" since 8be602c, 18 years ago...
I'm just using curl with SFTP for the first time and I stumbled across the certificate warning. So I was going to research.
So what does it mean "official"?
Some tools want to follow XDG base directories, other tools try to mimic Linux behaviour by using %USERPROFILE% as $HOME (that's what sounds reasonable to me). Yet another tools rely on explizit %HOME%.
Also, there hasn't been "official" SSH until a few years ago in some Windows 10 update. Now, this ssh is using %USERPROFILE%\.ssh and I think it's practical to use the same data in curl as well, isn't it? It's not really useful to have two different known_hosts.
BTW, IMO it's not too well documented that curl is using %APPDATA%. I actually had used Procmon to check whether it reads my known_hosts file.
Do you know of other apps search .ssh at %APPDATA%?
Maybe you could read %USERPROFILE%\.ssh, if the other does not exist? Or if it doesn't contain known_hosts?
Activity
[-]curl tries to read known_hosts from wrong location (Windows)[/-][+]curl tries to read known_hosts from wrong location[/+]bagder commentedon Nov 19, 2021
Is this practice/order documented or mandated somewhere official? curl has preferred
APPDATAtoUSERPROFILEfor finding the user's "home dir" since 8be602c, 18 years ago...jeffrson commentedon Nov 19, 2021
Well, that's interesting.
I'm just using curl with SFTP for the first time and I stumbled across the certificate warning. So I was going to research.
So what does it mean "official"?
Some tools want to follow XDG base directories, other tools try to mimic Linux behaviour by using %USERPROFILE% as $HOME (that's what sounds reasonable to me). Yet another tools rely on explizit %HOME%.
Also, there hasn't been "official" SSH until a few years ago in some Windows 10 update. Now, this ssh is using %USERPROFILE%\.ssh and I think it's practical to use the same data in curl as well, isn't it? It's not really useful to have two different known_hosts.
BTW, IMO it's not too well documented that curl is using %APPDATA%. I actually had used Procmon to check whether it reads my known_hosts file.
Do you know of other apps search .ssh at %APPDATA%?
Maybe you could read %USERPROFILE%\.ssh, if the other does not exist? Or if it doesn't contain known_hosts?
bagder commentedon Nov 19, 2021
curl also never actually use
%USERPROFILE%now, it always uses%USERPROFILE%\Application Data- ifAPPDATAisn't set.bagder commentedon Nov 19, 2021
@jeffrson, Would you be able to try out #8035 ?
jeffrson commentedon Nov 21, 2021
Great work, thank you very much!
Unfortunately I don't have any local builds for curl :-( and I'm afraid I can't set it up in the short term either.
Also I could not find a nightly or autobuild version - can you recommend one?
tool_findfile: search for a file in the homedir
tool_findfile: search for a file in the homedir