31 ms·
Unix sockets, Cygwin, SSH agents, and sadness
- e12e 3y ago> Now I just need to figure out how to plumb it through to WSL. Sigh. Wouldn't the easier way be to expose the smart card to wsl and stick with Linux (wsl) tools on that side?
- sshine 3y agoThe level of effort amazes me. The first thing I do with a new PC is delete whatever scamware it came with, and install a free operating system on it.
- imjonse 3y agothe author has been a respected Linux developer for decades, so he is probably familiar with that option.
- b112 3y agoWork involves supporting Windows It's his first sentence. What does your (understandable) personal stance, have to do with his work environment?? Or the rest of his first sentence: there's a lot of specialised hardware design software that's only supported under Windows, so this isn't really avoidable Your statement feels unhelpful.
- lafar6503 3y agoAstonishing that after more than 30 years of coexistence of Linux and Windows OSes such arrogant remarks are still being made
- josefx 3y agoThe coexistence hasn't exactly been friendly, what with things like Microsoft being SCOs biggest financial backer during the Unix lawsuits.
- HeckFeck 3y agoI would say nice things about Windows if it wasn't riddled with telemetry and data guzzling spyware.
- trelane 3y ago> Astonishing that after more than 30 years of coexistence of Linux and Windows OSes such arrogant remarks are still being made Why are you not astonished that, after "30 years of coexistence" people still: feel the need to buy Windows and slap Linux or BSD on it (as opposed to buying one with Linux or BSD out of the box) and are forced to buy Windows to use software and/or hardware required to do work otherwise unrelated to Windows? Coexistence is a two-way street.
- lafar6503 3y agoI don't mind paying for tools I'm using to get the job done. But ignorant remarks in the tone of 'drop the crap you're using, no matter what it is, and install Linux' were maybe good 30 years ago, now it's just kinda disrespectful. People have various reasons to use their tools and it's not because they don't know Linux exists.
- ta8903 3y ago>after more than 30 years of coexistence of Linux and Windows OSes Despite Microsoft's best efforts.
- sshine 3y ago
- TacticalCoder 3y agoI do the same and I wish, too, that we lived in a world without Microsoft: I'd take only Linux and Mac machines any day over having to live in a world where that turd that Windows is exists. But sadly it's not the world we live in: in the world we live in MSFT has a freaking 2.4 trillion USD market cap. so work like in TFA is needed. At least Apple and Linux did make a big dent and the billions of Linux devices shall keep powering the real world for a very long time and it seems unlikely Mac users are going to trade their MacOS laptops for Windows turds, so all hope is not lost. And thankfully, so far, Microsoft phones have all been miserable failures. I do my part to fight Microsoft: I confiscated my mother-in-law's Windows laptop after she got malwared and fell for a scam and I bought her a Chromebook. My wife is more of a poweruser so I wiped her Windows system and installed her Ubuntu. I made my brothers switch to Mac computer a very long time ago: was tired of supporting their Windows never failing to get slow, catch malware etc. and simply told them: "You buy Mac computers or I'm not helping you anymore". Microsoft is a mediocre company making the world a shittier place, but they're here to stay.
- jstimpfle 3y agoIt's been ages that I've experienced a Windows install becoming slow. I haven't noticed any malware recently, either.
- sshine 3y ago"Slow": I removed Windows on a freshly installed laptop less than 6 months ago. Its latency was noticeable in spite of running a 12th Gen Intel(R) Core(TM) i7-12850HX. This is not a case of Windows "becoming slow", but of Windows "being slow". You could argue that my point of comparison is unreasonable, because I disable so many things in my operating system that I don't use that it's no wonder. Before starting my browser, I use less than 200MB RAM. My UI response time is lower than what my eye can perceive. I don't know exactly how fast that is, but I think gamers begin to care at around 10 ms. Malware: > Microsoft is Slowly Rolling Out Ads in the Windows 11 Start Menu https://gizmodo.com/microsoft-windows-11-onedrive-notifications-start-menu-1850327990 https://gizmodo.com/microsoft-windows-11-onedrive-notificati... Somehow, paying for an operating system does not relieve you of advertisement.
- ChrisSD 3y agoSo for those that only skimmed, the problem here is bridging the gap between native Windows and Cygwin's POSIX emulation (which is a "terrible impedance mismatch"). This is made more difficult because Cygwin's Unix socket emulation is a "kind of awful"[0] undocumented protocol. [0]: https://stackoverflow.com/questions/23086038/what-mechanism-is-used-by-msys-cygwin-to-emulate-unix-domain-sockets https://stackoverflow.com/questions/23086038/what-mechanism-...
- nsteel 3y agoI work in an industry where there's critical Windows-only software. Since WSL it's so much less painful since we can do everything except the specialist software under WSL (including git, SSH etc) and access the files seamlessly from both. I guess there is some unfortunate reason why they can't do the same here, it doesn't give specifics.
- wwweston 3y agoIt's been about 4 years since I tried WSL (really hoping to replace macOS as a unix workstation with a robust commercial software market) but my file access and socketed-app experience then was definitely anything but seamless.
- nsteel 3y agoPresumably if only 4 years ago that would still have been WSL2, but they have done a lot of improvements over the years. The audio and graphics WSLg stuff is pretty cool. Maybe worth giving it another try.
- abwizz 3y agonot sure about your requirements, but pretty happy over here that nowadays i can just mount sshfs within wsl and access this from windows explorer without any special hacks.
- jackewiehose 3y ago> I guess there is some unfortunate reason why they can't do the same here Because they want to support Git for Windows which is built upon Cygwin/msys. And this is fine because Cygwin is much faster than WSL and a good Windows integration is so much easier. Would be a total PITA if Git would only be available through WSL. Cygwin is still the best thing ever happened to Windows (or to Linuxers who are forced to work with Windows).
- nsteel 3y ago> Because they want to support Git for Windows which is built upon Cygwin/msys I read that, but I was wondering why they wanted that because they don't say. I've never noticed git to be slow under WSL but I guess that very much depends on your repo size and exactly what you are doing. It all sounds like a tremendous amount of hassle otherwise. I agree, Cygwin did enable us to work productively for many years. But Cygwin's drive mounting modes caused lots of pain. And the Xserver is simply awful. It is/was a constant source of issues, the worst being the incredibly frustrating crashes. Maybe they were due to underlying issues in the applications themselves but those apps work fine under WSLg (of course there are other bugs but we can still work with those).
- pjmlp 3y agoIf we had more OS diversity, tools wouldn't try to see UNIX everywhere.
- baz00 3y agoI remember when we had more OS diversity. It was hell.
- pjmlp 3y agoIt was great, we don't need UNIX monoculture.
- drekipus 3y agoYou mean a windows monoculture? Unix stuff has only recently been "in the norm" for dev related workflows, it used to be entirely Windows only. Same with office workflows, games (both playing and developing), graphics, etc. Unix is the rebel here. It is bringing the diversity. (Currently my workplace is probably 80% Mac, 19% Linux, 1% Windows, but I can see their point that it would be a lot easier to administrate if they were a monoculture of Mac).
- pjmlp 3y agoNo, I really mean UNIX monoculture. The world is bigger than the desktop.
- ryandrake 3y agoYea, let's not forget the dark times of the late 1990s / early 2000s. It was next to impossible to motivate developers to release software for more than Windows. Windows application software developers were thoroughly steeped in the platform. WinMain(), HINSTANCE, LPTSTR, CopyMemory(). Even for parts of code that did not require interacting with Win32, they'd reach for DWORD instead of unsigned int. The effort of porting these monstrosities to something non-Windows was enormous. As a junior engineer, I'd butt heads with my senior leads, arguing to keep the business logic in portable C and keep the "windows stuff" minimal and in its own cordoned-off directory. All the senior guys thought this was ridiculous--we would never have to port this to anything but Windows. Their idea of "portable" software was: It works on Windows 95 and Windows NT.
- dilawar 3y agoWow! I once built p0f on windows using msys2. But couldn't get the sockets to work. Without support for linux socket, p0f can not run as server and support queries. I should definately try this sometimes.
- bomewish 3y agoMy gosh I hope they pay this guy a lot of money.
- bsenftner 3y agoI'd be surprised, real work like this is never understood by the bean counters. He'll probably get frowned upon because it took longer than the half day some pointy haired idiot scheduled the work.
- mst 3y agomjg is sufficiently well known that I doubt he'd stay long in the face of such management.
- pxc 3y agoWent through the same pain last year setting up a Windows machine for work. I ended up giving up on native tools and msys2 entirely in favor of WSL2 after several months. And then finally asking for a Mac after several more. There are way too many bugs and quirks in every layer of this stuff, from missing features in the 'native' OpenSSH port by Microsoft to data loss bugs (!) in WSL2.
- binkHN 3y ago> ...data loss bugs (!) in WSL2. Mind going into this in more detail?
- capableweb 3y agoI've tried for ~1 year to like and use WSL2 on a daily basis (on two different systems none the less) because I already use Windows for other stuff, so might as well try it. But they make it really hard to rely on. From random shutdowns, GPU unreliability to data corruption and performance differences with just using Linux directly, I had to move away from it and back to Linux because I felt like I slowly losing my mind troubleshooting these issues. Latest issue was that the virtual disk file continued to grow beyond 500GB large while Linux still reported that it was just 20% full from the inside. So, reading about things, I gave optimize-vhd a try and boom, full disk file was corrupted. So, gave it a try, hit a bunch of issues, left and not planning to touch it again until WSL3, and I'll be much more cautious then.
- binkHN 3y agoOuch. I've been using ChromeOS more lately, and Windows less, and I'm really appreciating the Linux environment within ChromeOS. I haven't experience any of the issues you noted in this environment, but it does run as a container within a VM. As a result, the performance is not as good as bare metal, but it works rather well.
- itsTyrion 3y agoDamn. I’m only using WSL 1 if anything
- rurban 3y agoIn a similar domain I'm trying to cygwinify the ssh-agent path with -w. https://github.com/rurban/openssh-portable/commits/ssh-agent-w https://github.com/rurban/openssh-portable/commits/ssh-agent... but I'm having not enough time to test it win32: add ssh-agent -w for a windows socket path -w sets the output format to windows cmd style. Which is useful if you use the mingw openssh but need your agent in a cmd or powershell terminal.
- nsteel 3y ago> The Microsoft version of OpenSSH ships an SSH agent that doesn't use Unix sockets, but uses a named pipe instead. Looks like there is work on this at https://github.com/PowerShell/openssh-portable/pull/674 https://github.com/PowerShell/openssh-portable/pull/674 and eventually take advantage of https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ https://devblogs.microsoft.com/commandline/af_unix-comes-to-...
- chasil 3y agoThe problem with Microsoft's SSH agent is that it requires a running service. If you are not an Administrator, it is by default disabled and unusable. Later versions of PuTTY pageant.exe are now able to service the Microsoft clients, without extra privilege or a running service. It is a better fit. The PuTTY site isn't responding on my phone at the moment, or I'd post a link to the docs.
- nsteel 3y agoThese are the notes I have for setting this up (in 2019). I am not an Administrator on this PC, it's joined to a corporate domain. 1. In the start menu search for "Services" 2. Double click on "OpenSSH Authentication Agent" 3. Set the startup type to "Automatic" 4. Click "Start" and then OK. And after that one-time fix it's perfectly usable. It is possible I also had to do something else and forgot to document it.
- chasil 3y ago...and that only serves Microsoft OpenSSH. Since PuTTY can do both, why bother with Microsoft? Here are the instructions: https://the.earth.li/~sgtatham/putty/0.79/htmldoc/Chapter9.html#pageant-cmdline-openssh https://the.earth.li/~sgtatham/putty/0.79/htmldoc/Chapter9.h...
- nsteel 3y agoI've no idea why I'd bother with PuTTY but whatever you prefer to use. As I said, it works just fine and is not "unusable".
- mavu 3y agoI love the first comment on the blog so much that i will replicate it here fully: "Haha"
- astrobe_ 3y agoThe comment resonates with me: > Attempting to 'unixify' Windows is indeed a task often drought with much pain I chose TDM [1] to port some utility of mine to Windows (actually the initial port may have have been done with MSYS/Cygwin). TDM is MinGW-based and doesn't try to achieve full Posix compliance. It provides Win API header files instead. I did the adaptations for my socket-related stuff a long time ago. A bit tedious, but worth it. I don't depend on a DLL that's bigger than my program, and I have fine control on what it does. I discovered TDM thanks to Newlisp, a Lisp dialect interpreter which has quite a few batteries included [2] (some of its feature are still Linux-only though). [1] https://jmeubank.github.io/tdm-gcc/ https://jmeubank.github.io/tdm-gcc/ [2] http://www.newlisp.org/ http://www.newlisp.org/
- renox 3y agoLast release 2021 with gcc10 :-(
- 1MachineElf 3y ago>so I've been working on extending our support for hardware-backed SSH certificates to Windows Interesting work & I wish him luck. The ability to use hardware SSH certs on Windows has been around for at least a decade now, but it hasn't been a seamless experience. The other attempt I'm aware of is PuTTY-CAC[0]. It is recommended[1] for security-conscious organizations, and approved for use at places like the US Department of Veteran Affairs[2]. Vendors[3] of smart cards also show some limited support for it. The issue with PuTTY-CAC is that the server still needs to be configured to check the certificate against CRLs & PKI infrastructure. Over the past decade, I believe Red Hat has made some significant progress towards a workable solution[4], however, I have no experience with it. [0] https://github.com/NoMoreFood/putty-cac https://github.com/NoMoreFood/putty-cac [1] https://playbooks.idmanagement.gov/piv/engineer/ssh/ https://playbooks.idmanagement.gov/piv/engineer/ssh/ [2] https://www.oit.va.gov/Services/TRM/ToolPage.aspx?tid=8714# https://www.oit.va.gov/Services/TRM/ToolPage.aspx?tid=8714# [3] https://pivkey.zendesk.com/hc/en-us/articles/207698876-PIVKey-and-PuTTY-CAC-for-SSH-on-Windows https://pivkey.zendesk.com/hc/en-us/articles/207698876-PIVKe... [4] https://en.m.wikipedia.org/wiki/FreeIPA https://en.m.wikipedia.org/wiki/FreeIPA
- predictabl3 3y agoGgp-bridge.exe. or if you don't need gpg agent forwarding, you can just use the Unix socket support in openssh-win32 now. I can remote into a Linux server and use my yubikey as if I were physically plugged into the Linux machine.
- doctorpangloss 3y agoGit users with complex login needs should use OIDC. In order to do "enterprise" hardware SSH credentials, you already have the rest of the "enterprise" "OIDC" (not really OIDC, but part of the sales meaning of it) infrastructure. I believe you can wire it up that way, and not deal with SSH agents at all.
- asveikau 3y agoI think I've noticed this conflict between msys and the built-in OpenSSH and worked around it for years without understanding why it happens. Basically I find that my ssh agent never works unless I set GIT_SSH to the builtin one (at C:\windows\system32\openssh\ssh.exe). Once I do that, everything is happy. If I don't, git over SSH doesn't work right. And that makes sense. When msysgit calls the Microsoft one explicitly, it uses the Microsoft version of the agent protocol.
- nick__m 3y agoIf that project https://github.com/buptczq/WinCryptSSHAgent https://github.com/buptczq/WinCryptSSHAgent had a pin timeout, it would be the perfect Windows ssh agent. It support named pipe, pagent shared memory and a UNIX socket under WSL2 using Hyper-V and socat.
- jmclnx 3y agoCannot get to the article, got a real lame captha. But from the comments, is this to fix WSL ? If so, people should stay away from that and just use Linux. If the masses start using WSL, that would give hardware vendors the reason to ignore Linux on bare metal, thus no more desktop Linux.
- elzbardico 3y agoWSL is basically an attempt from Microsoft to avoid the encroachment of alternative Operating Systems in big corporations starting from the software development teams. As more and more corporations are using open source development tools instead of being tied to the Microsoft Eco-System, Microsoft decided that they needed to turn the experience for those developers less miserable, so those corporations could stay firmly entrenched on enterprise windows licensing contracts. Also, Azure didn't stand a chance if it was a Visual Studio only deployment destionation, so this is yet another reason to provide better compatibility for open source development tools in the windows desktop.
- aidenn0 3y agoIt's about cygwin/msys2 not WSL.
- 38 3y ago> Git for Windows is built on top of msys2, which in turn is built on top of Cygwin. you can get native Windows Git as well. its called MinGit: https://github.com/git-for-windows/git/wiki/MinGit https://github.com/git-for-windows/git/wiki/MinGit
- grandinj 3y agoThe root of the problem is attempting to avoid porting git to Windows properly, which leads to increasing contortions once you get past the easy stuff.
- gilcot 3y agoWhat the hell do you mean by "porting git to Windows properly"?
- riedel 3y agoYou can use socat with either plink or npiperelay to bridge the sockets between windows and cygwin. It is my standard setup to use the buildin ssh-agent of windows 10 [0] https://superuser.com/questions/1526348/share-ssh-agent-socket-or-any-other-named-pipe-between-windows-10-and-cygwin https://superuser.com/questions/1526348/share-ssh-agent-sock...