ubuntu:18-04_server_install
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| ubuntu:18-04_server_install [2018/12/30 22:06] – ["Mini" Postfix] Konfiguration Sebastian Hetzel | ubuntu:18-04_server_install [2019/06/27 23:02] (aktuell) – [Reaktivierung von ifupdown] Deaktivierung weiterer Dienst Sebastian Hetzel | ||
|---|---|---|---|
| Zeile 3: | Zeile 3: | ||
| An dieser Stelle ist das Basis-Setup bereits durchgeführt. | An dieser Stelle ist das Basis-Setup bereits durchgeführt. | ||
| + | **Hinweis zur Ubuntu-18.04-Installations-CD / ISO:** \\ Wird das Setup auf Deutsch umgestellt, dann ist es nicht möglich, manuell eine IP-Konfiguration während des Setups zu definieren. Dies scheint ein Bug zu sein, da die Möglichkeit bei der Installation mit der Locale " | ||
| + | ===== APT-Paketserver ===== | ||
| + | |||
| + | Ändert die APT-Quelle von den regionalen Paketserver auf die Hauptserver von Ubuntu. | ||
| + | |||
| + | < | ||
| + | # sed -i ' | ||
| + | </ | ||
| + | ===== Nervig: SSH Connection timeout ===== | ||
| + | |||
| + | Man editiere / | ||
| + | |||
| + | <file | / | ||
| + | [...] | ||
| + | ClientAliveInterval 60 | ||
| + | ClientAliveCountMax 15 | ||
| + | [...] | ||
| + | </ | ||
| + | |||
| + | Der Wert '' | ||
| + | |||
| + | < | ||
| + | 60 sec * 15 = 900 sec | ||
| + | 900 sec / 60 = 15 min | ||
| + | </ | ||
| + | ===== Bug: " | ||
| + | |||
| + | < | ||
| + | Failed to connect to https:// | ||
| + | </ | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Was ist zu tun? - Folgende Befehle mit Root-Rechten ausführen: | ||
| + | |||
| + | < | ||
| + | rm / | ||
| + | / | ||
| + | </ | ||
| ===== Netzwerkkonfiguration ===== | ===== Netzwerkkonfiguration ===== | ||
| Zeile 23: | Zeile 62: | ||
| ===== Reaktivierung von ifupdown ===== | ===== Reaktivierung von ifupdown ===== | ||
| - | Um netplan zu deaktivieren | + | Um netplan.io zu deaktivieren, |
| < | < | ||
| Zeile 56: | Zeile 95: | ||
| systemctl stop systemd-resolved.service | systemctl stop systemd-resolved.service | ||
| systemctl mask systemd-resolved.service | systemctl mask systemd-resolved.service | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | systemctl disable systemd-networkd-wait-online.service | ||
| + | systemctl stop systemd-networkd-wait-online.service | ||
| + | systemctl mask systemd-networkd-wait-online.service | ||
| </ | </ | ||
| < | < | ||
| + | |||
| + | ===== IPv6 abschalten ===== | ||
| + | |||
| + | <file | / | ||
| + | [...] | ||
| + | #disable ipv6 | ||
| + | net.ipv6.conf.all.disable_ipv6 = 1 | ||
| + | net.ipv6.conf.default.disable_ipv6 = 1 | ||
| + | net.ipv6.conf.lo.disable_ipv6 = 1 | ||
| + | </ | ||
| ===== NTP Client ===== | ===== NTP Client ===== | ||
| Zeile 163: | Zeile 218: | ||
| ===== Apticron ===== | ===== Apticron ===== | ||
| + | ==== Installation ==== | ||
| + | < | ||
| + | apt-get update | ||
| + | aptitude install apticron | ||
| + | vi / | ||
| + | </ | ||
| + | |||
| + | ==== Konfiguration ==== | ||
| + | |||
| + | Gegebenenfalls sollte hier die Empfängeradresse angepasst werden: | ||
| + | |||
| + | <file | / | ||
| + | # apticron.conf | ||
| + | # | ||
| + | # The values set in / | ||
| + | # in this file. | ||
| + | |||
| + | # | ||
| + | # Set EMAIL to a space separated list of addresses which will be notified of | ||
| + | # impending updates. By default the root account will be notified. | ||
| + | # | ||
| + | EMAIL=" | ||
| + | [...] | ||
| + | </ | ||
| + | |||
| + | ==== Scheduled Task ==== | ||
| + | |||
| + | Wann Apticron ausgeführt wird, kann über Cron angepasst werden: | ||
| + | < | ||
| + | |||
| + | ===== Firewall ===== | ||
| + | |||
| + | ==== Installation ==== | ||
| + | |||
| + | Die Pakete "'' | ||
| + | |||
| + | < | ||
| + | apt-get update | ||
| + | aptitude install iptables-persistent netfilter-persistent | ||
| + | </ | ||
| + | |||
| + | Ubuntu kommt von Hause aus mit dem Paket '' | ||
| + | |||
| + | < | ||
| + | aptitude purge ufw | ||
| + | </ | ||
| + | |||
| + | ==== Konfiguration / Regelwerk ==== | ||
| + | |||
| + | Um ein Regelwerk zu kreieren, empfehle ich, ein Bash-Skript mit iptables-Befehlen zu schreiben. Sobald dieses ausgeführt worden ist, muss das Regelwerk abgespeichert werden. Dies geschieht mit folgendem Befehl: | ||
| + | |||
| + | < | ||
| + | netfilter-persistent save | ||
| + | </ | ||
| + | |||
| + | Netfilter erstellt nun unter ''/ | ||
| + | |||
| + | < | ||
| + | ll / | ||
| + | insgesamt 24 | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x 99 root root 4096 Feb 7 23:18 ../ | ||
| + | -rwxr-xr-x | ||
| + | -rw-r--r-- | ||
| + | -rw-r----- | ||
| + | -rw-r----- | ||
| + | </ | ||
| + | |||
| + | Die Firewall sollte nun bereits einsatzfähig sein. | ||
| + | |||
| + | ==== Logfile ==== | ||
| + | |||
| + | Dummerweise schreibt iptables das syslog voll, welches somit unübersichtlich wird. Mit Hilfe des rsyslogd leite ich die Ausgaben in eine eigene Datei um: | ||
| + | |||
| + | < | ||
| + | |||
| + | Damit dieser Weg funktioniert, | ||
| + | |||
| + | <file | / | ||
| + | : | ||
| + | & ~ | ||
| + | </ | ||
| + | |||
| + | Beim ersten Mal muss die Datei erstellt werden und mit Rechten für den rsyslogd versehen werden. | ||
| + | |||
| + | < | ||
| + | touch / | ||
| + | chown syslog.adm / | ||
| + | </ | ||
| + | |||
| + | Die Änderungen werden erst nach einem Dienstneustart übernommen. | ||
| + | |||
| + | < | ||
| + | |||
| + | Das Logfile wird schnell groß und sollter daher rotiert werden: | ||
| + | |||
| + | <file | / | ||
| + | / | ||
| + | { | ||
| + | rotate 7 | ||
| + | daily | ||
| + | missingok | ||
| + | notifempty | ||
| + | delaycompress | ||
| + | compress | ||
| + | create 640 syslog adm | ||
| + | sharedscripts | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Fail2Ban ===== | ||
| + | |||
| + | Fail2Ban sollte meiner Meinung nach auf jeder Maschine laufen, die über SSH im Internet administriert wird. Natürlich ist die Absicherung weiterer Dienste wie SMTP, FTP, usw. ebenso sinnvoll. | ||
| + | |||
| + | ==== Installation und erste Konfiguration ==== | ||
| + | |||
| + | < | ||
| + | # aptitude install fail2ban | ||
| + | </ | ||
| + | |||
| + | <file > | ||
| + | [...] | ||
| + | |||
| + | # " | ||
| + | # will not ban a host which matches an address in this list. Several addresses | ||
| + | # can be defined using space (and/or comma) separator. | ||
| + | #ignoreip = 127.0.0.1/8 ::1 | ||
| + | ignoreip = 127.0.0.1/8 | ||
| + | |||
| + | [...] | ||
| + | |||
| + | # External command that will take an tagged arguments to ignore, e.g. <ip>, | ||
| + | # and return true if the IP is to be ignored. False otherwise. | ||
| + | # | ||
| + | # ignorecommand = / | ||
| + | ignorecommand = | ||
| + | |||
| + | # " | ||
| + | bantime | ||
| + | |||
| + | # A host is banned if it has generated " | ||
| + | # seconds. | ||
| + | findtime | ||
| + | |||
| + | # " | ||
| + | maxretry = 6 | ||
| + | |||
| + | [...] | ||
| + | |||
| + | # | ||
| + | # JAILS | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # SSH servers | ||
| + | # | ||
| + | |||
| + | [sshd] | ||
| + | enabled = true | ||
| + | # To use more aggressive sshd modes set filter parameter " | ||
| + | # normal (default), ddos, extra or aggressive (combines all). | ||
| + | # See " | ||
| + | #mode = normal | ||
| + | port = 4444 | ||
| + | logpath = %(sshd_log)s | ||
| + | backend = %(sshd_backend)s | ||
| + | |||
| + | [...] | ||
| + | </ | ||
| + | ==== IP entsperren ==== | ||
| + | |||
| + | < | ||
| + | # fail2ban-client set < | ||
| + | </ | ||
ubuntu/18-04_server_install.1546204002.txt.gz · Zuletzt geändert: von Sebastian Hetzel
