[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lxc-devel
Subject:    [lxc-devel] [lxc/master] gpg: use proxy, if http_proxy is set
From:       misterunknown on Github <lxc-bot () linuxcontainers ! org>
Date:       2019-02-27 10:16:56
Message-ID: 5c766398.1c69fb81.bbe8e.64f2SMTPIN_ADDED_MISSING () mx ! google ! com
[Download RAW message or body]

[Attachment #2 (text/x-mailbox)]

The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2882

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Hi everyone,

I found that `gpg` ignores the `http_proxy` environment variable. As the lxc-download \
script already adjusts the keyserver when `http_proxy` is set, it also should set the \
necessary `gpg` option. Currently there is no way to use lxc-download behind a proxy, \
because of this problem.

I had to put the `gpg` command in a subshell, because if not, `gpg` would not work \
properly, as it does not treat `${DOWNLOAD_GPG_PROXY}` as a valid argument.

If there is a better solution, let me know about it. This is my first pull request \
for this project, I hope I got everything right.

Cheers,
Marco


[Attachment #3 (text/plain)]

From 89e781d463cfb08c48611be133d657f562606cc1 Mon Sep 17 00:00:00 2001
From: Marco Dickert <marco@misterunknown.de>
Date: Wed, 27 Feb 2019 10:58:54 +0100
Subject: [PATCH 1/2] gpg: use proxy, if proxy is set

---
 templates/lxc-download.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/templates/lxc-download.in b/templates/lxc-download.in
index 973783ba0a..413b85f35b 100644
--- a/templates/lxc-download.in
+++ b/templates/lxc-download.in
@@ -60,6 +60,7 @@ if [ -z "${DOWNLOAD_KEYSERVER:-}" ]; then
   # Deal with GPG over http proxy
   if [ -n "${http_proxy:-}" ]; then
     DOWNLOAD_KEYSERVER="hkp://p80.pool.sks-keyservers.net:80"
+    DOWNLOAD_GPG_PROXY="--keyserver-options http-proxy=\"${http_proxy}\""
   fi
 fi
 
@@ -133,8 +134,8 @@ gpg_setup() {
 
   success=
   for _ in $(seq 3); do
-    if gpg --keyserver "${DOWNLOAD_KEYSERVER}" \
-      --recv-keys "${DOWNLOAD_KEYID}" >/dev/null 2>&1; then
+    if $(gpg --keyserver "${DOWNLOAD_KEYSERVER}" ${DOWNLOAD_GPG_PROXY:-} \
+      --recv-keys "${DOWNLOAD_KEYID}" >/dev/null 2>&1); then
       success=1
       break
     fi

From 429a63f17191b9b00e38a7b7ff14de28393c62ef Mon Sep 17 00:00:00 2001
From: Marco Dickert <marco@misterunknown.de>
Date: Wed, 27 Feb 2019 10:58:54 +0100
Subject: [PATCH 2/2] gpg: use proxy, if proxy is set

Signed-off-by: Marco Dickert <marco@misterunknown.de>
---
 templates/lxc-download.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/templates/lxc-download.in b/templates/lxc-download.in
index 973783ba0a..413b85f35b 100644
--- a/templates/lxc-download.in
+++ b/templates/lxc-download.in
@@ -60,6 +60,7 @@ if [ -z "${DOWNLOAD_KEYSERVER:-}" ]; then
   # Deal with GPG over http proxy
   if [ -n "${http_proxy:-}" ]; then
     DOWNLOAD_KEYSERVER="hkp://p80.pool.sks-keyservers.net:80"
+    DOWNLOAD_GPG_PROXY="--keyserver-options http-proxy=\"${http_proxy}\""
   fi
 fi
 
@@ -133,8 +134,8 @@ gpg_setup() {
 
   success=
   for _ in $(seq 3); do
-    if gpg --keyserver "${DOWNLOAD_KEYSERVER}" \
-      --recv-keys "${DOWNLOAD_KEYID}" >/dev/null 2>&1; then
+    if $(gpg --keyserver "${DOWNLOAD_KEYSERVER}" ${DOWNLOAD_GPG_PROXY:-} \
+      --recv-keys "${DOWNLOAD_KEYID}" >/dev/null 2>&1); then
       success=1
       break
     fi

[Attachment #4 (text/plain)]

_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic