title: Debian Server Setup toc_enable: yes breadcrumbs:
Using: Debian 10 Buster
TODO: Clean up.
en_US.UTF-8
).su -
from another user.systemctl --failed
apparmor_status
locale
update-locale LANG=en_US.UTF-8
AcceptEnv LANG LC_*
in /etc/ssh/sshd_config
to prevent clients bringing their own locale.dpkg-reconfigure keyboard-configuration
hostnamectl set-hostname <hostname>
/etc/hosts
with all variants of the hostname (including shortname and FQDN).sudo ca-certificates mailutils
screen vim htop tree curl nmap net-tools
contrib
and non-free
repo areas:contrib non-free
to every line in /etc/apt/sources.list
.firmware-linux
firmware-
).usermod -aG sudo <user>
).~/.ssh/authorized_keys
and fix the owner and permissions (700 for dir, 600 for file).Setup network manager:
vlan
and/or ifenslave
.If you want to use systemd-networkd instead, see System.
Setup DNS:
systemd-resolved.service
, the systemd resolver./etc/resolv.conf
to the one generated by systemd: ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
Setup NTP:
timedatectl
timedatectl set-timezone Europe/Oslo
timedatectl set-ntp true
ntp.justervesenet.no
to /etc/systemd/timesyncd.conf
.systemd-timesyncd
.Setup firewall:
iptables iptables-persistent netfilter-persistent
Reboot and make sure it still works.
groupadd -g 1500 pidmonitor
usermod -aG pidmonitor <user>
/etc/fstab
:proc /proc proc defaults,hidepid=2,gid=1500 0 0
mount -a
to validate fstab.PermitRootLogin no
PasswordAuthentication no
AllowTcpForwarding no
GatewayPorts no
sshd
./etc/shadow
is something invalid like "*" or "!", but not empty and not valid password hash. This prevents password login./etc/securetty
to prevent root local/console login.libpam-tmpdir
.fail2ban
.fail2ban-client status [sshd]
.lynis
.lynis audit system
.(Optional) Extra package security:
apt-listbugs
and apt-listchanges
and run them before upgrading a package.needrestart
and run it after upgrading.Install debsums
and run it after upgrading to check deb checksums.
Install debsecan
to get automatically alerted when new vulnerabilities are discovered and security updates are available.
2FA with Google Authenticator: TODO
vm.swappiness = 10
to /etc/sysctl.conf
to reduce swappiness.smartmontools
and run smartctl -s on <dev>
for all physical drives to enable SMART monitoring.lm-sensors
and run sensors-detect
to detect temperatur sensors etc. Add the modules to /etc/modules
when asked.ctrl-alt-del.target
to disable CTRL+ALT+DEL reboot at the login screen.qemu-guest-agent
./etc/resolv.conf
.vlan
ifenslave
/etc/systemd/network/*.netdev
/etc/systemd/network/*.network
mv /etc/network/interfaces /etc/network/interfaces.disabled
systemctl enable systemd-networkd
networkctl [status [-a]]
/boot
: 500MB, FAT32 (?)/boot/efi
: 500MB, FAT32/EFI/boot
: 500MB, EXT4/
and other volumes.vg0
or something) and add the partition you created earlier for it.var-lib
for the /var/lib
volume.This table is just for reference, everything about it is supposed to be suggestive. All of these are specified in /etc/fstab
. Volumes/mounts like /dev
are not mentioned.
Volume/Mount | Minimal Size (GB) | Mount Options |
---|---|---|
/proc |
N/A | hidepid=2,gid=1500 |
/boot |
0.5 | nodev,nosuid,noexec |
/boot/efi |
0.5 | nodev,nosuid,noexec |
/ |
10 | nodev |
/tmp |
5 | nodev,nosuid,noexec |
/var |
5 | nodev,nosuid |
/var/lib |
5 | nodev,nosuid |
/var/log |
5 | nodev,nosuid,noexec |
/var/log/audit |
1 | nodev,nosuid,noexec |
/var/tmp |
5 | nodev,nosuid,noexec |
/home |
10 | nodev,nosuid |
/srv |
10 | nodev,nosuid |
SWAP | 16 | N/A |
/cron/cron.daily/
or to /opt/bin
and create a cron job for it.15 */4 * * * root /opt/bin/disk-space-checker
{% include footer.md %}