apt-secure.8.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <?xml version="1.0" encoding="utf-8" standalone="no"?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  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. &apt-author.team;
  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:
  26. http://wiki.debian.net/?apt06
  27. http://www.syntaxpolice.org/apt-secure/
  28. http://www.enyo.de/fw/software/apt-secure/
  29. -->
  30. <!-- TODO: write a more verbose example of how it works with
  31. a sample similar to
  32. http://www.debian-administration.org/articles/174
  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.
  48. </para>
  49. <para>
  50. If an archive has an unsigned Release file or no Release file at all
  51. current APT versions will refuse to download data from them by default
  52. in <command>update</command> operations and even if forced to download
  53. front-ends like &apt-get; will require explicit confirmation if an
  54. installation request includes a package from such an unauthenticated
  55. archive.
  56. </para>
  57. <para>
  58. As a temporary exception &apt-get; (not &apt;!) raises warnings only if it
  59. encounters unauthenticated archives to give a slightly longer grace period
  60. on this backward compatibility effecting change. This exception will be removed
  61. in future releases and you can opt-out of this grace period by setting the
  62. configuration option <option>Binary::apt-get::Acquire::AllowInsecureRepositories</option>
  63. to <literal>false</literal> or <option>--no-allow-insecure-repositories</option>
  64. on the command line.
  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. <para>
  87. Note: All APT-based package management front-ends like &apt-get;, &aptitude;
  88. and &synaptic; support this authentication feature, so this manpage uses
  89. <literal>APT</literal> to refer to them all for simplicity only.
  90. </para>
  91. </refsect1>
  92. <refsect1><title>Trusted Repositories</title>
  93. <para>
  94. The chain of trust from an APT archive to the end user is made up of
  95. several steps. <command>apt-secure</command> is the last step in
  96. this chain; trusting an archive does not mean that you trust its
  97. packages not to contain malicious code, but means that you
  98. trust the archive maintainer. It's the archive maintainer's
  99. responsibility to ensure that the archive's integrity is preserved.
  100. </para>
  101. <para>apt-secure does not review signatures at a
  102. package level. If you require tools to do this you should look at
  103. <command>debsig-verify</command> and
  104. <command>debsign</command> (provided in the debsig-verify and
  105. devscripts packages respectively).</para>
  106. <para>
  107. The chain of trust in Debian starts (e.g.) when a maintainer uploads a new
  108. package or a new version of a package to the Debian archive. In
  109. order to become effective, this upload needs to be signed by a key
  110. contained in one of the Debian package maintainer keyrings (available in
  111. the debian-keyring package). Maintainers' keys are signed by
  112. other maintainers following pre-established procedures to
  113. ensure the identity of the key holder. Similar procedures exist in all
  114. Debian-based distributions.
  115. </para>
  116. <para>
  117. Once the uploaded package is verified and included in the archive,
  118. the maintainer signature is stripped off, and checksums of the package
  119. are computed and put in the Packages file. The checksums of all of the
  120. Packages files are then computed and put into the Release file. The
  121. Release file is then signed by the archive key for this &keyring-distro; release,
  122. and distributed alongside the packages and the Packages files on
  123. &keyring-distro; mirrors. The keys are in the &keyring-distro; archive keyring
  124. available in the &keyring-package; package.
  125. </para>
  126. <para>
  127. End users can check the signature of the Release file, extract a checksum
  128. of a package from it and compare it with the checksum of the package
  129. they downloaded by hand - or rely on APT doing this automatically.
  130. </para>
  131. <para>Notice that this is distinct from checking signatures on a
  132. per package basis. It is designed to prevent two possible attacks:
  133. </para>
  134. <itemizedlist>
  135. <listitem><para><literal>Network "man in the middle"
  136. attacks</literal>. Without signature checking, malicious
  137. agents can introduce themselves into the package download process and
  138. provide malicious software either by controlling a network
  139. element (router, switch, etc.) or by redirecting traffic to a
  140. rogue server (through ARP or DNS spoofing
  141. attacks).</para></listitem>
  142. <listitem><para><literal>Mirror network compromise</literal>.
  143. Without signature checking, a malicious agent can compromise a
  144. mirror host and modify the files in it to propagate malicious
  145. software to all users downloading packages from that
  146. host.</para></listitem>
  147. </itemizedlist>
  148. <para>However, it does not defend against a compromise of the
  149. master server itself (which signs the packages) or against a
  150. compromise of the key used to sign the Release files. In any case,
  151. this mechanism can complement a per-package signature.</para>
  152. </refsect1>
  153. <refsect1><title>User Configuration</title>
  154. <para>
  155. <command>apt-key</command> is the program that manages the list of keys used
  156. by APT to trust repositories. It can be used to add or remove keys as well
  157. as list the trusted keys. Limiting which key(s) are able to sign which archive
  158. is possible via the <option>Signed-By</option> in &sources-list;.
  159. </para><para>
  160. Note that a default installation already contains all keys to securely
  161. acquire packages from the default repositories, so fiddling with
  162. <command>apt-key</command> is only needed if third-party repositories are
  163. added.
  164. </para><para>
  165. In order to add a new key you need to first download it
  166. (you should make sure you are using a trusted communication channel
  167. when retrieving it), add it with <command>apt-key</command> and
  168. then run <command>apt-get update</command> so that apt can download
  169. and verify the <filename>InRelease</filename> or <filename>Release.gpg</filename>
  170. files from the archives you have configured.
  171. </para>
  172. </refsect1>
  173. <refsect1><title>Archive Configuration</title>
  174. <para>
  175. If you want to provide archive signatures in an archive under your
  176. maintenance you have to:
  177. </para>
  178. <itemizedlist>
  179. <listitem><para><emphasis>Create a toplevel Release
  180. file</emphasis>, if it does not exist already. You can do this
  181. by running <command>apt-ftparchive release</command>
  182. (provided in apt-utils).</para></listitem>
  183. <listitem><para><emphasis>Sign it</emphasis>. You can do this by running
  184. <command>gpg --clearsign -o InRelease Release</command> and
  185. <command>gpg -abs -o Release.gpg Release</command>.</para></listitem>
  186. <listitem><para>
  187. <emphasis>Publish the key fingerprint</emphasis>, so that your users
  188. will know what key they need to import in order to authenticate the files
  189. in the archive. It is best to ship your key in its own keyring package
  190. like &keyring-distro; does with &keyring-package; to be able to
  191. distribute updates and key transitions automatically later.
  192. </para></listitem>
  193. <listitem><para>
  194. <emphasis>Provide instructions on how to add your archive and key</emphasis>.
  195. If your users can't acquire your key securely the chain of trust described above is broken.
  196. How you can help users add your key depends on your archive and target audience ranging
  197. from having your keyring package included in another archive users already have configured
  198. (like the default repositories of their distribution) to leveraging the web of trust.
  199. </para></listitem>
  200. </itemizedlist>
  201. <para>Whenever the contents of the archive change (new packages
  202. are added or removed) the archive maintainer has to follow the
  203. first two steps outlined above.</para>
  204. </refsect1>
  205. <refsect1><title>See Also</title>
  206. <para>
  207. &apt-conf;, &apt-get;, &sources-list;, &apt-key;, &apt-ftparchive;,
  208. &debsign;, &debsig-verify;, &gpg;
  209. </para>
  210. <para>For more background information you might want to review the
  211. <ulink
  212. url="https://www.debian.org/doc/manuals/securing-debian-howto/ch7">Debian
  213. Security Infrastructure</ulink> chapter of the Securing Debian Manual
  214. (also available in the harden-doc package) and the
  215. <ulink url="http://www.cryptnet.net/fdp/crypto/strong_distro.html"
  216. >Strong Distribution HOWTO</ulink> by V. Alex Brennen. </para>
  217. </refsect1>
  218. &manbugs;
  219. &manauthor;
  220. <refsect1><title>Manpage Authors</title>
  221. <para>This man-page is based on the work of Javier Fernández-Sanguino
  222. Peña, Isaac Jones, Colin Walters, Florian Weimer and Michael Vogt.
  223. </para>
  224. </refsect1>
  225. </refentry>