| 1 |
#LyX 1.1 created this file. For more info see http://www.lyx.org/ |
| 2 |
\lyxformat 2.15 |
| 3 |
\textclass article |
| 4 |
\language default |
| 5 |
\inputencoding latin1 |
| 6 |
\fontscheme default |
| 7 |
\graphics default |
| 8 |
\paperfontsize default |
| 9 |
\spacing single |
| 10 |
\papersize Default |
| 11 |
\paperpackage a4 |
| 12 |
\use_geometry 0 |
| 13 |
\use_amsmath 0 |
| 14 |
\paperorientation portrait |
| 15 |
\secnumdepth 3 |
| 16 |
\tocdepth 3 |
| 17 |
\paragraph_separation indent |
| 18 |
\defskip medskip |
| 19 |
\quotes_language english |
| 20 |
\quotes_times 2 |
| 21 |
\papercolumns 1 |
| 22 |
\papersides 1 |
| 23 |
\paperpagestyle default |
| 24 |
|
| 25 |
\layout Title |
| 26 |
|
| 27 |
Package Verification with dpkg: Implementation |
| 28 |
\layout Author |
| 29 |
|
| 30 |
John Goerzen <[email protected]> |
| 31 |
\layout Date |
| 32 |
|
| 33 |
Version 5; January 4, 2001 |
| 34 |
\layout Section |
| 35 |
|
| 36 |
Introduction |
| 37 |
\layout Standard |
| 38 |
|
| 39 |
As part of a continuing effort to improve the security of users of Debian |
| 40 |
and Debian-based systems, one step that is important to take is to allow |
| 41 |
the users to verify for themselves that .deb packages that they have are |
| 42 |
from an authentic source. |
| 43 |
This mechanism is intended to prevent various types of attacks. |
| 44 |
Some are: |
| 45 |
\layout Itemize |
| 46 |
|
| 47 |
Preventing people from setting up a fake Debian archive, containing potentially |
| 48 |
trojaned packages, and masquerading as a real Debian archive. |
| 49 |
This attack can be thwarted by checking an origin signature, checking archive |
| 50 |
signatures, or checking maintainer signatures. |
| 51 |
\layout Itemize |
| 52 |
|
| 53 |
Preventing altered .deb packages from being installed undetected. |
| 54 |
Since all signatures are applied to the contents, any signature that is |
| 55 |
checked will protect against this attack. |
| 56 |
\layout Itemize |
| 57 |
|
| 58 |
Preventing people from separating or inserting forged data or metadata into |
| 59 |
a package. |
| 60 |
Because all signatures are applied to both the control and the data chunks |
| 61 |
together, separating them will not be possible without causing a signature |
| 62 |
failure. |
| 63 |
\layout Itemize |
| 64 |
|
| 65 |
Helping to prevent old packages from being presented as new. |
| 66 |
By checking the signature date, policy files can be set to reject packages |
| 67 |
that contain old signatures. |
| 68 |
Sites might re-sign their packages periodically with an |
| 69 |
\begin_inset Quotes eld |
| 70 |
\end_inset |
| 71 |
|
| 72 |
archive |
| 73 |
\begin_inset Quotes erd |
| 74 |
\end_inset |
| 75 |
|
| 76 |
or a |
| 77 |
\begin_inset Quotes eld |
| 78 |
\end_inset |
| 79 |
|
| 80 |
timeliness |
| 81 |
\begin_inset Quotes erd |
| 82 |
\end_inset |
| 83 |
|
| 84 |
signature that could be used specifically for this purpose. |
| 85 |
\layout Itemize |
| 86 |
|
| 87 |
Allowing verification to ensure that a given package was part of a particular |
| 88 |
archive site, distribution, made by a particular developer, etc. |
| 89 |
Signatures could be applied for various stages of development -- approval |
| 90 |
by QA managers, release managers, etc. |
| 91 |
The multiple signature per .deb architecture outlined in this proposal allows |
| 92 |
this. |
| 93 |
\layout Itemize |
| 94 |
|
| 95 |
Allowing verification of an isolated .deb, even in the absence of an Internet |
| 96 |
connection or access to an archive. |
| 97 |
By including the signatures inside the .deb itself, it is not necessary |
| 98 |
to download signed index files to verify a signature. |
| 99 |
\layout Subsection |
| 100 |
|
| 101 |
Unaddressed Problems |
| 102 |
\layout Standard |
| 103 |
|
| 104 |
The approach set forth in this document leaves one hole that must be solved |
| 105 |
by other means. |
| 106 |
That problem is the task of insuring the integrity of the keys, policy |
| 107 |
files, and programs themselves used to carry out the verification. |
| 108 |
One potential solution is to modify apt-get to support https and use trusted |
| 109 |
third-party (e.g., Thawte) to shore up this problem. |
| 110 |
\layout Standard |
| 111 |
|
| 112 |
The mechanism used to ensure old packages are not presented as new might |
| 113 |
be resource-intensive on the server in some situations. |
| 114 |
One potential avenue to explore there might be to provide signed Packages |
| 115 |
files on the server. |
| 116 |
\layout Subsection |
| 117 |
|
| 118 |
Rationale |
| 119 |
\layout Standard |
| 120 |
|
| 121 |
Some thought has gone into the design of this particular solution. |
| 122 |
For benefit of future discussions, here is some information on how this |
| 123 |
mechanism was chosen and reasons for it. |
| 124 |
Here are the main alternatives that have been considered: |
| 125 |
\layout Description |
| 126 |
|
| 127 |
GPG\SpecialChar |
| 128 |
apt, genchanges, and various other utilities. |
| 129 |
The additional complexity of doing so and the possibility of separating |
| 130 |
the signature from the .deb makes this approach undesirable. |
| 131 |
\layout Description |
| 132 |
|
| 133 |
GPG\SpecialChar |
| 134 |
However, this would change the basic format of the .deb and render it |
| 135 |
unusable without a current dpkg and GPG installed on the system. |
| 136 |
Since it breaks backward compatibility in such a severe way, this approach |
| 137 |
is also undesirable. |
| 138 |
\layout Description |
| 139 |
|
| 140 |
Sig-per-chunk A sig-per-chunk system would place separate sigs in the ar |
| 141 |
file for the data and the control chunks. |
| 142 |
Unfortunately, this would allow someone to mix and match data and control |
| 143 |
data in making trojan .debs, which can also be a security threat. |
| 144 |
\layout Description |
| 145 |
|
| 146 |
Sig-per-repository A sig-per-repository system would place an md5sum of |
| 147 |
a .deb into the Packages files and sign those. |
| 148 |
However, this omits fine-grained control and prevents verification of a |
| 149 |
.deb in absence of the Packages file from the Internet. |
| 150 |
It also requires solutions to problems of determining which archive a package |
| 151 |
came from. |
| 152 |
\layout Standard |
| 153 |
|
| 154 |
The policy files (see section |
| 155 |
\begin_inset LatexCommand \ref{Policy Definitions} |
| 156 |
|
| 157 |
\end_inset |
| 158 |
|
| 159 |
) are designed to be simple, straightforward, and easy to both write and |
| 160 |
parse. |
| 161 |
By keeping them as simple as possible, the potential for both human authoring |
| 162 |
errors and parsing errors in software can be minimized. |
| 163 |
\layout Section |
| 164 |
|
| 165 |
Modifications to .deb |
| 166 |
\layout Standard |
| 167 |
|
| 168 |
Currently, a .deb consists of an ar archive containing debian-binary, control.tar.g |
| 169 |
z, and data.tar.gz files. |
| 170 |
These files represent package meta-data and package contents, respectively. |
| 171 |
Each signature will be applied to the debian-binary, control.tar.gz, and |
| 172 |
data.tar.gz files concatenated together in that order. |
| 173 |
The files should not be decompressed before applying the signature. |
| 174 |
\layout Standard |
| 175 |
|
| 176 |
Each signature file will be stored in the ar archive and have a name of |
| 177 |
this form: |
| 178 |
\layout Standard |
| 179 |
|
| 180 |
_gpg |
| 181 |
\emph on |
| 182 |
type |
| 183 |
\layout Standard |
| 184 |
|
| 185 |
Therefore, an origin signature would be named _gpgorigin. |
| 186 |
The |
| 187 |
\begin_inset Quotes eld |
| 188 |
\end_inset |
| 189 |
|
| 190 |
type |
| 191 |
\begin_inset Quotes erd |
| 192 |
\end_inset |
| 193 |
|
| 194 |
string must not exceed 10 characters in length nor be less than 1 character. |
| 195 |
\layout Standard |
| 196 |
|
| 197 |
Therefore, an origin signature in GnuPG format would be named _sig-origin.gpg. |
| 198 |
At this time, all signatures must be in GnuPG format. |
| 199 |
\layout Section |
| 200 |
|
| 201 |
Signatures and Types |
| 202 |
\layout Standard |
| 203 |
|
| 204 |
Each .deb file that is signed must have at least an origin signature. |
| 205 |
This signature should be unique per entity. |
| 206 |
For instance, Debian, Helix, and Progeny would each provide an origin signature. |
| 207 |
The origin signature is used as a key into the policy database such that |
| 208 |
the proper policy description can be loaded to describe the file. |
| 209 |
\layout Standard |
| 210 |
|
| 211 |
Beyond the origin signature, the signature types that are present or required |
| 212 |
are defined by the site policy. |
| 213 |
Examples of other signatures might be a maintainer signature from the person |
| 214 |
that built the package, a signature from quality assurance certifying that |
| 215 |
the package has passed QA tests, a signature from a release manager certifying |
| 216 |
that a package was part of a given distribution release, and a signature |
| 217 |
from an archive maintainer certifying that the package went into an archive. |
| 218 |
\layout Section |
| 219 |
|
| 220 |
A Runthrough |
| 221 |
\layout Standard |
| 222 |
|
| 223 |
To make sure the entire process is entirely clear, here is what will occur |
| 224 |
when a package is processed: |
| 225 |
\layout Enumerate |
| 226 |
|
| 227 |
The Key ID of the origin signature will be obtained. |
| 228 |
This will be used to determine the directory in which to look for policy |
| 229 |
files and keyrings as specified in section |
| 230 |
\begin_inset LatexCommand \ref{locations} |
| 231 |
|
| 232 |
\end_inset |
| 233 |
|
| 234 |
. |
| 235 |
\layout Enumerate |
| 236 |
|
| 237 |
The checker will iterate over each policy file in that directory in an arbitrary |
| 238 |
order, doing the following: |
| 239 |
\begin_deeper |
| 240 |
\layout Enumerate |
| 241 |
|
| 242 |
Compare the Origin: line in the policy file (see section |
| 243 |
\begin_inset LatexCommand \ref{Origin line} |
| 244 |
|
| 245 |
\end_inset |
| 246 |
|
| 247 |
) with the Key ID of the origin signature. |
| 248 |
If there is a difference, immediately die because of suspected corrupted |
| 249 |
policy files. |
| 250 |
\layout Enumerate |
| 251 |
|
| 252 |
Evaluate the selection clauses, if any, in the policy file. |
| 253 |
If there are any that do not pass, skip to the next policy file. |
| 254 |
If all of them pass, or there are no selection clauses, adopt the current |
| 255 |
policy file as authoritative for the package. |
| 256 |
\layout Enumerate |
| 257 |
|
| 258 |
If no appropriate policy files are found, reject the package as having a |
| 259 |
bad (unverifyable) signature. |
| 260 |
\end_deeper |
| 261 |
\layout Enumerate |
| 262 |
|
| 263 |
Given the appropriate policy file, the checker will iterate over every verificat |
| 264 |
ion clause in that file. |
| 265 |
If all of them pass, the package is considered to pass the test. |
| 266 |
If any of them fail, the package is considered to have failed the test |
| 267 |
and processing immediately exits. |
| 268 |
No other policy files will ever be tested after this point. |
| 269 |
If the policy file contains no verification clauses, it will be rejected |
| 270 |
as invalid. |
| 271 |
\layout Standard |
| 272 |
|
| 273 |
It is possible that other package verifiers that use the same .deb architecture |
| 274 |
but different verification procedures may be introduced in the future. |
| 275 |
This section is not intended to imply a prohibition against such. |
| 276 |
\layout Section |
| 277 |
|
| 278 |
File Locations |
| 279 |
\layout Standard |
| 280 |
|
| 281 |
The following locations are defined for files that comprise this system: |
| 282 |
\begin_inset LatexCommand \label{locations} |
| 283 |
|
| 284 |
\end_inset |
| 285 |
|
| 286 |
|
| 287 |
\layout Itemize |
| 288 |
|
| 289 |
/etc/debsigs/policy/ |
| 290 |
\emph on |
| 291 |
Origin-ID |
| 292 |
\emph default |
| 293 |
/* contains one or more policy files that are to be applied for .debs whose |
| 294 |
Origin key was signed by the Key ID as listed in the path. |
| 295 |
The policies are tried in a non-deterministic order until one matches the |
| 296 |
selection criteria. |
| 297 |
Once one matches the selection criteria, the success or failure of the |
| 298 |
entire check is entirely contingent upon the success or failure of the |
| 299 |
verification clauses. |
| 300 |
If no policy file matches the selection criteria, then the entire operation |
| 301 |
is determined to fail. |
| 302 |
\layout Itemize |
| 303 |
|
| 304 |
/usr/share/debsigs/keyrings/ |
| 305 |
\emph on |
| 306 |
Origin-ID |
| 307 |
\emph default |
| 308 |
/* contains one or more keyrings that are used by the policy files for the |
| 309 |
given origin. |
| 310 |
They may be symlinks to keyrings located elsewhere if desired. |
| 311 |
This is used as the directory for the keyrings in the RequiredSig and OptionalS |
| 312 |
ig lines unless an absolute path is specified there. |
| 313 |
\layout Standard |
| 314 |
|
| 315 |
The policy files are located in /etc because sites may opt to alter the |
| 316 |
criteria for installing files on their site. |
| 317 |
The keyrings are located in /usr/share because they should not be altered |
| 318 |
locally. |
| 319 |
Because of the multi-file and multi-directory nature, it is easy for organizati |
| 320 |
ons to provide packages providing information for verification of certain |
| 321 |
things. |
| 322 |
For instance, Debian could provide a debian-debsigs-potato package which |
| 323 |
contains a policy file and a potato release file. |
| 324 |
It could depend on debian-debsigs-main package, which contains the keyring |
| 325 |
for the origin field, a symlink to the main Debian keyring for the maintainers |
| 326 |
field, and a dependency on debian-keyring. |
| 327 |
\layout Section |
| 328 |
|
| 329 |
Related Documents |
| 330 |
\layout Bibliography |
| 331 |
\bibitem {1} |
| 332 |
|
| 333 |
de Winter, Brenno. |
| 334 |
|
| 335 |
\emph on |
| 336 |
Gnu Privacy Guard Mini Howto |
| 337 |
\emph default |
| 338 |
at http://www.dewinter.com/gnupg_howto/english/. |
| 339 |
\layout Bibliography |
| 340 |
\bibitem {2} |
| 341 |
|
| 342 |
Free Software Foundation. |
| 343 |
|
| 344 |
\emph on |
| 345 |
The GNU Privacy Handbook |
| 346 |
\emph default |
| 347 |
at http://www.gnupg.org/gph/en/manual.html. |
| 348 |
\layout Bibliography |
| 349 |
\bibitem {3} |
| 350 |
|
| 351 |
Free Software Foundation. |
| 352 |
|
| 353 |
\emph on |
| 354 |
gpg manpage |
| 355 |
\emph default |
| 356 |
available on local systems with gpg or at http://www.gnupg.org/gpgman.html. |
| 357 |
\layout Bibliography |
| 358 |
\bibitem {4} |
| 359 |
|
| 360 |
Braakman, Dorman, et al. |
| 361 |
|
| 362 |
\emph on |
| 363 |
Debian Packaging Manual |
| 364 |
\emph default |
| 365 |
at http://www.debian.org/doc/packaging-manuals/packaging.html/. |
| 366 |
\layout Bibliography |
| 367 |
\bibitem {5} |
| 368 |
|
| 369 |
Quinlan, Daniel. |
| 370 |
|
| 371 |
\emph on |
| 372 |
Filesystem Hierarchy Standard |
| 373 |
\emph default |
| 374 |
at http://www.pathname.com/fhs/. |
| 375 |
\layout LyX-Code |
| 376 |
|
| 377 |
\the_end |