Skip to content

Instantly share code, notes, and snippets.

@orangecms
Last active December 16, 2017 03:35
Show Gist options
  • Save orangecms/8c5f7e86fdb5314501a87a8c74fdf82c to your computer and use it in GitHub Desktop.
Save orangecms/8c5f7e86fdb5314501a87a8c74fdf82c to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
_KEY=$1
curl "https://keyserver.opensuse.org/pks/lookup?op=get&search=0x$_KEY" | tail -n +13 | head -n -2 > "/tmp/$_KEY.asc"
gpg --import "/tmp/$_KEY.asc"
rm "/tmp/$_KEY.asc"
@orangecms
Copy link
Author

Why? gpg --recv-keys should also do it, right? Well, I was in a network where everything but HTTP/S was blocked. Boo.

Remarks: Don't use the plain HTTP version of course. Just don't. It was a stupid mistake to put it here in the first place. Anyway, read before usage. If you want to use a different keyserver, just swap it out, make it a variable, whatever. You might need to adjust head/tail to filter out a different number of lines of HTML. :)

@lambdafu
Copy link

HKP uses port 11371, so if that was blocked, it won't work. But hkps uses port 443 just as https, so that will always work. Just make sure you choose a hkps-capable keyserver or pool and you should be ok (except that GnuPG nowadays also needs to do DNS lookups, but it's uncommon for those to be blocked).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment