-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Automatically export creators key to the store #2159
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Hacking on gopass | ||
|
||
Note: See [CONTRIBUTING.md](../CONTRIBUTING.md) for an overview. | ||
|
||
This document provides an overview on how to develop on gopass. | ||
|
||
## Setting up an isolated development environment | ||
|
||
### With GPG | ||
|
||
`gopass` should fully respect `GOPASS_HOMEDIR` overriding all gopass internal paths. | ||
However it will still use your normal GPG keyring and configuration. To override this | ||
you will need to set `GNUPGHOME` as well and possibly generate a new keyring. | ||
|
||
```bash | ||
$ export GOPASS_DEBUG_LOG=/tmp/gp1.log | ||
$ export GOPASS_HOMEDIR=/tmp/gp1 | ||
$ mkdir -p $GOPASS_HOMEDIR | ||
$ export GNUPGHOME=$GOPASS_HOMEDIR/.gnupg | ||
# Make sure that you're using the correct keyring. | ||
$ gpg -K | ||
gpg: directory '/tmp/gp1/.gnupg' created | ||
gpg: keybox '/tmp/gp1/.gnupg/pubring.kbx' created | ||
gpg: /tmp/gp1/.gnupg/trustdb.gpg: trustdb created | ||
$ gpg --gen-key | ||
$ go build && ./gopass setup --crypto gpg --storage gitfs | ||
``` | ||
|
||
### With age | ||
|
||
Using `age` is recommended for development since it's easier to set up. Setting | ||
`GOPASS_HOMEDIR` should be sufficient to ensure an isolated environment. | ||
|
||
```bash | ||
$ export GOPASS_DEBUG_LOG=/tmp/gp1.log | ||
$ export GOPASS_HOMEDIR=/tmp/gp1 | ||
$ mkdir -p $GOPASS_HOMEDIR | ||
$ go build && ./gopass setup --crypto age --storage gitfs | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,7 +120,7 @@ func (s *Action) clone(ctx context.Context, repo, mount, path string) error { | |
|
||
// make sure the parent directory exists. | ||
if parentPath := filepath.Dir(path); !fsutil.IsDir(parentPath) { | ||
if err := os.MkdirAll(parentPath, 0700); err != nil { | ||
if err := os.MkdirAll(parentPath, 0o700); err != nil { | ||
return exit.Error(exit.Unknown, err, "Failed to create parent directory for clone: %s", err) | ||
} | ||
} | ||
|
@@ -200,7 +200,21 @@ func (s *Action) cloneCheckDecryptionKeys(ctx context.Context, mount string) err | |
return nil | ||
} | ||
|
||
var exported bool | ||
if sub, err := s.Store.GetSubStore(mount); err == nil { | ||
debug.Log("exporting public keys: %v", idSet.Elements()) | ||
exported, err = sub.ExportMissingPublicKeys(ctx, idSet.Elements()) | ||
if err != nil { | ||
debug.Log("failed to export missing public keys: %w", err) | ||
} | ||
} else { | ||
debug.Log("failed to get sub store: %s", err) | ||
} | ||
|
||
out.Noticef(ctx, "Please ask the owner of the password store to add one of your keys: %s", strings.Join(idSet.Elements(), ", ")) | ||
if exported { | ||
out.Noticef(ctx, "The missing keys were exported to the password store. Run `gopass sync` to push them.") | ||
} | ||
Comment on lines
+203
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a nice addition, especially for usage with age. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I did never test this with age. It should work, but ... 🤔 |
||
|
||
return nil | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue that
0700
is already octal and the way we are used to see permission in the unix world.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a gofumpt change. I don't have a strong opinion on this, but since we don't have strong community of "style reviewers" here I'd prefer to rely on automation as much as possible, i.e. follow the conventions that the tools suggest.