ryantm / agenix

age-encrypted secrets for NixOS and Home manager
https://matrix.to/#/#agenix:nixos.org
Creative Commons Zero v1.0 Universal
1.55k stars 119 forks source link

Unable to forward mkpasswd result into agenix #211

Closed jankaifer closed 1 year ago

jankaifer commented 1 year ago

When I try to run this:

mkpasswd -m sha-512 | agenix -e login-password.age

It fails with this error:

Password: cp: cannot stat '/tmp/tmp.eZpecGIAx7/login-password.age': No such file or directory

Error: Invalid recipient '[]'

[ Did rage not do what you expected? Could an error be more useful? ]
[ Tell us: https://str4d.xyz/rage/report  

An I using this wrong or is it agenix issue. I understood the doc, --help message that it will pipe anything I sent to it over | into that encrypted file.

jankaifer commented 1 year ago

Even simple echo "stuff" | agenix -e password.age throws the same error. It seems to be issue with creating that file, but when I create the secret in interactive mode with vim it works fine.

jankaifer commented 1 year ago

Now even simble agenix -e password-file.age throws the same error with Vim. Not sure what is wrong, will dig into it more.

jankaifer commented 1 year ago

The actual issue was that my ssh public keys were in wrong format, my parsing of that GitHub endpoint was flawed and It included empty arrays between those keys, after filtering those out it works well.

But I opened a PR to fix the weird cp warning that confused me.