Skip to content

Instantly share code, notes, and snippets.

@daurnimator
Last active April 30, 2017 00:45
Show Gist options
  • Save daurnimator/96d285dd22a71004f84793c4a9e4530f to your computer and use it in GitHub Desktop.
Save daurnimator/96d285dd22a71004f84793c4a9e4530f to your computer and use it in GitHub Desktop.
Idea for sshd AuthorizedKeysCommand to use gpg trust database
gpg --list-trustdb |
lua -e 'for line in io.stdin:lines() do
local key, level = line:match("^rec%s+%d+, trust (%x+), ot=(%d+)")
if key and tonumber(level) == 6 then -- 6 means ultimate trust (and not revoked)
print(key)
end
end' |
xargs -n 1 gpg --export-ssh-key
@KellerFuchs
Copy link

KellerFuchs commented Sep 14, 2016

The lua call can be done in awk Nevermind, what I wrote isn't exactly correct

awk '$5 = "ot=6", $3 = "trust" {print substr($4, 1, length($4)-1)}'

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