-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
key: Add --new-password-file flag for non-interactive password changes #1720
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1720 +/- ##
==========================================
- Coverage 52.13% 47.06% -5.08%
==========================================
Files 148 148
Lines 11718 11721 +3
==========================================
- Hits 6109 5516 -593
- Misses 4657 5309 +652
+ Partials 952 896 -56
Continue to review full report at Codecov.
|
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.
Hey, thanks for taking a stab at implementing this! Unfortunately, you implemented something slightly different: We try hard to not take a password as a command-line parameter (because all other users of the same system are allowed to read the command-line, so they could get the password), but to read it from a file.
Would you mind changing --new-password
to --new-password-file
according to the proposal in the issue, and read the password from the file?
This can then also be used with third-party programs, like restic passwd --new-password-file <(pass restic/backup/foo)
.
Thanks!
Sure, makes sense. I've made the change! |
Looks good, I've taken the liberty of squashing the commits, and I'll merge this after the tests ran. Thank you for your contribution! |
key: Add --new-password flag for non-interactive password changes
Thank you!! 🕺 |
What is the purpose of this change? What does it change?
Makes it possible to change the password non-interactively.
I was unsuccessful trying to do it in a script by piping into stdin; restic expects 1000 bytes and the error check is wrong so it always returns an error even on early EOF; but even when corrected, I can only seem to pass one input, not two. Anyway, the whole thing doesn't matter if there's a nifty flag. 😄
Was the change discussed in an issue or in the forum before?
Closes #827
Also see https://forum.restic.net/t/changing-repo-password-without-prompt/591?u=matt
/cc @robbat2 and @HLeithner
Checklist
changelog/unreleased/
that describes the changes for our users (template here)gofmt
on the code in all commits(There don't seem to be tests for the commands, and this is automatically documented by
restic key -h
, so I'm marking this as done, I guess?)