70 lines
1.9 KiB
Markdown
70 lines
1.9 KiB
Markdown
# Sicherheit: Ubuntu LXC Standard-Setup
|
|
|
|
Standardisierter Installationsprozess fuer neue Ubuntu-LXC-Container.
|
|
|
|
Installiert und **direkt vorkonfiguriert**:
|
|
- `fail2ban`: SSH/SSHD-DDoS + Recidive-Jail, UFW-Ban-Action
|
|
- `ufw`: default deny incoming, allow outgoing, SSH freigegeben, 80/443 erlaubt
|
|
- `unattended-upgrades`: taegliche Security-Updates aktiv
|
|
- `openssh-server`: SSH automatisch installiert und konfiguriert
|
|
- `auditd`: grundlegende Audit-Regeln fuer sensible Dateien
|
|
- `sysctl`: Kernel/Netzwerk-Hardening-Basis
|
|
- `nodejs`, `npm`, `@openai/codex`
|
|
|
|
## Standardprozess nach Download
|
|
|
|
```bash
|
|
git clone http://gitea.kanu1.duckdns.org:3000/Kanu/Sicherheit.git
|
|
cd Sicherheit
|
|
chmod +x bin/sicherheit-install scripts/bootstrap_ubuntu_lxc_security.sh
|
|
./bin/sicherheit-install
|
|
```
|
|
|
|
Optional global verlinken:
|
|
|
|
```bash
|
|
sudo ln -sf "$(pwd)/bin/sicherheit-install" /usr/local/bin/sicherheit-install
|
|
sudo sicherheit-install
|
|
```
|
|
|
|
## SSH Linux Einrichten (automatisch im Skript enthalten)
|
|
|
|
Das Skript fuehrt diese Punkte automatisch aus:
|
|
|
|
```bash
|
|
sudo apt update
|
|
sudo apt install -y openssh-server
|
|
sudo ufw allow ssh
|
|
sudo ufw status
|
|
# PermitRootLogin yes wird gesetzt
|
|
sudo systemctl restart ssh
|
|
```
|
|
|
|
## Hinweis fuer LXC
|
|
|
|
In unprivilegierten LXC-Containern koennen `sysctl`-Keys und `auditd` teilweise nicht gesetzt/gestartet werden.
|
|
Das Skript erkennt Container und ueberspringt diese Schritte automatisch, statt mit Fehlern abzubrechen.
|
|
|
|
## Wichtige Konfigurationen
|
|
|
|
- `config/fail2ban/jail.local`
|
|
- `config/ufw/after.rules`
|
|
- `config/unattended-upgrades/20auto-upgrades`
|
|
- `config/unattended-upgrades/50unattended-upgrades`
|
|
- `config/ssh/sshd_config.d-sicherheit.conf`
|
|
- `config/sysctl/99-sicherheit.conf`
|
|
- `config/auditd/hardening.rules`
|
|
|
|
## Pruefen
|
|
|
|
```bash
|
|
fail2ban-client status
|
|
fail2ban-client status sshd
|
|
ufw status verbose
|
|
systemctl status unattended-upgrades --no-pager
|
|
sshd -t
|
|
node --version
|
|
npm --version
|
|
codex --help
|
|
```
|