Replies: 3 comments 6 replies
-
found some way for the gpg part 😁 [gpg]
args = [
"--batch",
"--no-symkey-cache",
"--pinentry-mode",
"loopback",
"--passphrase-fd",
"0",
] cze() {
local pass
pass=$(op read --no-newline op://localhost/chezmoi/password)
echo "$pass" | chezmoi encrypt "$@"
}
czd() {
local pass
pass=$(op read --no-newline op://localhost/chezmoi/password)
echo "$pass" | chezmoi decrypt "$@"
} ❯ cze ~/test.txt > test.txt.encr && cat test.txt.encr
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: test.txt.encr
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ -----BEGIN PGP MESSAGE-----
2 │
3 │ jA0ECQMCAFShUEgAVSj/0k4BeCwqrqJm8bF8xX71gCt8rQL9GNilzZKZjYWwmahq
4 │ KlFRf2UxP4o320f6g2mAh/6wU5FIcHGpI2hMndOB70olkPawfgx6HObVEAu63f8=
5 │ =7CBq
6 │ -----END PGP MESSAGE-----
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ czd ~/test.txt.encr 2>/dev/null
1password + gpg |
Beta Was this translation helpful? Give feedback.
-
While the above method works fine for CLI usage, it unfortunately didn’t work within templates. [gpg]
symmetric = true
args = []
command = {{ joinPath .chezmoi.sourceDir "gpg-op.sh" | quote }}
#!/bin/sh
exec gpg --batch --yes --no-symkey-cache --pinentry-mode loopback \
--passphrase "$(op read --no-newline op://localhost/chezmoi/password)" "$@" |
Beta Was this translation helpful? Give feedback.
-
I'm going to raise a question: why are you trying to do this? That is, what does GPG encryption with 1Password get you over pulling the files from 1Password directly? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use 1Password with encryption without actually saving it to config
unfortunately this does not work as it's not evaluated, neither for gpg or scriptEnv.
Any way to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions