-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Running vault login under windows throws invalid handle #4946
Comments
Unfortunately I'm going to need to point you towards cygwin/mingw/msys. Those aren't native shells, and unless Vault isn't working with the native Windows shell or Powershell, any difference with how it works in non-native shells is basically a bug in those shells. It's possible compiling within a Cygwin environment might cause different behaviors, but I'm not sure. |
I'm confused.. if it's not working with both, the only similarity between the two situations is Vault. Other Golang-written executables looking for stdin within mingw/cygwin/etc, work without issue. Simply put, I don't see how this is a "bug" in both cygwin/mingw. It's likely Vault would have to make edge-cases for these environments, because cygwin/mingw/etc aren't ever going to do exactly what Windows or Linux do (tty by default). Bash running under Cywgin, will connect the executable to the console handles via simple redirection. Singling out these users is a huge issue in a corporate environment, for us. From what it sounds like others have to do, is if Cygwin/Mingw, force the use of a pty (or something like winpty), or at least let people know like this. Example application which has functional stdin on these environments: https://github.com/concourse/fly/tree/master/pty; which, from brief review, looks like if on Windows, they just force a pty, without prior checking. Compiling within a Cygwin environment, doesn't seem like it would change anything. It's still a windows binary. For now, I think we're just going to have to redirect users to utilize winpty. E.g. |
It's worth noting, I have a strong dislike for Windows, so I personally don't care. But the people using Vault, if they are required to use Windows, are going to care. |
That's my point, Vault is the same but the execution environment is different.
I'm more than happy to accept a patch fixing the problem.
From past experience (not with Go) dealing with cross-compilation, it seems likely to me that it'll link against different libraries, which may provide proper support.
It'd be great if one of those people can then dig in and figure out what the issue is. This is the first report of this issue we've seen, and that might be due to recent changes (or not), but it suggests that it is not a common problem, or that the vast majority of Windows users aren't running it under Cygwin/Mingw. If someone on the team is interested maybe they'll dig in, but unless this isn't working in Windows Shell or PowerShell, it's hard to explicitly dedicate engineering resources to this, and considering almost everyone (or maybe just everyone?) on the team is using Linux or Mac, it's unlikely to be a small lift to get Cygwin going on a Windows box to dig in. |
wow! I just hit this too - it works running the command in cmd.exe, but in git for windows, it errors out just as it prints the I'm always astounded at the horrible corner cases windows illuminates. @lrstanley and @jefferai in my case, there is a "as usual" work around - prefix any interactive commands with
@jhowardmsft I really wonder - is there a better way to transparently make this kind of thing "just work"? if its something that could get upstreamed into the windows builds in go, it'd save a heck of a lot of unknowns. |
I guess @rprichard might be able to give pointers? |
same issue here, running in git bash from latest git-for-windows
|
@ztou I presume adding
|
As mentioned before, others have solved this by just forcing a tty on Windows, checking if there is a pty/tty on other systems, then defaulting to Go's See the following (open_raw_* files): Usage of that package: I would make a pr myself, but haven't had the time unfortunately. If someone could at least re-open the issue, as I think it's something that is going to have to be solved by Vault, even if it's not necessarily a bug with Vault. I don't think Go itself can solve this, as IMO it's a bit opinionated. |
and then i cam across https://github.com/kr/pty too - i don't see windows support, but maybe its an abstraction that would allow go to have one... |
Bumping this if only to say that I have a lot of Windows users who use non-native shells like git-bash, mobaxterm, cygwin, etc. and then have problems authenticating with Vault due to this issue. I'd guess Windows users are in the minority of Vault users and it's not a show-stopper, but it is a bit of a nuisance to have to explain workarounds to users before they've even really gotten started. |
+1 for a windows fix. using the workaround 'winpty' but please. |
When attempting to use vault in a Windows environment, I receive the following error (suspect it's related to stdin being different in mingw or similar?):
It will immediately exit, without entering a password. This has been tested within Cygwin as well as Git Bash, under Windows 7 and 10, x84_64.
Environment:
vault status
): n/avault version
): v0.10.3It's worth noting that one can still utilize
password=<your-password>
directly in the prompt, but this is far from the desired behavior, as it shows the password, and in certain environments, will log to the bash history (even on windows).The text was updated successfully, but these errors were encountered: