2023-07-04 04:24:28 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#Meant to be run on Ubuntu Pro Minimal
|
|
|
|
|
2023-07-04 04:46:19 -04:00
|
|
|
#Compliance
|
|
|
|
sudo ua enable usg
|
|
|
|
sudo apt install -y usg
|
|
|
|
sudo usg fix cis_level2_server
|
|
|
|
|
2023-07-04 04:24:28 -04:00
|
|
|
#Security kernel settings
|
|
|
|
sudo curl https://raw.githubusercontent.com/Kicksecure/security-misc/master/etc/modprobe.d/30_security-misc.conf -o /etc/modprobe.d/30_security-misc.conf
|
|
|
|
sudo curl https://raw.githubusercontent.com/Kicksecure/security-misc/master/etc/sysctl.d/30_security-misc.conf -o /etc/sysctl.d/30_security-misc.conf
|
|
|
|
sudo curl https://raw.githubusercontent.com/Kicksecure/security-misc/master/etc/sysctl.d/30_silent-kernel-printk.conf -o /etc/sysctl.d/30_silent-kernel-printk.conf
|
|
|
|
sudo curl https://raw.githubusercontent.com/Kicksecure/security-misc/master/etc/sysctl.d/30_security-misc_kexec-disable.conf -o /etc/sysctl.d/30_security-misc_kexec-disable.conf
|
|
|
|
|
|
|
|
echo "GSSAPIAuthentication no" | sudo tee /etc/ssh/ssh_config.d/10-custom.conf
|
|
|
|
echo "VerifyHostKeyDNS yes" | sudo tee -a /etc/ssh/ssh_config.d/10-custom.conf
|
|
|
|
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
|
|
|
|
|
|
|
#Setup NTS
|
|
|
|
sudo systemctl disable systemd-timesyncd
|
|
|
|
sudo apt install -y chrony
|
|
|
|
rm -rf /etc/chrony/chrony.conf
|
|
|
|
sudo curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/chrony.conf -o /etc/chrony/chrony.conf
|
|
|
|
sudo systemctl restart chronyd
|
|
|
|
|
|
|
|
#Setup UFW
|
|
|
|
#UFW Snap is strictly confined, unlike its .deb counterpart
|
|
|
|
sudo apt purge -y ufw
|
|
|
|
sudo snap install ufw
|
|
|
|
sudo ufw enable
|
|
|
|
sudo ufw allow 22
|
|
|
|
|
|
|
|
sudo systemctl stop apport.service
|
|
|
|
sudo systemctl disable apport.service
|
|
|
|
sudo systemctl mask apport.service
|
|
|
|
sudo systemctl stop whoopsie.service
|
|
|
|
sudo systemctl disable whoopsie.service
|
|
|
|
sudo systemctl mask whoopsie.service
|
|
|
|
|
|
|
|
#Update packages and firmware
|
|
|
|
sudo apt update -y
|
|
|
|
sudo apt full-upgrade -y
|
|
|
|
sudo apt install fwupd
|
|
|
|
|
|
|
|
mkdir -p /etc/systemd/system/fwupd-refresh.service.d
|
|
|
|
echo '[Service]
|
2023-07-05 10:38:55 -04:00
|
|
|
ExecStart=/usr/bin/fwupdmgr update' | tee /etc/systemd/system/fwupd-refresh.service.d/override.conf
|
2023-07-04 04:24:28 -04:00
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable --now fwupd-refresh.timer
|