Gentoo Archives: gentoo-user

From: Stefano Crocco <posta@×××××××××××××.it>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: emerge --sync: problem refreshing keys
Date: Mon, 05 Aug 2019 10:22:08
Message-Id: 2679149.rJnVpJjFI0@linux
In Reply to: Re: [gentoo-user] Re: emerge --sync: problem refreshing keys by Stefano Crocco
1 On domenica 21 luglio 2019 13:22:55 CEST Stefano Crocco wrote:
2 > On domenica 21 luglio 2019 12:44:14 CEST Mick wrote:
3 > > On Sunday, 21 July 2019 11:17:30 BST Stefano Crocco wrote:
4 > > > On venerdì 19 luglio 2019 21:02:40 CEST Stefano Crocco wrote:
5 > > > > On venerdì 19 luglio 2019 18:21:46 CEST Ian Zimmerman wrote:
6 > > > > > On 2019-07-18 19:42, Stefano Crocco wrote:
7 > > > > > > Hello to everyone,
8 > > > > > > since yesterday emerge --sync fails because it can't refresh keys.
9 > > > > > > The
10 > > > > > > messages I get are:
11 > > > > > >
12 > > > > > > Syncing repository 'gentoo' into '/usr/portage'...
13 > > > > > >
14 > > > > > > * Using keys from /usr/share/openpgp-keys/gentoo-release.asc
15 > > > > > > * Refreshing keys via WKD ... [ !! ]
16 > > > > > > * Refreshing keys from keyserver hkps://keys.gentoo.org
17 > > > > > > ...OpenPGP
18 > > > > > > keyring
19 > > > > > >
20 > > > > > > refresh failed:
21 > > > > > > gpg: refreshing 4 keys from hkps://keys.gentoo.org
22 > > > > > > gpg: keyserver refresh failed: No keyserver available
23 > > > > > >
24 > > > > > > OpenPGP keyring refresh failed:
25 > > > > > > gpg: refreshing 4 keys from hkps://keys.gentoo.org
26 > > > > > > gpg: keyserver refresh failed: No keyserver available
27 > > > > >
28 > > > > > Perhaps something to do with this?
29 > > > > >
30 > > > > > https://www.bleepingcomputer.com/news/security/public-certificate-po
31 > > > > > is
32 > > > > > on
33 > > > > > in
34 > > > > > g->
35 > > > >
36 > > > > can-break-some-openpgp-implementations/
37 > > > >
38 > > > > > Aside:
39 > > > > > I have already switched my personal gpg configuration to use the new
40 > > > > > isolated keyserver.
41 > > > >
42 > > > > Thanks for the answer. I'd heard of this attack and read this [1]
43 > > > > article
44 > > > > on gentoo.org. From what I understand, it said that in theory there
45 > > > > shouldn't be problems when syncing because "The gemato tool used to
46 > > > > verify the Gentoo ebuild repository uses WKD by default. During normal
47 > > > > operation it should not be affected by this vulnerability". Reading
48 > > > > the
49 > > > > article again, I now see it also says that "In the worst case; Gentoo
50 > > > > repository syncs will be slow or hang" which, as you suggest, could
51 > > > > very
52 > > > > well be what's happened on my system. Unfortunately, the article
53 > > > > doesn't
54 > > > > say what to do if this happens.
55 > > > >
56 > > > > Tomorrow I'll try investigating more.
57 > > > >
58 > > > > Stefano
59 > > > >
60 > > > > [1] https://www.gentoo.org/news/2019/07/03/sks-key-poisoning.html
61 > > >
62 > > > It seems I found out how to fix the issue. I tried comparing my
63 > > > /usr/share/portage/config/repos.conf with the one which comes with a
64 > > > current stage3 and found out mine had the line
65 > > >
66 > > > sync-openpgp-keyserver = hkps://keys.gentoo.org
67 > > >
68 > > > which was missing in the file from stage3. Removing it (both here and in
69 > > > /etc/portage/repos.conf/gentoo.conf) allowed me to sync correctly. I
70 > > > hope
71 > > > this is the correct fix. I don't remember ever writing this line, so I
72 > > > suppose it came with the original stage3 I built my system from or was
73 > > > changed by another update (an update of what, however? According to
74 > > > `equery
75 > > > b`, this file doesn't belong to any package).
76 > > >
77 > > > I hope thing will keep working.
78 > > >
79 > > > Stefano
80 > >
81 > > I grepped two older installations I had immediate access to and there is
82 > > no
83 > > directive containing "openpgp" anywhere within /etc/portage/.
84 > >
85 > > In a new-ish installation there were a number of entries in /etc/portage/
86 > >
87 > > repos.conf/gentoo.conf, but no keyserver URI:
88 > > $ grep openpgp -r /etc/portage/repos.conf/gentoo.conf
89 > >
90 > > sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
91 > > sync-openpgp-key-refresh-retry-count = 40
92 > > sync-openpgp-key-refresh-retry-overall-timeout = 1200
93 > > sync-openpgp-key-refresh-retry-delay-exp-base = 2
94 > > sync-openpgp-key-refresh-retry-delay-max = 60
95 > > sync-openpgp-key-refresh-retry-delay-mult = 4
96 > >
97 > > Perhaps you had added a keyserver as a fall back when you were configuring
98 > > your system to use WKD? I haven't implemented WKD because there was no
99 > > news item advising us to do so.
100 >
101 > Maybe. I really know nothing about these issues, so I'm sure I wouldn't have
102 > added that line by myself. Maybe I read about them somewhere and I forgot
103 > about it.
104 >
105 > Stefano
106
107 If anyone is interested, I've found out a bit more about this issue. The
108 mysterious line
109
110 sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
111
112 is the default in portage since version 2.3.69 (~arch). This means that the
113 problem suddenly reappeared the first time portage got updated. By chance, I'd
114 just bought a new laptop and had finished installing Gentoo on it the day
115 before. I tried syncing from it... and it worked. I was getting angry: on my
116 desktop and my old laptop emerge --sync didn't work; on my new laptop it did.
117 Of course, the three machines were configured almost in the same way, so I
118 couldn't understand what could be causing the difference.
119
120 Searching again on Google, I somehow found out the bug report [1], which says
121 that in the past gnupg --refresh-keys could fail if ipv6 was disabled. The bug
122 report is marked as resolved with the release of gnupg-2.2.4-r2 last year;
123 however, I knew that on my new laptop I had left ipv6 enabled while on the
124 other two machines I had disabled it (I can't remember why, but disabling ipv6
125 is usually one of the first things I do on a new system). Could this be a
126 coincidence? I immediately rebuilt the kernel on my desktop PC with ipv6
127 enabled, rebooted, tried to sync, and it worked. Just to be sure, I disabled
128 it again, and it stopped working.
129
130 At this point, I think I'll file a bug report and see what they say.
131
132 Stefano
133
134 [1] https://bugs.gentoo.org/646194