Closed Zamiell closed 7 years ago
Just to add: I just installed a brand new Windows 7 VM from scratch, downloaded the binary, and the exact same problem happened, so the problem isn't relegated to Windows 10.
Thank you very much for trying this out. Actually we've never tried gopass on windows. There is some preliminary work from @muesli to get it run properly on windows in https://github.com/muesli/gopass/tree/appveyor and it looks like @alexmironof got it running somehow (see #304), but we definitely need help with this. If you can contribute this would be great.
@Zamiell @dominikschulz Yeah I've got it working just fine with go get .../.../...
:sweat_smile:
welp, I'll try running it from source
Here's one messed up thing that was relatively trivial to fix: https://github.com/justwatchcom/gopass/pull/335
It's not working for me when running from source either.
I set up a password store with go run main.go init
; that seemed to work fine.
But when I try to create a password of "asdf", it panics:
C:\Users\Zamiell\go\src\github.com\justwatchcom\gopass>go run main.go insert switches/switch01
Enter password for switches/switch01:
[31mFailed to restore terminal: The operation completed successfully.[0m
Retype password for switches/switch01:
[31mFailed to restore terminal: The operation completed successfully.[0m
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x59ad7d]
goroutine 1 [running]:
github.com/justwatchcom/gopass/store/secret.(*Secret).SetPassword(0x0, 0xc0421ad74c, 0x4)
C:/Users/Zamiell/go/src/github.com/justwatchcom/gopass/store/secret/secret.go:108 +0x2d
github.com/justwatchcom/gopass/action.(*Action).Insert(0xc04210a000, 0xabf400, 0xc0421c58f0, 0xc042042b40, 0xc0421c58f0, 0xc04210a000)
C:/Users/Zamiell/go/src/github.com/justwatchcom/gopass/action/insert.go:141 +0xd0a
main.main.func42(0xc042042b40, 0x0, 0xc04210a000)
C:/Users/Zamiell/go/src/github.com/justwatchcom/gopass/main.go:536 +0x80
github.com/justwatchcom/gopass/vendor/github.com/urfave/cli.HandleAction(0x819ba0, 0xc0420df5e0, 0xc042042b40, 0xc0421d2900, 0x0)
C:/Users/Zamiell/go/src/github.com/justwatchcom/gopass/vendor/github.com/urfave/cli/app.go:485 +0xd9
github.com/justwatchcom/gopass/vendor/github.com/urfave/cli.Command.Run(0x89df02, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8a1918, 0x11, 0x0, ...)
C:/Users/Zamiell/go/src/github.com/justwatchcom/gopass/vendor/github.com/urfave/cli/command.go:193 +0xaa0
github.com/justwatchcom/gopass/vendor/github.com/urfave/cli.(*App).Run(0xc042044d00, 0xc0420320c0, 0x3, 0x4, 0x0, 0x0)
C:/Users/Zamiell/go/src/github.com/justwatchcom/gopass/vendor/github.com/urfave/cli/app.go:250 +0x75f
main.main()
C:/Users/Zamiell/go/src/github.com/justwatchcom/gopass/main.go:785 +0x5f71
exit status 2
When debugging gopass
try to run it with the env variable GOPASS_DEBUG=true
, please.
The panic actually seems to be unrelated to windows and will be fixed soon.
Thanks @dominikschulz
Issue 1: By default, gopass should initialize the password store to a directory called ".password-store" in the home directory. However, on Windows, it initializes it to "C:.password-store". So, whatever code you added to the "location.go" file needs to be also added to the other part of the code.
Will type up the second issue in a minute.
Thank you for reporting this issue. Actually I already discovered this issue while doing some Windows tests yesterday but failed to open an issue for that. Will try to fix that as soon as I get a working windows VM.
I updated to the latest commit of gopass (as of the time of this writing).
C:\>gpg -k
C:\>echo Ok, so no GPG keys exist. So let's create one.
Ok, so no GPG keys exist. So let's create one.
C:\>gpg --gen-key
gpg (GnuPG) 2.0.30; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: keyring `C:/Users/jnesta/AppData/Roaming/gnupg/secring.gpg' created
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: Zamiell
Email address: zamiell@zamiell.com
Comment:
You selected this USER-ID:
"Zamiell <zamiell@zamiell.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key ACFEF0DB marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
pub 2048R/ACFEF0DB 2017-09-18
Key fingerprint = EE1E 5DCD 6B9C DAAA 5FE4 A5D2 84F0 806A ACFE F0DB
uid [ultimate] Zamiell <zamiell@zamiell.com>
sub 2048R/A9C0773D 2017-09-18
C:\> echo Ok, the key is successfully created with all default values. Now let's try to initialize a gopass store and store a simple secret.
Ok, the key is successfully created with all default values. Now let's try to initialize a gopass store and store a simple secret.
C:\>gopass init
Please select a private key for encryption:
[0] 0x84F0806AACFEF0DB - Zamiell <zamiell@zamiell.com>
Please enter the number of a key (0-0) [0]:
Use Zamiell (zamiell@zamiell.com) for password store git config? [y/N]: y
Please enter a user name for password store git config [Zamiell]:
Please enter an email address for password store git config [zamiell@zamiell.com]:
Git initialized
Password store C:\Users\jnesta\.password-store initialized for:
0x84F0806AACFEF0DB - Zamiell <zamiell@zamiell.com>
C:\>gopass insert asdf
Enter password for asdf []: secret123!@#
Retype password for asdf []: secret123!@#
gopass: Encrypting asdf for these recipients:
- 0x84F0806AACFEF0DB - Zamiell <zamiell@zamiell.com>
Do you want to continue? [Y/n]:
Error: failed to write secret 'asdf': failed to commit changes to git: failed to run command C:\Program Files\Git\cmd\git.exe [git commit -m Save secret to asdf: Inserted user supplied password]: exit status 128
So, looking at the file system, it seems to have created the asdf.pgp
file. I'm able to decrypt it:
C:\Users\jnesta\.password-store>gpg asdf.gpg
You need a passphrase to unlock the secret key for
user: "Zamiell <zamiell@zamiell.com>"
2048-bit RSA key, ID A9C0773D, created 2017-09-18 (main key ID ACFEF0DB)
gpg: encrypted with 2048-bit RSA key, ID A9C0773D, created 2017-09-18
"Zamiell <zamiell@zamiell.com>"
C:\Users\jnesta\.password-store>type asdf
secret123!@#
So it just seems to be failing on the git commit:
C:\Users\jnesta\.password-store>del asdf
C:\Users\jnesta\.password-store>git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: asdf.gpg
C:\Users\jnesta\.password-store>git commit -m "adding asdf"
gpg: skipped "EE1E5DCD6B9CDAAA5FE4A5D284F0806AACFEF0DB": secret key not available
gpg: signing failed: secret key not available
error: gpg failed to sign the data
fatal: failed to write commit object
Not sure if that last part is expected or not?
Indeed, it looks like the git commit is failing. This is not expected, maybe it's a setup error or we broke something in master. Will try to reproduce as soon as I've got some kind of windows test environment.
As an aside, if a user stumbles upon this repository and they start reading the README.md file, it isn't clear if gopass
is simply a rewrite of pass
in golang, or if it also adds new features.
Can you add a bulleted list to the README.md file that lists the additional features that gopass
provides over pass
? It might be best to put it directly below the quote from passwordstore.org.
A further nit-pick:
From the README.md file:
Choose one of:
$ gopass init gopher@golang.org
$ gopass init A3683834
$ gopass init 1E52C1335AC1F4F4FE02F62AB5B44266A3683834 # preferred
You don't really define what these 3 choices are or the implications of initializing a password store with either choice. (It's just telling gopass
which GPG key to use, right?)
Can't all this just be removed? README.md should probably advise the user to just do the simple gopass init
, since the built-in wizard guides the user through choosing a GPG key from all of the ones found. Users probably won't typically have to specify which GPG key to use inline, unless they are writing a script to create a gopass store for some reason.
Good point, indeed.
Could you just open separate issues for these findings? This makes tracking them easier. Thanks!
@alexmironof any tips on getting this working?
Also, does anyone have any recommendations for some software similar to gopass
? Not having it work on Windows is a deal breaker. Right now I'm thinking that I might resort to using plain old pass
with this team-guide from David Piegza: https://medium.com/@davidpiegza/using-pass-in-a-team-1aa7adf36592
@Zamiell I can tell you which commit I am using
Sure!
@dominikschulz More info: I started from scratch and generated a GPG key WITHOUT a passphrase. Then, I was able to add a secret to a newly initialized password store and no longer got the git commit error from above. So I think the problem lies in that gopass fails to bring up the little window that allows the user to type in their GPG passphrase, and assumes their GPG passphrase is blank, and then proceeds to try and do the commit, and then obviously fails at that part.
Thanks for following up on this. Actually gopass doesn't generate any popups itself, but relies on git / gpg to do that. There may be some interaction going on which prevents this. We still to properly support Windows, but so far there is no progress.
@Zamiell I have cloned working on windows gopass
from this commit a6468c2c99f56755246740a5beb539a81e47edb9
If you still need a testing environment you should give this a shot. It is pretty similar to AppVeyor but local using Vagrant+Virtualbox. https://github.com/chocolatey/chocolatey-test-environment There are also some more updated options but I like this one because it really helps you figure out your dependencies, and it comes with Chocolatey which is probably the BEST way of distributing packages for Windows that I've come across.
The git commit fails because git can't find the GPG executable on Windows (it's bundled with the MinGW executable which stores their keys at a different location from GPG4Win).
See https://jamesmckay.net/2016/02/signing-git-commits-with-gpg-on-windows/
This command fixes it:
git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
Steps to reproduce:
1) Download the 64-bit, located here. 2) Extract it to some directory. 3) Add that directory to the PATH variable with the instructions located here. 4) Open a new command window via Start --> Run -->
cmd
5) Do ago init
command.These steps were performed on a Windows 10 OS. I also tried using the 32-bit binary, and I received the same error. Any tips?