From 243671037f5a36596187554712d7ed1e76e9c8b8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 Sep 2013 15:30:25 -0400 Subject: add remote..gcrypt-signingkey config This is needed by git-annex assistant when it sets up a gcrypt repository, to ensure that the gpg key it was asked to use to encrypt the repo is the same key used to sign it. If it's not, pulling from the repo won't work, due to git-remote-gcrypt's "Only accepting signatories" check. The user may have a global user.signingkey setting (I do), but be setting up a different special-purpose key for encrypting their git repo. The git-annex assistant cannot mess with the global value, so needs this to override it. --- README.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'README.rst') diff --git a/README.rst b/README.rst index f177913..6fc4636 100644 --- a/README.rst +++ b/README.rst @@ -60,10 +60,13 @@ The following ``git-config(1)`` variables are supported: The ``gcrypt-participants`` setting on the remote takes precedence over the repository variable ``gcrypt.participants``. +``remote..gcrypt-signingkey`` + .. ``user.signingkey`` - (From regular git configuration) The key to use for signing. You - should set ``user.signingkey`` if your default signing key is not - part of the participant list. + (The latter from regular git configuration) The key to use for signing. + You should set ``user.signingkey`` if your default signing key is not + part of the participant list. You may use the per-remote version + to sign different remotes using different keys. Environment Variables ===================== -- cgit v1.2.3 From 83d519179f5611641802b5de2b5f3f155798f61a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 19 Sep 2013 12:03:33 -0400 Subject: --check option to see if a repo exists and can be decrypted This is to allow programs to determine if a repo uses gcrypt, per #6. Since this program already knows the name of the manifest file and how to download it and decrypt it, it makes sense to do the check here rather than in, eg, git-annex. --- README.rst | 11 +++++++++++ git-remote-gcrypt | 33 +++++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 8 deletions(-) (limited to 'README.rst') diff --git a/README.rst b/README.rst index 6fc4636..3922376 100644 --- a/README.rst +++ b/README.rst @@ -173,6 +173,17 @@ Each item extends until newline, and matches one of the following: ``extn ...`` Extension field, preserved but unused. +Detecting gcrypt repos +====================== + +To detect if a git url is a gcrypt repo, use: git-remote-gcrypt --check url +Exit status if 0 if the repo exists and can be decrypted, 1 if the repo +uses gcrypt but could not be decrypted, and 100 if the repo does not +exist or could not be accessed. + +Note that this has to fetch the repo contents into the local git +repository, the same as is done when using a gcrypt repo. + See Also ======== diff --git a/git-remote-gcrypt b/git-remote-gcrypt index bf75777..67b0f67 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -779,14 +779,8 @@ cleanup_tmpfiles() rm -r -f -- "${Tempdir}" >&2 } -# handle git-remote-helpers protocol -gcrypt_main_loop() +setup() { - local input_= input_inner= r_args= temp_key= - - NAME=$1 # Remote name - URL=$2 # Remote URL - mkdir -p "$Localdir" # Set up a subdirectory in /tmp @@ -798,6 +792,17 @@ gcrypt_main_loop() trap 'exit 1' 1 2 3 15 echo_info "Development version -- Repository format MAY CHANGE" +} + +# handle git-remote-helpers protocol +gcrypt_main_loop() +{ + local input_= input_inner= r_args= temp_key= + + NAME=$1 # Remote name + URL=$2 # Remote URL + + setup while read input_ do @@ -849,4 +854,16 @@ gcrypt_main_loop() done } -gcrypt_main_loop "$@" +if [ "x$1" = x--check ] +then + NAME=dummy-gcrypt-check + URL=$2 + setup + ensure_connected + if iseq "$Did_find_repo" "no" + then + exit 100 + fi +else + gcrypt_main_loop "$@" +fi -- cgit v1.2.3 From 6ddc0589819f6366d4ffc7b650a4957a040d2979 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 19 Sep 2013 12:27:15 -0400 Subject: improve docs --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'README.rst') diff --git a/README.rst b/README.rst index 3922376..fedd6b0 100644 --- a/README.rst +++ b/README.rst @@ -178,8 +178,8 @@ Detecting gcrypt repos To detect if a git url is a gcrypt repo, use: git-remote-gcrypt --check url Exit status if 0 if the repo exists and can be decrypted, 1 if the repo -uses gcrypt but could not be decrypted, and 100 if the repo does not -exist or could not be accessed. +uses gcrypt but could not be decrypted, and 100 if the repo is not +encrypted with gcrypt (or could not be accessed). Note that this has to fetch the repo contents into the local git repository, the same as is done when using a gcrypt repo. -- cgit v1.2.3 From 5dcc77f507d497fe4023e94a47b6a7a1f1146bce Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 15 Jul 2014 17:16:32 -0400 Subject: added gcrypt.publish-participants configuration Fixes https://github.com/blake2-ppc/git-remote-gcrypt/issues/9 --- README.rst | 12 ++++++++++++ git-remote-gcrypt | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'README.rst') diff --git a/README.rst b/README.rst index fedd6b0..ba06259 100644 --- a/README.rst +++ b/README.rst @@ -60,6 +60,17 @@ The following ``git-config(1)`` variables are supported: The ``gcrypt-participants`` setting on the remote takes precedence over the repository variable ``gcrypt.participants``. +``remote..gcrypt-publish-participants`` + .. +``gcrypt.publish-participants`` + By default, the gpg key ids of the participants are obscured by + encrypting using `gpg -R`. Setting this option to `true` disables + that security measure. + + The problem with using `gpg -R` is that to decrypt, gpg tries each + available secret key in turn until it finds a usable key. + This can result in unncessary passphrase prompts. + ``remote..gcrypt-signingkey`` .. ``user.signingkey`` @@ -68,6 +79,7 @@ The following ``git-config(1)`` variables are supported: part of the participant list. You may use the per-remote version to sign different remotes using different keys. + Environment Variables ===================== diff --git a/git-remote-gcrypt b/git-remote-gcrypt index 2295111..8d68669 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -406,6 +406,8 @@ read_config() git config --path user.signingkey || :) conf_part=$(git config --get "remote.$NAME.gcrypt-participants" '.+' || git config --get gcrypt.participants '.+' || :) + Conf_pubish_participants=$(git config --get --bool "remote.$NAME.gcrypt-publish-participants" '.+' || + git config --get --bool gcrypt.publish-participants || :) # Figure out which keys we should encrypt to or accept signatures from if isnull "$conf_part" || iseq "$conf_part" simple @@ -440,7 +442,13 @@ read_config() } # Check 'E'ncrypt capability cap_=$(xfeed "$r_keyinfo" cut -f 12 -d :) - iseq "${cap_#*E}" "$cap_" || Recipients="$Recipients -R $keyid_" + if ! iseq "${cap_#*E}" "$cap_"; then + if [ "$Conf_pubish_participants" = true ]; then + Recipients="$Recipients -r $keyid_" + else + Recipients="$Recipients -R $keyid_" + fi + fi done if isnull "$Recipients" -- cgit v1.2.3