public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH 1/2] sync: Split key refresh into explicit WKD/keyserver phases
@ 2019-07-05  5:19 Michał Górny
  2019-07-05  5:19 ` [gentoo-portage-dev] [PATCH 2/2] repos.conf: Default to using Gentoo keyservers Michał Górny
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2019-07-05  5:19 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Split key refresh into two parts: first try to refresh the key via WKD,
then via keyservers, rather than using the combined function that is
less explicit.  This ensures that users are correctly informed whether
keyservers are actually used, and therefore whether they may be subject
to SKS poisoning attacks.  Furthermore, it skips WKD from retry loop.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 lib/portage/sync/syncbase.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/portage/sync/syncbase.py b/lib/portage/sync/syncbase.py
index d15bb6d14..46644d68e 100644
--- a/lib/portage/sync/syncbase.py
+++ b/lib/portage/sync/syncbase.py
@@ -252,11 +252,17 @@ class SyncBase(object):
 		@type openpgp_env: gemato.openpgp.OpenPGPEnvironment
 		"""
 		out = portage.output.EOutput(quiet=('--quiet' in self.options['emerge_config'].opts))
+		out.ebegin('Refreshing keys via WKD')
+		if openpgp_env.refresh_keys_wkd():
+			out.eend(0)
+			return
+		out.eend(1)
+
 		out.ebegin('Refreshing keys from keyserver{}'.format(
 			('' if self.repo.sync_openpgp_keyserver is None else ' ' + self.repo.sync_openpgp_keyserver)))
 		retry_decorator = self._key_refresh_retry_decorator()
 		if retry_decorator is None:
-			openpgp_env.refresh_keys(keyserver=self.repo.sync_openpgp_keyserver)
+			openpgp_env.refresh_keys_keyserver(keyserver=self.repo.sync_openpgp_keyserver)
 		else:
 			def noisy_refresh_keys():
 				"""
@@ -264,7 +270,7 @@ class SyncBase(object):
 				errors, display errors as soon as they occur.
 				"""
 				try:
-					openpgp_env.refresh_keys(keyserver=self.repo.sync_openpgp_keyserver)
+					openpgp_env.refresh_keys_keyserver(keyserver=self.repo.sync_openpgp_keyserver)
 				except Exception as e:
 					writemsg_level("%s\n" % (e,),
 						level=logging.ERROR, noiselevel=-1)
-- 
2.22.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-05  5:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-05  5:19 [gentoo-portage-dev] [PATCH 1/2] sync: Split key refresh into explicit WKD/keyserver phases Michał Górny
2019-07-05  5:19 ` [gentoo-portage-dev] [PATCH 2/2] repos.conf: Default to using Gentoo keyservers Michał Górny
2019-07-05  5:38   ` Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox