{"id":17771,"date":"2025-01-11T23:06:13","date_gmt":"2025-01-11T22:06:13","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=17771"},"modified":"2025-01-13T13:37:05","modified_gmt":"2025-01-13T12:37:05","slug":"debian-automatisch-aktualisieren","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2025\/01\/11\/debian-automatisch-aktualisieren\/","title":{"rendered":"Debian automatisch aktualisieren"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Ich habe es nicht nur beruflich mit Linux zu tun, ich helfe auch privat gerne mal einem, der einen Server, f\u00fcr welchen Grund auch immer, einsetzt. Es gibt solche, die installieren keine Updates, weil sie dies nicht wollen &#8211; die Geschichte mit den Sicherheitsupdates wollen sie nicht verstehen. Dann gibt es auch solche, die mieten sich einen Server und installieren keine Updates, weil sie glauben, der Vermieter tue dies von sich aus &#8211; genau dies ist aber nicht der Fall. Andere wiederum installieren alle paar Monate mal Updates. Kritische Sicherheitsl\u00fccken werden aber recht schnell ausgenutzt &#8211; da sieht sich jetzt kein Angreifer einen einzelnen Server an, ob dieser ausnutzbare L\u00fccken hat &#8211; es geschieht automatisch \u00fcber Scripts, die das Internet durchsuchen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wir kennen die Geschichte &#8211; man verbindet sich via <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/10\/ssh-secure-shell-unter-linux-am-terminal-und-auf-der-grafischen-oberflaeche\/\" data-type=\"post\" data-id=\"2501\">SSH<\/a> mit dem Server, wird zum Benutzer root oder startet das Update via <code>sudo<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>su\napt update\napt upgrade<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt upgrade<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sicherheitsupdates lassen sich unter Debian (<em>und auf Debian basierenden Linux-Distributionen, wie etwa Ubuntu, Linux Mint und Co<\/em>.) auch automatisch installieren &#8211; dies erfordert nicht viel Arbeit.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">unattended-upgrades installieren<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Die Software wird entweder als root auf dem Terminal installiert oder eben \u00fcber die grafische Oberfl\u00e4che <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/10\/29\/synaptic-die-ultimative-paket-verwaltung-von-debian\/\" data-type=\"post\" data-id=\"10661\">Synaptic<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update\napt install unattended-upgrades<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Nach der Installation des Paketes gilt es, das System grundlegend zu konfigurieren &#8211; ebenfalls als root auf dem Terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg-reconfigure unattended-upgrades<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup.jpeg\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1024x512.jpeg\" alt=\"\" class=\"wp-image-17772\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1024x512.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-150x75.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-300x150.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-768x384.jpeg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup.jpeg 1161w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Mit der <kbd>Tabulator<\/kbd>-Taste wechseln Sie auf &#8222;<strong>Ja<\/strong>&#8220; oder &#8222;<strong>Yes<\/strong>&#8220; und best\u00e4tigen mit <kbd>Eingabe<\/kbd>. Damit w\u00e4re die Grundkonfiguration abgeschlossen, jetzt k\u00f6nnen Sie die Software anpassen &#8211; ohne weitere Konfiguration aktualisiert die Software das System einmal t\u00e4glich automatisch. Die Software l\u00e4sst sich aber auch anpassen, jetzt wollen wir uns erst einmal ansehen, ob die t\u00e4glichen Updates installiert sind:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status apt-daily.timer\nsystemctl status apt-daily-upgrade.timer<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1.jpeg\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1-1024x512.jpeg\" alt=\"\" class=\"wp-image-17773\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1-1024x512.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1-150x75.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1-300x150.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1-768x384.jpeg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-1.jpeg 1161w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Die Eintr\u00e4ge &#8222;<code>loaded<\/code>&#8220; und &#8222;<code>enabled<\/code>&#8220; best\u00e4tigen das automatische Aktualisieren des Systems. Jetzt l\u00e4sst sich nat\u00fcrlich auch testen, ob die Software so funktioniert, wie sie soll:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unattended-upgrade --dry-run<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-2.jpeg\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-2-1024x512.jpeg\" alt=\"\" class=\"wp-image-17774\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-2-1024x512.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-2-150x75.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-2-300x150.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-2-768x384.jpeg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-2.jpeg 1161w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Dass die Paket-Listen aktualisiert werden &#8211; <code>apt update<\/code> -, wird nicht angezeigt, aber die Installation der Pakete &#8222;<strong>libprotobuf-lite32t64_3.21.12-10+b3_amd64.deb python3-xapian_1.4.25-1+b4_amd64.deb<\/strong>&#8222;. Dies passiert nat\u00fcrlich nicht wirklich, es ist nur ein Test.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wir k\u00f6nnen uns die vergangenen automatischen Updates mit folgendem Befehl ansehen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>less \/var\/log\/unattended-upgrades\/unattended-upgrades.log<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Ausgabe beenden Sie mit <kbd>q<\/kbd>. Mit (<em>nat\u00fcrlich als root, hat man mit Vim so seine Schwierigkeiten, kann man auch etwa Nano benutzen<\/em>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/apt\/apt.conf.d\/50unattended-upgrades<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-3.jpeg\" rel=\"lightbox-3\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-3-1024x512.jpeg\" alt=\"\" class=\"wp-image-17775\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-3-1024x512.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-3-150x75.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-3-300x150.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-3-768x384.jpeg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/01\/aptup-3.jpeg 1161w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hier findet sich etwa:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Unattended-Upgrade::Mail \"\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Entfernen Sie hier die Raute &#8222;<strong>#<\/strong>&#8220; und setzen unter Anf\u00fchrungszeichen Ihre Mail-Adresse, erhalten Sie die Best\u00e4tigung installierter Updates per E-Mail:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Unattended-Upgrade::Mail \"robert.goedl@gmail.com\"<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Unattended-Upgrade::Automatic-Reboot \"true\";<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Entfernen Sie hier die Raute, wird das System bei Kernel-Updates automatisch neu gestartet.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Unattended-Upgrade::Automatic-Reboot-Time \"02:00\";<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Entfernen Sie hier die Raute und geben unter Anf\u00fchrungszeichen eine Uhrzeit an, wird nach einem Kernel-Update das System in der angegebenen Uhrzeit neu gestartet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nach \u00c4nderungen starten Sie die Software nat\u00fcrlich neu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apt-daily.timer\nsystemctl restart apt-daily-upgrade.timer<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Hin und wieder sollten Sie das System nat\u00fcrlich trotzdem manuell neu starten.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ich habe es nicht nur beruflich mit Linux zu tun, ich helfe auch privat gerne mal einem, der einen Server, f\u00fcr welchen Grund auch immer, einsetzt. Es gibt solche, die installieren keine Updates, weil sie dies nicht wollen &#8211; die Geschichte mit den Sicherheitsupdates wollen sie nicht verstehen. Dann gibt es auch solche, die mieten [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":17774,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72,17],"tags":[37,15],"class_list":["post-17771","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sicherheit","category-system","tag-sicherheit","tag-system"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/17771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=17771"}],"version-history":[{"count":2,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/17771\/revisions"}],"predecessor-version":[{"id":17791,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/17771\/revisions\/17791"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/17774"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=17771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=17771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=17771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}