2022-11-20 16:41:17 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-03-11 12:53:28 -05:00
|
|
|
# You need to add either the non-subscription repo or the testing repo from the Proxmox WebUI after running this script.
|
|
|
|
|
2023-01-25 06:33:56 -05:00
|
|
|
echo 'GSSAPIAuthentication no
|
2023-03-10 13:21:49 -05:00
|
|
|
VerifyHostKeyDNS yes' | tee /etc/ssh/ssh_config.d/10-custom.conf
|
2023-06-25 06:11:43 -04:00
|
|
|
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
2023-03-10 18:35:12 -05:00
|
|
|
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
|
2023-01-25 06:33:56 -05:00
|
|
|
sed -i 's/#GSSAPIAuthentication no/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
|
|
|
|
mkdir -p /etc/systemd/system/sshd.service.d
|
|
|
|
curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/limits.conf -o /etc/systemd/system/sshd.service.d/limits.conf
|
|
|
|
systemctl restart sshd
|
|
|
|
|
2022-11-20 16:41:17 -05:00
|
|
|
sed -i '1 {s/^/#/}' /etc/apt/sources.list.d/pve-enterprise.list
|
2022-11-20 17:05:22 -05:00
|
|
|
|
2023-07-04 09:00:38 -04:00
|
|
|
echo 'deb https://deb.debian.org/debian/ bookworm main contrib non-free
|
2022-11-20 17:05:22 -05:00
|
|
|
|
2023-07-04 09:00:38 -04:00
|
|
|
deb https://deb.debian.org/debian/ bookworm-updates main contrib non-free
|
2022-11-20 17:05:22 -05:00
|
|
|
|
|
|
|
# security updates
|
2023-07-04 09:00:38 -04:00
|
|
|
deb https://security.debian.org bookworm-security main contrib non-free
|
2022-11-20 17:05:22 -05:00
|
|
|
|
2023-07-04 09:00:38 -04:00
|
|
|
deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription' | tee /etc/apt/sources.list
|
2022-11-20 17:05:22 -05:00
|
|
|
|
2022-11-20 16:41:17 -05:00
|
|
|
apt update
|
|
|
|
apt upgrade -y
|
2023-03-10 22:27:56 -05:00
|
|
|
apt install -y --no-install-recommends intel-microcode tuned fwupd dropbear-initramfs
|
2022-11-20 16:41:17 -05:00
|
|
|
|
2022-11-20 16:48:03 -05:00
|
|
|
tuned-adm profile virtual-host
|
2022-11-20 16:41:17 -05:00
|
|
|
|
2023-01-25 06:33:56 -05:00
|
|
|
rm -rf /etc/chrony/chrony.conf
|
|
|
|
curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/chrony.conf -o /etc/chrony/chrony.conf
|
|
|
|
systemctl restart chronyd
|
|
|
|
|
2022-11-20 16:41:17 -05:00
|
|
|
### This part assumes that you are using systemd-boot
|
|
|
|
echo -e "spectre_v2=on spec_store_bypass_disable=on l1tf=full,force mds=full,nosmt tsx=off tsx_async_abort=full,nosmt kvm.nx_huge_pages=force nosmt=force l1d_flush=on mmio_stale_data=full,nosmt random.trust_bootloader=off random.trust_cpu=off intel_iommu=on amd_iommu=on efi=disable_early_pci_dma iommu.passthrough=0 iommu.strict=1 slab_nomerge init_on_alloc=1 init_on_free=1 pti=on vsyscall=none page_alloc.shuffle=1 randomize_kstack_offset=on extra_latent_entropy debugfs=off $(cat /etc/kernel/cmdline)" > /etc/kernel/cmdline
|
|
|
|
proxmox-boot-tool refresh
|
|
|
|
###
|
|
|
|
|
|
|
|
curl https://raw.githubusercontent.com/Kicksecure/security-misc/master/etc/modprobe.d/30_security-misc.conf -o /etc/modprobe.d/30_security-misc.conf
|
|
|
|
curl https://raw.githubusercontent.com/Kicksecure/security-misc/master/etc/sysctl.d/30_security-misc.conf -o /etc/sysctl.d/30_security-misc.conf
|
|
|
|
sed -i 's/kernel.yama.ptrace_scope=2/kernel.yama.ptrace_scope=3/g' /etc/sysctl.d/30_security-misc.conf
|
2023-03-20 14:39:50 -04:00
|
|
|
sed -i 's/net.ipv4.icmp_echo_ignore_all=1/net.ipv4.icmp_echo_ignore_all=0/g' /etc/sysctl.d/30_security-misc.conf
|
|
|
|
sed -i 's/net.ipv6.icmp.echo_ignore_all=1/net.ipv6.icmp.echo_ignore_all=0/g' /etc/sysctl.d/30_security-misc.conf
|
2022-12-01 14:59:49 -05:00
|
|
|
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
|
2023-02-04 05:21:33 -05:00
|
|
|
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
|
2022-12-01 14:59:49 -05:00
|
|
|
mkdir -p /etc/systemd/system/NetworkManager.service.d
|
|
|
|
curl https://gitlab.com/divested/brace/-/raw/master/brace/usr/lib/systemd/system/NetworkManager.service.d/99-brace.conf -o /etc/systemd/system/NetworkManager.service.d/99-brace.conf
|
2022-11-20 16:41:17 -05:00
|
|
|
echo "* hard core 0" | tee -a /etc/security/limits.conf
|
|
|
|
|
|
|
|
sed -i 's/#GSSAPIAuthentication no/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
|
|
|
|
|
|
|
|
mkdir -p /etc/systemd/system/pve-daily-update.service.d
|
|
|
|
echo '[Service]
|
|
|
|
ExecStart=/usr/bin/pveupgrade' | tee /etc/systemd/system/pve-daily-update.service.d/override.conf
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable --now pve-daily-update.timer
|
|
|
|
|
2022-11-23 02:30:59 -05:00
|
|
|
mkdir -p /etc/systemd/system/fwupd-refresh.service.d
|
2022-11-20 16:41:17 -05:00
|
|
|
echo '[Service]
|
2023-07-05 10:39:16 -04:00
|
|
|
ExecStart=/usr/bin/fwupdmgr update' | tee /etc/systemd/system/fwupd-refresh.service.d/override.conf
|
2022-11-20 16:41:17 -05:00
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable --now fwupd-refresh.timer
|
|
|
|
|
2023-03-10 13:39:57 -05:00
|
|
|
# Disable Nagging
|
|
|
|
sed -Ezi.bak "s/(Ext.Msg.show\(\{\s+title: gettext\('No valid sub)/void\(\{ \/\/\1/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
|
|
|
|
|
2022-11-20 16:41:17 -05:00
|
|
|
systemctl restart pveproxy.service
|
2023-07-07 05:41:36 -04:00
|
|
|
|
|
|
|
# Enable fstrim.timer
|
|
|
|
systemctl enable --now fstrim.timer
|