Search code examples
clojuregnupgdatomic

Using "lein ring server" over SSH with Datomic and a GPG key


Leiningen will not ask me for my passphrase to decrypt my gpg key (which has my username and pass for Datomic).

gpg --quiet --batch --decrypt ~/.lein/credentials.clj.gpg

Prompts for a password in a terminal/ascii-like "popup" (and subsequently gives me the decrypted key) but then trying

lein deps

or

lein ring server-headless 4000 

Simply says

$ lein ring server-headless 4000
Could not decrypt credentials from /home/vas/.lein/credentials.clj.gpg
gpg: cancelled by user
gpg: decryption failed: secret key not available

See `lein help gpg` for how to install gpg.

Even though I never cancel nor input my passphrase. Same operation works on my local machine no problem, although it gives me a graphical popup for the password. Is there a way to force a terminal-based passphrase entry?

I'm talking through SSH with another ubuntu box and I'd like to know how to make it prompt for a password or maybe another way I could get it to work.

Anyone have any ideas?

EDIT: https://github.com/technomancy/leiningen/issues/615

It looks like the solution is to use Keychain.

https://github.com/funtoo/keychain


Solution

  • There are a few options here, but the best one is to use the Unix Domain Socket forwarding feature of openssh, and then use a proper gpg agent locally.