-
Notifications
You must be signed in to change notification settings - Fork 56
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
Enable OpenPGP support via pinentry #142
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff :-)
.gitignore
Outdated
@@ -4,3 +4,4 @@ boot/ | |||
.classpath | |||
.project | |||
.scala_dependencies | |||
.idea/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go to global gitignore - https://help.github.com/articles/ignoring-files/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall LGTM too, except minor nitpick on .gitignore.
val pinentryargs: Seq[String] = Seq("--pinentry-mode", "loopback") | ||
val passargs: Seq[String] = (optPassphrase map { passArray => passArray mkString "" } map { pass => Seq("--passphrase", pass) }) getOrElse Seq.empty | ||
val keyargs: Seq[String] = optKey map (k => Seq("--default-key", "0x%x" format(k))) getOrElse Seq.empty | ||
val args = passargs ++ pinentryargs ++ Seq("--detach-sign", "--armor") ++ (if(agent) Seq("--use-agent") else Seq.empty) ++ keyargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agent is pretty much required here
@@ -28,6 +28,7 @@ object PgpKeys { | |||
val gpgCommand = SettingKey[String]("gpg-command", "The path of the GPG command to run", BSetting) | |||
val useGpg = SettingKey[Boolean]("use-gpg", "If this is set to true, the GPG command line will be used.", ASetting) | |||
val useGpgAgent = SettingKey[Boolean]("use-gpg-agent", "If this is set to true, the GPG command line will expect a GPG agent for the password.", BSetting) | |||
val useGpgPinentry = SettingKey[Boolean]("use-gpg-pinentry", "If this is set to true, the GPG command line will expect pinentry will be used with gpg-agent.", ASetting) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is ASetting
vs BSetting
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rank is optional, and it affects the help
display iirc. We should probably refactor it to sbt 0.13/1.x settingKey[Boolean]
style.
Adds a pinentry option to sbt-pgp, by using the
--pinentry-mode loopback
option specified in https://wiki.archlinux.org/index.php/GnuPG#Unattended_passphraseAdds a
useGpgPinentry
boolean key that if set withuseGpg
anduseGpgAgent
set, will use a specialized signerCommandLineGpgPinentrySigner
.This is useful when using GPG with gpg-agent and a smartcard device with OpenPGP support. In this situation, there is no local secring on the hard drive, and the secret key is kept on the card itself.
TODO
Testing
This is currently missing ways to effectively test for pinentry. https://lists.gnupg.org/pipermail/gnupg-users/2017-July/058741.html suggests PINENTRY_USER_DATA and fake-pinentries.
Right now I'm testing this locally:
and then killing gpg-agent to ensure that the PIN is not cached, and running
publishLocalSigned
:gpgconf --kill gpg-agent && gpgconf --launch gpg-agent sbt publishLocalSigned