You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

273 lines
11 KiB

  1. <?xml version="1.0" encoding="utf-8" standalone="no"?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "" [
  4. <!ENTITY % aptent SYSTEM "apt.ent"> %aptent;
  5. <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
  6. <!ENTITY % aptvendor SYSTEM "apt-vendor.ent"> %aptvendor;
  7. ]>
  8. <refentry>
  9. <refentryinfo>
  10. &apt-author.jgunthorpe;
  11. &;
  12. &apt-email;
  13. &apt-product;
  14. <!-- The last update date -->
  15. <date>2016-08-06T00:00:00Z</date>
  16. </refentryinfo>
  17. <refmeta>
  18. <refentrytitle>apt-secure</refentrytitle>
  19. <manvolnum>8</manvolnum>
  20. <refmiscinfo class="manual">APT</refmiscinfo>
  21. </refmeta>
  22. <!-- NOTE: This manpage has been written based on the
  23. Securing Debian Manual ("Debian Security
  24. Infrastructure" chapter) and on documentation
  25. available at the following sites:
  29. -->
  30. <!-- TODO: write a more verbose example of how it works with
  31. a sample similar to
  33. ?
  34. -->
  35. <!-- Man page title -->
  36. <refnamediv>
  37. <refname>apt-secure</refname>
  38. <refpurpose>Archive authentication support for APT</refpurpose>
  39. </refnamediv>
  40. <refsect1><title>Description</title>
  41. <para>
  42. Starting with version 0.6, <command>APT</command> contains code that does
  43. signature checking of the Release file for all repositories. This ensures
  44. that data like packages in the archive can't be modified by people who
  45. have no access to the Release file signing key. Starting with version 1.1
  46. <command>APT</command> requires repositories to provide recent authentication
  47. information for unimpeded usage of the repository. Since version 1.5 changes
  48. in the information contained in the Release file about the repository need to be
  49. confirmed before APT continues to apply updates from this repository.
  50. </para>
  51. <para>
  52. Note: All APT-based package management front-ends like &apt-get;, &aptitude;
  53. and &synaptic; support this authentication feature, so this manpage uses
  54. <literal>APT</literal> to refer to them all for simplicity only.
  55. </para>
  56. </refsect1>
  57. <refsect1><title>Unsigned Repositories</title>
  58. <para>
  59. If an archive has an unsigned Release file or no Release file at all
  60. current APT versions will refuse to download data from them by default
  61. in <command>update</command> operations and even if forced to download
  62. front-ends like &apt-get; will require explicit confirmation if an
  63. installation request includes a package from such an unauthenticated
  64. archive.
  65. </para>
  66. <para>
  67. You can force all APT clients to raise only warnings by setting the
  68. configuration option <option>Acquire::AllowInsecureRepositories</option> to
  69. <literal>true</literal>. Individual repositories can also be allowed to be insecure
  70. via the &sources-list; option <literal>allow-insecure=yes</literal>.
  71. Note that insecure repositories are strongly discouraged and all options
  72. to force apt to continue supporting them will eventually be removed.
  73. Users also have the <option>Trusted</option> option available to disable
  74. even the warnings, but be sure to understand the implications as detailed in
  75. &sources-list;.
  76. </para>
  77. <para>
  78. A repository which previously was authenticated but would loose this state in
  79. an <command>update</command> operation raises an error in all APT clients
  80. irrespective of the option to allow or forbid usage of insecure repositories.
  81. The error can be overcome by additionally setting
  82. <option>Acquire::AllowDowngradeToInsecureRepositories</option>
  83. to <literal>true</literal> or for Individual repositories with the &sources-list;
  84. option <literal>allow-downgrade-to-insecure=yes</literal>.
  85. </para>
  86. </refsect1>
  87. <refsect1><title>Signed Repositories</title>
  88. <para>
  89. The chain of trust from an APT archive to the end user is made up of
  90. several steps. <command>apt-secure</command> is the last step in
  91. this chain; trusting an archive does not mean that you trust its
  92. packages not to contain malicious code, but means that you
  93. trust the archive maintainer. It's the archive maintainer's
  94. responsibility to ensure that the archive's integrity is preserved.
  95. </para>
  96. <para>apt-secure does not review signatures at a
  97. package level. If you require tools to do this you should look at
  98. <command>debsig-verify</command> and
  99. <command>debsign</command> (provided in the debsig-verify and
  100. devscripts packages respectively).</para>
  101. <para>
  102. The chain of trust in Debian starts (e.g.) when a maintainer uploads a new
  103. package or a new version of a package to the Debian archive. In
  104. order to become effective, this upload needs to be signed by a key
  105. contained in one of the Debian package maintainer keyrings (available in
  106. the debian-keyring package). Maintainers' keys are signed by
  107. other maintainers following pre-established procedures to
  108. ensure the identity of the key holder. Similar procedures exist in all
  109. Debian-based distributions.
  110. </para>
  111. <para>
  112. Once the uploaded package is verified and included in the archive,
  113. the maintainer signature is stripped off, and checksums of the package
  114. are computed and put in the Packages file. The checksums of all of the
  115. Packages files are then computed and put into the Release file. The
  116. Release file is then signed by the archive key for this &keyring-distro; release,
  117. and distributed alongside the packages and the Packages files on
  118. &keyring-distro; mirrors. The keys are in the &keyring-distro; archive keyring
  119. available in the &keyring-package; package.
  120. </para>
  121. <para>
  122. End users can check the signature of the Release file, extract a checksum
  123. of a package from it and compare it with the checksum of the package
  124. they downloaded by hand - or rely on APT doing this automatically.
  125. </para>
  126. <para>Notice that this is distinct from checking signatures on a
  127. per package basis. It is designed to prevent two possible attacks:
  128. </para>
  129. <itemizedlist>
  130. <listitem><para><literal>Network "man in the middle"
  131. attacks</literal>. Without signature checking, malicious
  132. agents can introduce themselves into the package download process and
  133. provide malicious software either by controlling a network
  134. element (router, switch, etc.) or by redirecting traffic to a
  135. rogue server (through ARP or DNS spoofing
  136. attacks).</para></listitem>
  137. <listitem><para><literal>Mirror network compromise</literal>.
  138. Without signature checking, a malicious agent can compromise a
  139. mirror host and modify the files in it to propagate malicious
  140. software to all users downloading packages from that
  141. host.</para></listitem>
  142. </itemizedlist>
  143. <para>However, it does not defend against a compromise of the
  144. master server itself (which signs the packages) or against a
  145. compromise of the key used to sign the Release files. In any case,
  146. this mechanism can complement a per-package signature.</para>
  147. </refsect1>
  148. <refsect1><title>Information changes</title>
  149. <para>
  150. A Release file contains beside the checksums for the files in the repository
  151. also general information about the repository like the origin, codename or
  152. version number of the release.
  153. </para><para>
  154. This information is shown in various places so a repository owner should always
  155. ensure correctness. Further more user configuration like &apt-preferences;
  156. can depend and make use of this information. Since version 1.5 the user must
  157. therefore explicitly confirm changes to signal that the user is sufficiently
  158. prepared e.g. for the new major release of the distribution shipped in the
  159. repository (as e.g. indicated by the codename).
  160. </para>
  161. </refsect1>
  162. <refsect1><title>User Configuration</title>
  163. <para>
  164. <command>apt-key</command> is the program that manages the list of keys used
  165. by APT to trust repositories. It can be used to add or remove keys as well
  166. as list the trusted keys. Limiting which key(s) are able to sign which archive
  167. is possible via the <option>Signed-By</option> in &sources-list;.
  168. </para><para>
  169. Note that a default installation already contains all keys to securely
  170. acquire packages from the default repositories, so fiddling with
  171. <command>apt-key</command> is only needed if third-party repositories are
  172. added.
  173. </para><para>
  174. In order to add a new key you need to first download it
  175. (you should make sure you are using a trusted communication channel
  176. when retrieving it), add it with <command>apt-key</command> and
  177. then run <command>apt-get update</command> so that apt can download
  178. and verify the <filename>InRelease</filename> or <filename>Release.gpg</filename>
  179. files from the archives you have configured.
  180. </para>
  181. </refsect1>
  182. <refsect1><title>Repository Configuration</title>
  183. <para>
  184. If you want to provide archive signatures in an archive under your
  185. maintenance you have to:
  186. </para>
  187. <itemizedlist>
  188. <listitem><para><emphasis>Create a toplevel Release
  189. file</emphasis>, if it does not exist already. You can do this
  190. by running <command>apt-ftparchive release</command>
  191. (provided in apt-utils).</para></listitem>
  192. <listitem><para><emphasis>Sign it</emphasis>. You can do this by running
  193. <command>gpg --clearsign -o InRelease Release</command> and
  194. <command>gpg -abs -o Release.gpg Release</command>.</para></listitem>
  195. <listitem><para>
  196. <emphasis>Publish the key fingerprint</emphasis>, so that your users
  197. will know what key they need to import in order to authenticate the files
  198. in the archive. It is best to ship your key in its own keyring package
  199. like &keyring-distro; does with &keyring-package; to be able to
  200. distribute updates and key transitions automatically later.
  201. </para></listitem>
  202. <listitem><para>
  203. <emphasis>Provide instructions on how to add your archive and key</emphasis>.
  204. If your users can't acquire your key securely the chain of trust described above is broken.
  205. How you can help users add your key depends on your archive and target audience ranging
  206. from having your keyring package included in another archive users already have configured
  207. (like the default repositories of their distribution) to leveraging the web of trust.
  208. </para></listitem>
  209. </itemizedlist>
  210. <para>Whenever the contents of the archive change (new packages
  211. are added or removed) the archive maintainer has to follow the
  212. first two steps outlined above.</para>
  213. </refsect1>
  214. <refsect1><title>See Also</title>
  215. <para>
  216. &apt-conf;, &apt-get;, &sources-list;, &apt-key;, &apt-ftparchive;,
  217. &debsign;, &debsig-verify;, &gpg;
  218. </para>
  219. <para>For more background information you might want to review the
  220. <ulink
  221. url="">Debian
  222. Security Infrastructure</ulink> chapter of the Securing Debian Manual
  223. (also available in the harden-doc package) and the
  224. <ulink url=""
  225. >Strong Distribution HOWTO</ulink> by V. Alex Brennen. </para>
  226. </refsect1>
  227. &manbugs;
  228. &manauthor;
  229. <refsect1><title>Manpage Authors</title>
  230. <para>This man-page is based on the work of Javier Fernández-Sanguino
  231. Peña, Isaac Jones, Colin Walters, Florian Weimer and Michael Vogt.
  232. </para>
  233. </refsect1>
  234. </refentry>