diff --git a/debian/debian.sh b/debian/debian.sh new file mode 100644 index 0000000..4afd15c --- /dev/null +++ b/debian/debian.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +# Copyright (C) 2022-2024 Thien Tran +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +unpriv(){ + sudo -u nobody "$@" +} + +# Compliance +sudo systemctl mask debug-shell.service + +# Setting umask to 077 +umask 077 +echo 'umask 077' | sudo tee -a /etc/bash.bashrc + +# Harden SSH +unpriv curl https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/ssh/ssh_config.d/10-custom.conf | sudo tee /etc/ssh/ssh_config.d/10-custom.conf +sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf + +# Disable coredump +unpriv curl https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/security/limits.d/30-disable-coredump.conf | sudo tee /etc/security/limits.d/30-disable-coredump.conf + +# Setup dconf +umask 022 +mkdir -p /etc/dconf/db/local.d/locks + +unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/dconf/db/local.d/locks/automount-disable | sudo tee /etc/dconf/db/local.d/locks/automount-disable +unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/dconf/db/local.d/locks/privacy | sudo tee /etc/dconf/db/local.d/locks/privacy + +unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/dconf/db/local.d/adw-gtk3-dark | sudo tee /etc/dconf/db/local.d/adw-gtk3-dark +unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/dconf/db/local.d/automount-disable | sudo tee /etc/dconf/db/local.d/automount-disable +unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/dconf/db/local.d/prefer-dark | sudo tee /etc/dconf/db/local.d/prefer-dark +unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/dconf/db/local.d/privacy | sudo tee /etc/dconf/db/local.d/privacy + +sudo dconf update +umask 077 + +# Avoid phased updates +unpriv curl https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/apt/apt.conf.d/99sane-upgrades | sudo tee /etc/apt/apt.conf.d/99sane-upgrades +sudo chmod 644 /etc/apt/apt.conf.d/99sane-upgrades + +# Adding KickSecure's signing key +curl --proxy http://127.0.0.1:8082/ --tlsv1.3 --proto =https --max-time 180 --output ~/derivative.asc https://www.kicksecure.com/derivative.asc +sudo cp ~/derivative.asc /usr/share/keyrings/derivative.asc +echo "deb [signed-by=/usr/share/keyrings/derivative.asc] https://deb.kicksecure.com bullseye main contrib non-free" | sudo tee /etc/apt/sources.list.d/derivative.list +sudo apt update + +# Debloat +sudo apt purge -y thunderbird emacs emacs-gtk emacs-bin-common emacs-common firefox* keepassxc cups* system-config-printer* xsettingsd yelp* +sudo apt autoremove -y +sudo apt autoclean + +# Distribution morphing +sudo apt install --no-install-recommends kicksecure-qubes-cli -y +sudo apt autoremove -y +sudo mv /etc/apt/sources.list ~/ +sudo touch /etc/apt/sources.list + +#E nabling SUID Disabler and Permission Hardener +sudo systemctl enable --now permission-hardening + +# Restrict /proc and access +sudo systemctl enable --now proc-hidepid.service + +# Reduce kernel information leaks +# Will break a lot of applications. The apps I use on KickSecure work fine with it so I am enabling it. +sudo systemctl enable --now hide-hardware-info.service + +# Install packages +sudo apt install --no-install-recommends arc-theme loupe qubes-ctap qubes-gpg-split -y + +# Flatpak update service +unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/systemd/user/update-user-flatpaks.service | sudo tee /etc/systemd/user/update-user-flatpaks.service +unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/systemd/user/update-user-flatpaks.timer | sudo tee /etc/systemd/user/update-user-flatpaks.timer \ No newline at end of file