Skip to content
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

Support remote URLs and "github://", "file://" schemes to fetch recipient public keys #115

Closed
wants to merge 2 commits into from

Conversation

aerth
Copy link

@aerth aerth commented Apr 20, 2020

This PR supersedes #43 and #64, adding support for github://, file:// and URL schemes (https://) for the -r (RECIPIENT) flag

Closes #84

Example usage:

echo "hello" | age -r github://aerth -o /tmp/encrypted.txt
echo "hello" | age -r https://github.com/aerth.keys -o /tmp/encrypted.txt2
echo "hello" | age -r file://$HOME/.ssh/id_ed25519.pub -o /tmp/encrypted.txt3
echo "hello" | age -r "$(cat $HOME/.ssh/id_ed25519.pub)" -o /tmp/encrypted.txt4

Thank you @paulc for laying the framework for the github:// scheme

arguments. The URL is fetched and each line is added as a recipient.

e.g.

    -r https://github.com/<user>.keys       (Use GitHub keys)
    -r file:///home/<user>/.ssh/<key>.pub   (Use local SSH key)

This is mostly useful to allow recipient keys to be specified directly
from a GitHub URL (or other service which provides an equivalent)
@aerth aerth force-pushed the remote-keys branch 2 times, most recently from 9248bfb to 181402a Compare April 20, 2020 18:13
@aerth
Copy link
Author

aerth commented May 14, 2020

worth noting that this introduces networking and uses default net/http client, direct connection (no proxy, system resolver)

someone could later add proxy support via environmental variable or flag

@nxg
Copy link

nxg commented Aug 3, 2020

A problem here is that the URI prefix will surely frustrate tab-completion. That is, I can type age -r ~/.ssh/id_r^I and have the recipient filename complete, but I can't type age -r file://~/.ssh/id_r^I and expect it to complete. I can do age -r file://$HOME/.ssh/i^I and it completes (somewhat to my surprise; this works in bash, but not in eg zsh), but that's more typing.

It's a minor usability issue, certainly, but it's enough of an issue that it makes me feel as if I'm missing something.

@sylr
Copy link

sylr commented Dec 5, 2020

https://github.com/hashicorp/go-getter might be relevent to this.

FiloSottile added a commit that referenced this pull request Jan 2, 2021
Fixes #84
Closes #165
Closes #158
Closes #115
Closes #64
Closes #43
Closes #20
FiloSottile added a commit that referenced this pull request Jan 2, 2021
Fixes #84
Fixes #66
Closes #165
Closes #158
Closes #115
Closes #64
Closes #43
Closes #20
FiloSottile added a commit that referenced this pull request Jan 3, 2021
Fixes #84
Fixes #66
Closes #165
Closes #158
Closes #115
Closes #64
Closes #43
Closes #20
@FiloSottile
Copy link
Owner

Hi! Thank you for contributing! I took a different path in #173, but it was useful to look at open PRs for the users' expectations. Let me know if that implementation works for you!

I wrote up an explanation of why I ended up implementing recipient files and not HTTPS sources on the mailing list, and I appreciate feedback! https://groups.google.com/g/age-dev/c/StmWsOyb-H8/m/a44rSBIWCAAJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFE: Allow use of ssh public key *path* rather than key contents for recipient
5 participants