moby-configs (old Docker Server)
Go to file
Joerg Lehmann 6b1f723f7b Initial commit 2021-08-03 17:05:43 +02:00
docker-compose/traefik Initial commit 2021-08-03 17:05:43 +02:00
README.md Initial commit 2021-08-03 17:05:43 +02:00

README.md

moby - Container Server

Spezifikaktion:

  • Ubuntu Server 20.04
  • Hetzner Cloud Server CX31
    • 2 vCPUs
    • 8 GB RAM
    • 80 GB Disk

Erstellen des Servers

Mit dem Binary hcloud von: https://github.com/hetznercloud/cli

Temporaer einen API Key erstellen (nachher wieder loeschen)

$ hcloud context create nbit.ch
$ hcloud image list                          # zeigt moegliche Images
$ hcloud server-type list                    # zeigt moegliche Typen

$ hcloud server create --name moby --image docker-ce --type cx31 --ssh-key joerg@cinnamon.nbit.ch
$ hcloud server set-rdns moby --hostname moby.nbit.ch
$ IPV6="$(hcloud server ip moby -6)"
$ hcloud server set-rdns moby --ip $IPV6 --hostname moby.nbit.ch

DNS Eintraege erstellen:

$ hcloud server ip moby
$ hcloud server ip moby -6                     
Root-Passwort setzen (das machen wir von Hand)

ssh-Root-Passwort-Login disablen:
/etc/ssh/sshd_config:
PermitRootLogin without-password


Add Swap Space as documented in Mailcow Doc (but we use 2GB):

see https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/

# fallocate -l 2G /swapfile
# chmod 600 /swapfile
# mkswap /swapfile
# swapon /swapfile
# echo "/swapfile swap swap defaults 0 0" >>/etc/fstab


Firewall

# ufw default deny incoming
# ufw default allow outgoing
# ufw allow ssh
# ufw allow http
# ufw allow https
# ufw enable

fail2ban auf Host fuer ssh

# apt install fail2ban
# cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
edit /etc/fail2ban/jail.local:
enabled = true unterhalb [sshd]

Check, wer gebanned ist:
# fail2ban-client status sshd

Software installieren

# apt install git