You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2019/03/21 18:27:57 UTC

[whimsy] branch master updated: Try multiple key servers

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f140a4  Try multiple key servers
3f140a4 is described below

commit 3f140a4604e76cbe41a6034262c999519445012c
Author: Sebb <se...@apache.org>
AuthorDate: Thu Mar 21 18:27:47 2019 +0000

    Try multiple key servers
---
 .../views/actions/check-signature.json.rb          | 34 ++++++++++++----------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/www/secretary/workbench/views/actions/check-signature.json.rb b/www/secretary/workbench/views/actions/check-signature.json.rb
index 7ba78da..4628e25 100644
--- a/www/secretary/workbench/views/actions/check-signature.json.rb
+++ b/www/secretary/workbench/views/actions/check-signature.json.rb
@@ -5,7 +5,7 @@
 ENV['GNUPGHOME'] = GNUPGHOME if GNUPGHOME
 
 #KEYSERVER = 'pgpkeys.mit.edu'
-KEYSERVER = 'hkps.pool.sks-keyservers.net'
+KEYSERVERS = %w{hkps.pool.sks-keyservers.net keyserver.ubuntu.com pgpkeys.mit.edu}
 
 message = Mailbox.find(@message)
 
@@ -31,20 +31,24 @@ begin
     # extract and fetch key
     keyid = err[/[RD]SA key (ID )?(\w+)/,2].untaint
 
-    out2, err2, rc2 = Open3.capture3 gpg, '--keyserver', KEYSERVER,
-      '--debug', 'ipc', # seems to show communication with dirmngr
-      '--recv-keys', keyid
-    # for later analysis
-    Wunderbar.warn "#{gpg} --recv-keys #{keyid} rc2=#{rc2} out2=#{out2} err2=#{err2}"
-
-    # run gpg verify command again
-    out, err, rc = Open3.capture3 gpg, '--verify', signature.path,
-      attachment.path
-
-    # if verify failed, concatenate fetch output
-    if rc.exitstatus != 0
-      out += out2
-      err += err2
+    KEYSERVERS.each do |server|
+      out2, err2, rc2 = Open3.capture3 gpg, '--keyserver', server,
+        '--debug', 'ipc', # seems to show communication with dirmngr
+        '--recv-keys', keyid
+      # for later analysis
+      Wunderbar.warn "#{gpg} --keyserver #{server} --recv-keys #{keyid} rc2=#{rc2} out2=#{out2} err2=#{err2}"
+  
+      # run gpg verify command again
+      out, err, rc = Open3.capture3 gpg, '--verify', signature.path,
+        attachment.path
+  
+      # if verify failed, concatenate fetch output
+      if rc.exitstatus != 0
+        out += out2
+        err += err2
+      else
+        break
+      end
     end
   end