Be Your Own Cloud code · PART 2 — FOUNDATION
Chapter 5 Installing and Hardening Ubuntu Server
Going further than the chapter: Installing Ubuntu Server for a Home Lab , SSH: Key-Only Login and Sensible Hardening
First Boot: A User and a Real Address
# p. 25
Your file may have a different name — ls /etc/netplan shows it.
# /etc/netplan/00-installer-config.yaml
network:
version: 2
ethernets:
eth0:
dhcp4: no
addresses: [192.168.1.50/24]
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [192.168.1.1, 1.1.1.1] sudo netplan apply Locking Down SSH
# p. 25
ssh-keygen -t ed25519
ssh-copy-id [email protected] # p. 26
Set these three lines; leave the rest of the file alone.
# /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin no
PubkeyAuthentication yes sudo systemctl restart ssh A Firewall That Actually Does Something
# p. 26
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw enable Patching Itself, and a Bouncer at the Door
# p. 27
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure --priority=low unattended-upgrades # p. 27
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
# Edit jail.local, confirm the [sshd] section is enabled
sudo systemctl enable --now fail2ban Reproduced exactly from Be Your Own Cloud, Chapter 5. The book explains what each line does and what to do when it doesn't work. About the book
Something here not working as the book describes? Tell the author.