index.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <link rel="shortcut icon" href="../../../img/favicon.ico">
  9. <title>Installation de Knot-resolver - Les Tutoriels du Yojik</title>
  10. <link rel="stylesheet" href="../../../css/theme.css" />
  11. <link rel="stylesheet" href="../../../css/theme_extra.css" />
  12. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" />
  13. <script>
  14. // Current page data
  15. var mkdocs_page_name = "Installation de Knot-resolver";
  16. var mkdocs_page_input_path = "Tutoriels/tutoraspi/Knot.md";
  17. var mkdocs_page_url = null;
  18. </script>
  19. <script src="../../../js/jquery-2.1.1.min.js" defer></script>
  20. <script src="../../../js/modernizr-2.8.3.min.js" defer></script>
  21. <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
  22. <script>hljs.initHighlightingOnLoad();</script>
  23. </head>
  24. <body class="wy-body-for-nav" role="document">
  25. <div class="wy-grid-for-nav">
  26. <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
  27. <div class="wy-side-scroll">
  28. <div class="wy-side-nav-search">
  29. <a href="../../.." class="icon icon-home"> Les Tutoriels du Yojik</a>
  30. <div role="search">
  31. <form id ="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
  32. <input type="text" name="q" placeholder="Search docs" title="Type search term here" />
  33. </form>
  34. </div>
  35. </div>
  36. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  37. <p class="caption"><span class="caption-text">Home</span></p>
  38. <ul>
  39. <li class="toctree-l1"><a class="reference internal" href="../../..">Page d'accueil</a>
  40. </li>
  41. </ul>
  42. <p class="caption"><span class="caption-text">Tutoriels</span></p>
  43. <ul class="current">
  44. <li class="toctree-l1"><a class="reference internal" href="../../tutos/">Introduction</a>
  45. </li>
  46. <li class="toctree-l1"><a class="reference internal" href="#">Installation d'un serveur sécurisé, version Debian/Stretch (obsolète)</a>
  47. <ul>
  48. <li class="toctree-l2"><a class="reference internal" href="../../tutostretch/tutostretch/">Présentation</a>
  49. </li>
  50. <li class="toctree-l2"><a class="reference internal" href="#">Installation</a>
  51. <ul>
  52. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-de-base/">Installation du système de base</a>
  53. </li>
  54. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/ovh/">Démarrage sur serveur OVH</a>
  55. </li>
  56. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Premi%C3%A8re-Etape-S%C3%A9curisation/">Première étapes de sécurisation du serveur</a>
  57. </li>
  58. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Configuration-R%C3%A9seau/">Configuration du réseau</a>
  59. </li>
  60. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-Serveur-Temps/">Installation d'un serveur de temps</a>
  61. </li>
  62. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-Parre-Feu/">Installation d'un pare-feu</a>
  63. </li>
  64. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-Fail2ban/">Contrer les attaques de brute-force avec fail2ban</a>
  65. </li>
  66. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-Serveur-Courrier-Basique/">Installation d'un serveur de courrier basique</a>
  67. </li>
  68. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-Serveur-DNS/">Installation du serveur DNS</a>
  69. </li>
  70. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-Serveur-Web/">Installation d'un serveur web</a>
  71. </li>
  72. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-Dovecot-Authentification/">Installation de dovecot et de l'authentification</a>
  73. </li>
  74. <li class="toctree-l3"><a class="" href="../../tutostretch/Installation-Certificats-Letsencrypt.md)">Installation des certificats letsencrypt</a>
  75. </li>
  76. <li class="toctree-l3"><a class="" href="../../tutostretch/courrier-SPF-DKIM-OPENDMARC.md">Ajout des enregistrements **spf**, **DKIM**, **DMARC** au fichier de zone DNS</a>
  77. </li>
  78. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Courrier-Comptes-Virtuels/">Ajout des comptes émail virtuels</a>
  79. </li>
  80. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Surveillance-Serveur/">Installation de programmes de surveillance du serveur</a>
  81. </li>
  82. <li class="toctree-l3"><a class="reference internal" href="../../tutostretch/Installation-Webmail/">Installation d'un webmail (rainloop)</a>
  83. </li>
  84. <li class="toctree-l3"><a class="" href="../../tutostretch/Sécurisation-Serveur-Web">Sécurisation d'un serveur WEB</a>
  85. </li>
  86. </ul>
  87. </li>
  88. </ul>
  89. </li>
  90. <li class="toctree-l1"><a class="reference internal" href="#">Installation d'un serveur sécurisé, version Debian/Buster (en cours d'écriture)</a>
  91. <ul>
  92. <li class="toctree-l2"><a class="reference internal" href="../../tutobuster/1-tutobuster/">Présentation</a>
  93. </li>
  94. <li class="toctree-l2"><a class="reference internal" href="../../tutobuster/2-Installation-de-base/">Installation de base</a>
  95. </li>
  96. <li class="toctree-l2"><a class="reference internal" href="../../tutobuster/3-ovh/">Démarrage sur serveur OVH</a>
  97. </li>
  98. <li class="toctree-l2"><a class="reference internal" href="../../tutobuster/4-Plan/">Plan d'ensemble</a>
  99. </li>
  100. <li class="toctree-l2"><a class="reference internal" href="../../tutobuster/5-Premi%C3%A8re-Etape-S%C3%A9curisation/">Premières étapes de sécurisation du serveur</a>
  101. </li>
  102. </ul>
  103. </li>
  104. <li class="toctree-l1 current"><a class="reference internal current" href="#">Installation d'un serveur sécurisé, version Debian/Buster sur RaspberryPI</a>
  105. <ul class="current">
  106. <li class="toctree-l2"><a class="reference internal" href="../tutoraspi/">Présentation</a>
  107. </li>
  108. <li class="toctree-l2"><a class="reference internal" href="../Installation-de-base/">Installation de base</a>
  109. </li>
  110. <li class="toctree-l2"><a class="reference internal" href="../Premier-d%C3%A9marrage/">Premier démarrage</a>
  111. </li>
  112. <li class="toctree-l2"><a class="reference internal" href="../Etat-des-lieux/">État des lieux</a>
  113. </li>
  114. <li class="toctree-l2"><a class="reference internal" href="../S%C3%A9curisation-SSH/">Sécurisation SSH</a>
  115. </li>
  116. <li class="toctree-l2"><a class="reference internal" href="../R%C3%A9seau/">Réseau (des IPs fixes)</a>
  117. </li>
  118. <li class="toctree-l2 current"><a class="reference internal current" href="./">Installation de Knot-resolver</a>
  119. <ul class="current">
  120. <li class="toctree-l3"><a class="reference internal" href="#installation">Installation</a>
  121. </li>
  122. <li class="toctree-l3"><a class="reference internal" href="#configuration">Configuration</a>
  123. </li>
  124. <li class="toctree-l3"><a class="reference internal" href="#lancement-et-mise-en-service-automatique">Lancement et mise en service automatique</a>
  125. </li>
  126. <li class="toctree-l3"><a class="reference internal" href="#modification-de-etcdhcpcdconf">Modification de /etc/dhcpcd.conf</a>
  127. </li>
  128. </ul>
  129. </li>
  130. <li class="toctree-l2"><a class="reference internal" href="../Firewall/">Installation d'un pare-feux</a>
  131. </li>
  132. <li class="toctree-l2"><a class="reference internal" href="../Fail2ban/">Contrer les attaques de force brute</a>
  133. </li>
  134. <li class="toctree-l2"><a class="reference internal" href="../Logwatch/">Surveillance du serveur</a>
  135. </li>
  136. <li class="toctree-l2"><a class="reference internal" href="../Installation-courrier-basique/">Installation d'un serveur de courriers basique</a>
  137. </li>
  138. <li class="toctree-l2"><a class="reference internal" href="../Annexe/">Annexe</a>
  139. </li>
  140. </ul>
  141. </li>
  142. </ul>
  143. </div>
  144. </div>
  145. </nav>
  146. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  147. <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
  148. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  149. <a href="../../..">Les Tutoriels du Yojik</a>
  150. </nav>
  151. <div class="wy-nav-content">
  152. <div class="rst-content">
  153. <div role="navigation" aria-label="breadcrumbs navigation">
  154. <ul class="wy-breadcrumbs">
  155. <li><a href="../../..">Docs</a> &raquo;</li>
  156. <li>Installation d'un serveur sécurisé, version Debian/Buster sur RaspberryPI &raquo;</li>
  157. <li>Tutoriels &raquo;</li>
  158. <li>Installation de Knot-resolver</li>
  159. <li class="wy-breadcrumbs-aside">
  160. </li>
  161. </ul>
  162. <hr/>
  163. </div>
  164. <div role="main">
  165. <div class="section">
  166. <h1 id="installation-de-knot-resolver">Installation de knot-resolver</h1>
  167. <p>Nous allons suivre la documentation officielle située ici : <a href="https://knot-resolver.readthedocs.io/en/stable/quickstart-startup.html">knot-resolver</a></p>
  168. <h2 id="installation">Installation</h2>
  169. <p>Installation du resolver et des programmes utilitaires</p>
  170. <pre><code>pi@piras:~ $ sudo apt install knot-resolver knot-dnsutils
  171. </code></pre>
  172. <h2 id="configuration">Configuration</h2>
  173. <p>Voilà le contenu de mon fichier de configuration /etc/knot-resolver/kresd.conf :</p>
  174. <pre><code>pi@piras:~ $ cat /etc/knot-resolver/kresd.conf
  175. -- Default empty Knot DNS Resolver configuration in -*- lua -*-
  176. -- Bind ports as privileged user (root) --
  177. net = { '127.0.0.1', '::1' }
  178. -- Switch to unprivileged user --
  179. user('knot-resolver','knot-resolver')
  180. -- Unprivileged
  181. -- cache.size = 100*MB
  182. pi@piras:~ $
  183. </code></pre>
  184. <p>J'ai dé-commenté les interfaces d'écoute.</p>
  185. <h2 id="lancement-et-mise-en-service-automatique">Lancement et mise en service automatique</h2>
  186. <p>On démarre le service</p>
  187. <pre><code>sudo systemctl start kresd@1.service
  188. </code></pre>
  189. <p>On rend le démarrage automatique</p>
  190. <pre><code>sudo systemctl enable --now kresd@1.service
  191. </code></pre>
  192. <p>On vérifie que le service est en route</p>
  193. <pre><code>sudo systemctl status kresd@1.service
  194. pi@piras:~ $ sudo systemctl status kresd@1.service
  195. ● kresd@1.service - Knot Resolver daemon
  196. Loaded: loaded (/lib/systemd/system/kresd@.service; enabled; vendor preset: enabled)
  197. Active: active (running) since Sat 2020-12-12 12:24:29 CET; 15min ago
  198. Docs: man:kresd.systemd(7)
  199. man:kresd(8)
  200. Main PID: 1905 (kresd)
  201. CGroup: /system.slice/system-kresd.slice/kresd@1.service
  202. └─1905 /usr/sbin/kresd --config=/etc/knot-resolver/kresd.conf
  203. déc. 12 12:24:28 piras systemd[1]: Starting Knot Resolver daemon...
  204. déc. 12 12:24:29 piras systemd[1]: Started Knot Resolver daemon.
  205. pi@piras:~ $
  206. </code></pre>
  207. <p>Il est actif (active (running))</p>
  208. <p>On teste le fonctionnement</p>
  209. <pre><code>pi@piras:~ $ kdig +short @localhost . NS
  210. a.root-servers.net.
  211. b.root-servers.net.
  212. c.root-servers.net.
  213. d.root-servers.net.
  214. e.root-servers.net.
  215. f.root-servers.net.
  216. g.root-servers.net.
  217. h.root-servers.net.
  218. i.root-servers.net.
  219. j.root-servers.net.
  220. k.root-servers.net.
  221. l.root-servers.net.
  222. m.root-servers.net.
  223. pi@piras:~ $
  224. </code></pre>
  225. <p>Tout fonctionne :D le résolveur écoute sur les ports 127.0.0.1 et ::1.</p>
  226. <h2 id="modification-de-etcdhcpcdconf">Modification de /etc/dhcpcd.conf</h2>
  227. <p>Nous allons pouvoir maintenant modifier la ligne :</p>
  228. <pre><code>#static domain_name_servers=192.168.1.1
  229. </code></pre>
  230. <p>pour obtenir ceci :</p>
  231. <pre><code>static domain_name_servers=127.0.0.1 ::1
  232. </code></pre>
  233. <p>Notre raspi fera appel dorénavant à son propre résolveur DNS (et non à celui de votre box !)</p>
  234. </div>
  235. </div>
  236. <footer>
  237. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  238. <a href="../Firewall/" class="btn btn-neutral float-right" title="Installation d'un pare-feux">Next <span class="icon icon-circle-arrow-right"></span></a>
  239. <a href="../R%C3%A9seau/" class="btn btn-neutral" title="Réseau (des IPs fixes)"><span class="icon icon-circle-arrow-left"></span> Previous</a>
  240. </div>
  241. <hr/>
  242. <div role="contentinfo">
  243. <!-- Copyright etc -->
  244. </div>
  245. Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
  246. </footer>
  247. </div>
  248. </div>
  249. </section>
  250. </div>
  251. <div class="rst-versions" role="note" aria-label="versions">
  252. <span class="rst-current-version" data-toggle="rst-current-version">
  253. <span><a href="../R%C3%A9seau/" style="color: #fcfcfc;">&laquo; Previous</a></span>
  254. <span style="margin-left: 15px"><a href="../Firewall/" style="color: #fcfcfc">Next &raquo;</a></span>
  255. </span>
  256. </div>
  257. <script>var base_url = '../../..';</script>
  258. <script src="../../../js/theme.js" defer></script>
  259. <script src="../../../search/main.js" defer></script>
  260. <script defer>
  261. window.onload = function () {
  262. SphinxRtdTheme.Navigation.enable(true);
  263. };
  264. </script>
  265. </body>
  266. </html>