| 1 | GLEP: 58 |
1 | GLEP: 58 |
| 2 | Title: Security of distribution of Gentoo software - Infrastructure to User distribution - MetaManifest |
2 | Title: Security of distribution of Gentoo software - Infrastructure to User distribution - MetaManifest |
| 3 | Version: $Revision: 1.1 $ |
3 | Version: $Revision: 1.8 $ |
| 4 | Last-Modified: $Date: 2008/10/21 23:30:47 $ |
4 | Last-Modified: $Date: 2010/02/07 16:24:17 $ |
| 5 | Author: Robin Hugh Johnson <robbat2@gentoo.org>, |
5 | Author: Robin Hugh Johnson <robbat2@gentoo.org>, |
| 6 | Status: Draft |
6 | Status: Draft |
| 7 | Type: Standards Track |
7 | Type: Standards Track |
| 8 | Content-Type: text/x-rst |
8 | Content-Type: text/x-rst |
| 9 | Requires: GLEP44, GLEP60 |
9 | Requires: 44, 60 |
| 10 | Created: October 2006 |
10 | Created: October 2006 |
| 11 | Updated: November 2007, June 2008, July 2008, October 2008 |
11 | Updated: November 2007, June 2008, July 2008, October 2008, January 2010 |
| 12 | Post-History: ... |
12 | Post-History: December 2009, January 2010 |
| 13 | |
13 | |
| 14 | ======== |
14 | ======== |
| 15 | Abstract |
15 | Abstract |
| 16 | ======== |
16 | ======== |
| 17 | MetaManifest provides a means of verifiable distribution from Gentoo |
17 | MetaManifest provides a means of verifiable distribution from Gentoo |
| … | |
… | |
| 73 | located at the root of a repository. |
73 | located at the root of a repository. |
| 74 | |
74 | |
| 75 | --------------------------------------------- |
75 | --------------------------------------------- |
| 76 | Procedure for creating the MetaManifest file: |
76 | Procedure for creating the MetaManifest file: |
| 77 | --------------------------------------------- |
77 | --------------------------------------------- |
|
|
78 | Summary: |
|
|
79 | ======== |
|
|
80 | The objective of creating the MetaManifest file(s) is to ensure that |
|
|
81 | every single file in the tree occurs in at least one Manifest. |
|
|
82 | |
|
|
83 | Process: |
|
|
84 | ======== |
| 78 | 1. Start at the root of the Gentoo Portage tree (gentoo-x86, although |
85 | 1. Start at the root of the Gentoo Portage tree (gentoo-x86, although |
| 79 | this procedure applies to overlays as well). |
86 | this procedure applies to overlays as well). |
| 80 | |
87 | |
| 81 | 2. Initialize two unordered sets: COVERED, ALL. |
88 | 2. Initialize two unordered sets: COVERED, ALL. |
| 82 | 2.1. 'ALL' will contain every file in the tree. |
89 | |
|
|
90 | 1. 'ALL' shall contain every file that exists in the present tree. |
| 83 | 2.2. 'COVERED' will contain every file that is mentioned in an existing |
91 | 2. 'COVERED' shall contain EVERY file that is mentioned in an existing |
| 84 | Manifest2. |
92 | Manifest2. If a file is mentioned in a Manifest2, but does not |
|
|
93 | exist, it must still be included. No files should be excluded. |
| 85 | |
94 | |
| 86 | 3. Traverse the tree, depth-first. |
95 | 3. Traverse the tree, depth-first. |
|
|
96 | |
| 87 | 3.1. At the top level only, ignore the following directories: distfiles, |
97 | 1. At the top level only, ignore the following directories: distfiles, |
| 88 | packages, local |
98 | packages, local. |
| 89 | 3.2. If a directory contains a Manifest file, extract all relevant local |
99 | 2. If a directory contains a Manifest file, extract all relevant local |
| 90 | files from it (presently: AUX, MISC, EBUILD; but should follow the |
100 | files from it (presently: AUX, MISC, EBUILD; but should follow the |
| 91 | evolution of Manifest2 entry types per [GLEPxx+5]), and place them |
101 | evolution of Manifest2 entry types per [#GLEP60]), and place them |
| 92 | into the COVERED set. |
102 | into the COVERED set. |
| 93 | 3.3. Recursively add every file in the directory to the ALL set, |
103 | 3. Recursively add every file in the directory to the ALL set, |
| 94 | pursusant to the exclusion list as mentioned in [GLEPxx+5]. |
104 | pursuant to the exclusion list as mentioned in [#GLEP60]. |
| 95 | |
105 | |
| 96 | 4. Produce a new set, UNCOVERED, as the set-difference (ALL)-(COVERED). |
106 | 4. Produce a new set, UNCOVERED, as the set-difference (ALL)-(COVERED). |
| 97 | This is every item that is not covered by another Manifest, or part |
107 | This is every item that is not covered by another Manifest, or part |
| 98 | of an exclusion list. |
108 | of an exclusion list. |
| 99 | |
109 | |
| … | |
… | |
| 105 | 7. For unique identification of the MetaManifest, a header line should |
115 | 7. For unique identification of the MetaManifest, a header line should |
| 106 | be included, using the exact contents of the metadata/timestamp.x |
116 | be included, using the exact contents of the metadata/timestamp.x |
| 107 | file, so that a MetaManifest may be tied back to a tree as |
117 | file, so that a MetaManifest may be tied back to a tree as |
| 108 | distributed by the rsync mirror system. The string of |
118 | distributed by the rsync mirror system. The string of |
| 109 | 'metadata/timestamp.x' should be included to identify this revision |
119 | 'metadata/timestamp.x' should be included to identify this revision |
| 110 | of MetaManifest generation. Eg: |
120 | of MetaManifest generation. e.g.: |
| 111 | "Timestamp: metadata/timestamp.x: 1215722461 Thu Jul 10 20:41:01 2008 UTC" |
121 | "Timestamp: metadata/timestamp.x: 1215722461 Thu Jul 10 20:41:01 2008 UTC" |
| 112 | The package manager MUST not use the identifying string as a filename. |
122 | The package manager MUST not use the identifying string as a filename. |
| 113 | |
123 | |
| 114 | 8. The MetaManifest must ultimately be GnuPG-signed. |
124 | 8. The MetaManifest must ultimately be GnuPG-signed. |
|
|
125 | |
| 115 | 8.1. For the initial implementation, the same key as used for snapshot |
126 | 1. For the initial implementation, the same key as used for snapshot |
| 116 | tarball signing is sufficient. |
127 | tarball signing is sufficient. |
| 117 | 8.2. For the future, the key used for fully automated signing by infra |
128 | 2. For the future, the key used for fully automated signing by infra |
| 118 | should not be on the same keyring as developer keys. See [GLEPxx+3 |
129 | should not be on the same keyring as developer keys. See [#GLEPxx+3 |
| 119 | for further notes]. |
130 | for further notes]. |
| 120 | |
131 | |
|
|
132 | Notes: |
|
|
133 | ====== |
| 121 | The above does not conflict the proposal contained in GLEP33, which |
134 | The above does not conflict the proposal contained in GLEP33, which |
| 122 | restructure eclasses to include subdirectories and Manifest files, as |
135 | restructure eclasses to include subdirectories and Manifest files, as |
| 123 | the Manifest rules above still provide indirect verification for all |
136 | the Manifest rules above still provide indirect verification for all |
| 124 | files after the GLEP33 restructuring if it comes to pass. |
137 | files after the GLEP33 restructuring if it comes to pass. |
| 125 | |
138 | |
| 126 | If other Manifests are added (such as per-category, or protecting |
139 | Additional levels of Manifests are required, such as per-category, and |
| 127 | versioned eclases), the size of the MetaManifest will be greatly |
140 | in the eclasses, profiles and metadata directories. This ensures that a |
| 128 | reduced, and this specification was written with such a possible future |
141 | change to a singular file causes the smallest possible overall change in |
| 129 | addition in mind. |
142 | the Manifests as propagated. Creation of the additional levels of |
|
|
143 | Manifests uses the same process as described above, simply starting at a |
|
|
144 | different root point. |
| 130 | |
145 | |
| 131 | MetaManifest generation will take place as part of the existing process |
146 | MetaManifest generation will take place as part of the existing process |
| 132 | by infrastructure that takes the contents of CVS and prepares it for |
147 | by infrastructure that takes the contents of CVS and prepares it for |
| 133 | distribution via rsync, which includes generating metadata. In-tree |
148 | distribution via rsync, which includes generating metadata. In-tree |
| 134 | Manifest files are not checked at this point, as they are assumed to be |
149 | Manifest files are not validated at this point, as they are assumed to |
| 135 | correct. |
150 | be correct. |
| 136 | |
151 | |
| 137 | -------------------------------------------------------- |
152 | -------------------------------------------------------- |
| 138 | Verification of one or more items from the MetaManifest: |
153 | Verification of one or more items from the MetaManifest: |
| 139 | -------------------------------------------------------- |
154 | -------------------------------------------------------- |
| 140 | There are two times that this may happen: firstly, immediately after the |
155 | There are two times that this may happen: firstly, immediately after the |
| … | |
… | |
| 147 | Procedure for verifying an item in the MetaManifest: |
162 | Procedure for verifying an item in the MetaManifest: |
| 148 | ---------------------------------------------------- |
163 | ---------------------------------------------------- |
| 149 | In the following, I've used term 'M2-verify' to note following the hash |
164 | In the following, I've used term 'M2-verify' to note following the hash |
| 150 | verification procedures as defined by the Manifest2 format - which |
165 | verification procedures as defined by the Manifest2 format - which |
| 151 | compromise checking the file length, and that the hashes match. Which |
166 | compromise checking the file length, and that the hashes match. Which |
| 152 | filetypes may be ignored on missing is discussed in [GLEPxx+5]. |
167 | filetypes may be ignored on missing is discussed in [#GLEP60]. |
| 153 | |
168 | |
| 154 | 1. Check the GnuPG signature on the MetaManifest against the keyring of |
169 | 1. Check the GnuPG signature on the MetaManifest against the keyring of |
| 155 | automated Gentoo keys. See [GLEPxx+3] for full details regarding |
170 | automated Gentoo keys. See [#GLEPxx+3] for full details regarding |
| 156 | verification of GnuPG signatures. |
171 | verification of GnuPG signatures. |
| 157 | 1.1. Abort if the signature check fails. |
172 | 1. Abort if the signature check fails. |
| 158 | |
173 | |
| 159 | 2. Check the Timestamp header. If it is significently out of date |
174 | 2. Check the Timestamp header. If it is significantly out of date |
| 160 | compared to the local clock or a trusted source, halt or require |
175 | compared to the local clock or a trusted source, halt or require |
| 161 | manual intervention from the user. |
176 | manual intervention from the user. |
| 162 | |
177 | |
| 163 | 3. For a verification of the tree following an rsync: |
178 | 3. For a verification of the tree following an rsync: |
|
|
179 | |
| 164 | 3.1. Build a set 'ALL' of every file covered by the rsync. (exclude |
180 | 1. Build a set 'ALL' of every file covered by the rsync. (exclude |
| 165 | distfiles/, packages/, local/) |
181 | distfiles/, packages/, local/) |
| 166 | 3.2. M2-verify every entry in the MetaManifest, descending into inferior |
182 | 2. M2-verify every entry in the MetaManifest, descending into inferior |
| 167 | Manifests as needed. Place the relative path of every checked item |
183 | Manifests as needed. Place the relative path of every checked item |
| 168 | into a set 'COVERED'. |
184 | into a set 'COVERED'. |
| 169 | 3.3. Construct the set 'UNCOVERED' by set-difference between the ALL and |
185 | 3. Construct the set 'UNCOVERED' by set-difference between the ALL and |
| 170 | COVERED sets. |
186 | COVERED sets. |
| 171 | 3.4. For each file in the UNCOVERED set, assign a Manifest2 filetype. |
187 | 4. For each file in the UNCOVERED set, assign a Manifest2 filetype. |
| 172 | 3.5. If the filetype for any file in the UNCOVERED set requires a halt |
188 | 5. If the filetype for any file in the UNCOVERED set requires a halt |
| 173 | on error, abort and display a suitable error. |
189 | on error, abort and display a suitable error. |
| 174 | 3.6. Completed verification |
190 | 6. Completed verification |
| 175 | |
191 | |
| 176 | 4. If checking at the installation of a package: |
192 | 4. If checking at the installation of a package: |
|
|
193 | |
| 177 | 4.1. M2-verify the entry in MetaManifest for the Manifest |
194 | 1. M2-verify the entry in MetaManifest for the Manifest |
| 178 | 4.2. M2-verify all relevant metadata/ contents if metadata/ is being |
195 | 2. M2-verify all relevant metadata/ contents if metadata/ is being |
| 179 | used in any way (optionally done before dependancy checking). |
196 | used in any way (optionally done before dependency checking). |
| 180 | 4.3. M2-verifying the contents of the Manifest. |
197 | 3. M2-verifying the contents of the Manifest. |
| 181 | 4.4. Perform M2-verification of all eclasses and profiles used (both |
198 | 4. Perform M2-verification of all eclasses and profiles used (both |
| 182 | directly and indirectly) by the ebuild. |
199 | directly and indirectly) by the ebuild. |
| 183 | |
200 | |
| 184 | Notes: |
201 | Notes: |
| 185 | ====== |
202 | ====== |
| 186 | 1. For initial implementations, it is acceptable to check EVERY item in |
203 | 1. For initial implementations, it is acceptable to check EVERY item in |
| 187 | the eclass and profiles directory, rather than tracking the exact |
204 | the eclass and profiles directory, rather than tracking the exact |
| … | |
… | |
| 201 | the individual Gentoo developers. They will continue to develop and |
218 | the individual Gentoo developers. They will continue to develop and |
| 202 | commit as they do presently, and the MetaManifest is added by |
219 | commit as they do presently, and the MetaManifest is added by |
| 203 | Infrastructure during the tree generation process, and distributed to |
220 | Infrastructure during the tree generation process, and distributed to |
| 204 | users. |
221 | users. |
| 205 | |
222 | |
|
|
223 | Any scripts generating Manifests and the MetaManifest may find it useful |
|
|
224 | to generate multiple levels of Manifests in parallel, and this is |
|
|
225 | explicitly permitted, provided that every file in the tree is covered by |
|
|
226 | at least one Manifest or the MetaManifest file. The uppermost |
|
|
227 | Manifest (MetaManifest) is the only item that does not occur in any |
|
|
228 | other Manifest file, but is instead GPG-signed to enable it's |
|
|
229 | validation. |
|
|
230 | |
| 206 | -------------------------------------------- |
231 | -------------------------------------------- |
| 207 | MetaManifest and the new Manifest2 filetypes |
232 | MetaManifest and the new Manifest2 filetypes |
| 208 | -------------------------------------------- |
233 | -------------------------------------------- |
| 209 | While [GLEPxx+5] describes the addition of new filetypes, these are NOT |
234 | While [#GLEP60] describes the addition of new filetypes, these are NOT |
| 210 | needed for implementation of the MetaManifest proposal. Without the new |
235 | needed for implementation of the MetaManifest proposal. Without the new |
| 211 | filetypes, all entries in the MetaManifest would be of type 'MISC'. |
236 | filetypes, all entries in the MetaManifest would be of type 'MISC'. |
| 212 | |
237 | |
| 213 | ---------------------------------------------------- |
238 | ---------------------------------------------------- |
| 214 | Timestamps & Additional distribution of MetaManifest |
239 | Timestamps & Additional distribution of MetaManifest |
| … | |
… | |
| 222 | trusted channel. |
247 | trusted channel. |
| 223 | |
248 | |
| 224 | On all rsync mirrors directly maintained by the Gentoo infrastructure, |
249 | On all rsync mirrors directly maintained by the Gentoo infrastructure, |
| 225 | and not on community mirrors, there should be a new module |
250 | and not on community mirrors, there should be a new module |
| 226 | 'gentoo-portage-metamanifests'. Within this module, all MetaManifests |
251 | 'gentoo-portage-metamanifests'. Within this module, all MetaManifests |
| 227 | for a recent time frame (eg one week) should be kept, named as |
252 | for a recent time frame (e.g. one week) should be kept, named as |
| 228 | "MetaManifest.$TS", where $TS is the timestamp from inside the file. |
253 | "MetaManifest.$TS", where $TS is the timestamp from inside the file. |
| 229 | The most recent MetaManifest should always be symlinked as |
254 | The most recent MetaManifest should always be symlinked as |
| 230 | MetaManifest.current. The possibility of serving the recent |
255 | MetaManifest.current. The possibility of serving the recent |
| 231 | MetaManifests via HTTPS should also be explored to mitigate MitM |
256 | MetaManifests via HTTPS should also be explored to mitigate |
| 232 | attacks. |
257 | man-in-the-middle attacks. |
| 233 | |
258 | |
| 234 | The package manager should obtain MetaManifest.current and use it to |
259 | The package manager should obtain MetaManifest.current and use it to |
| 235 | decide is the tree is too out of date per operation #2 of the |
260 | decide is the tree is too out of date per operation #2 of the |
| 236 | verification process. The decision about freshness should be a |
261 | verification process. The decision about freshness should be a |
| 237 | user-configuration setting, with the ability to override. |
262 | user-configuration setting, with the ability to override. |
| 238 | |
263 | |
| 239 | -------------------------------- |
264 | -------------------------------- |
| 240 | MetaManifest size considerations |
265 | MetaManifest size considerations |
| 241 | -------------------------------- |
266 | -------------------------------- |
| 242 | With only two levels of Manifests (per-package and top-level), every |
267 | With only two levels of Manifests (per-package and top-level), every |
| 243 | rsync will cause a lot of traffic transfering the modified top-level |
268 | rsync will cause a lot of traffic transferring the modified top-level |
| 244 | MetaManifest. To reduce this, per-category Manifests are strongly |
269 | MetaManifest. To reduce this, first-level directory Manifests are |
| 245 | recommended. Alternatively, if the distribution method efficently |
270 | required. Alternatively, if the distribution method efficiently handles |
| 246 | handles small patch-like changes in an existing file, using an |
271 | small patch-like changes in an existing file, using an uncompressed |
| 247 | uncompressed MetaManifest may be acceptable (this would primarily be |
272 | MetaManifest may be acceptable (this would primarily be distributed |
| 248 | distributed version control systems). Other suggestions in reducing this |
273 | version control systems). Other suggestions in reducing this traffic are |
| 249 | traffic are welcomed. |
274 | welcomed. |
| 250 | |
275 | |
| 251 | ======================= |
276 | ======================= |
| 252 | Backwards Compatibility |
277 | Backwards Compatibility |
| 253 | ======================= |
278 | ======================= |
| 254 | - There are no backwards compatibility issues, as old versions of |
279 | - There are no backwards compatibility issues, as old versions of |
| … | |
… | |
| 259 | |
284 | |
| 260 | ====== |
285 | ====== |
| 261 | Thanks |
286 | Thanks |
| 262 | ====== |
287 | ====== |
| 263 | I'd like to thank the following people for input on this GLEP. |
288 | I'd like to thank the following people for input on this GLEP. |
|
|
289 | |
| 264 | - Patrick Lauer (patrick): Prodding me to get all of the tree-signing |
290 | - Patrick Lauer (patrick): Prodding me to get all of the tree-signing |
| 265 | work finished, and helping to edit. |
291 | work finished, and helping to edit. |
| 266 | - Ciaran McCreesh (ciaranm): Paludis Manifest2 |
292 | - Ciaran McCreesh (ciaranm): Paludis Manifest2 |
| 267 | - Brian Harring (ferringb): pkgcore Manifest2 |
293 | - Brian Harring (ferringb): pkgcore Manifest2 |
| 268 | - Marius Mauch (genone) & Zac Medico (zmedico): Portage Manifest2 |
294 | - Marius Mauch (genone) & Zac Medico (zmedico): Portage Manifest2 |
| … | |
… | |
| 276 | University of Arizona Technical Report TR08-02. Available online |
302 | University of Arizona Technical Report TR08-02. Available online |
| 277 | from: ftp://ftp.cs.arizona.edu/reports/2008/TR08-02.pdf |
303 | from: ftp://ftp.cs.arizona.edu/reports/2008/TR08-02.pdf |
| 278 | [C08b] Cappos, J et al. (2008). "Attacks on Package Managers" |
304 | [C08b] Cappos, J et al. (2008). "Attacks on Package Managers" |
| 279 | Available online at: |
305 | Available online at: |
| 280 | http://www.cs.arizona.edu/people/justin/packagemanagersecurity/ |
306 | http://www.cs.arizona.edu/people/justin/packagemanagersecurity/ |
|
|
307 | [#GLEPxx+2] Future GLEP on Developer Process security. |
|
|
308 | [#GLEPxx+3] Future GLEP on GnuPG Policies and Handling. |
| 281 | |
309 | |
| 282 | ========= |
310 | ========= |
| 283 | Copyright |
311 | Copyright |
| 284 | ========= |
312 | ========= |
| 285 | Copyright (c) 2006 by Robin Hugh Johnson. This material may be |
313 | Copyright (c) 2006-2010 by Robin Hugh Johnson. This material may be |
| 286 | distributed only subject to the terms and conditions set forth in the |
314 | distributed only subject to the terms and conditions set forth in the |
| 287 | Open Publication License, v1.0. |
315 | Open Publication License, v1.0. |
| 288 | |
316 | |
| 289 | vim: tw=72 ts=2 expandtab: |
317 | vim: tw=72 ts=2 expandtab: |