mirror of
https://github.com/tommytran732/QubesOS-Scripts
synced 2024-11-22 09:51:32 -05:00
Compare commits
9 Commits
e7b55fd0cb
...
d12faa936a
Author | SHA1 | Date | |
---|---|---|---|
d12faa936a | |||
b8a06c1b51 | |||
28d31b3563 | |||
765a28d605 | |||
7f0950383f | |||
cd4836a1d7 | |||
6dd8134451 | |||
04fd34d738 | |||
fa8a2d88f8 |
91
debian/debian.sh
vendored
Normal file
91
debian/debian.sh
vendored
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#!/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 --proxy http://127.0.0.1:8082 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
|
||||||
|
|
||||||
|
|
||||||
|
sudo apt update -y
|
||||||
|
sudo apt full-upgrade -y
|
||||||
|
sudo apt autoremove -y
|
||||||
|
|
||||||
|
# Adding KickSecure's repo
|
||||||
|
sudo http_proxy=http://127.0.0.1:8082 https_proxy=http://127.0.0.1:8082 extrepo enable kicksecure
|
||||||
|
|
||||||
|
# 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 update
|
||||||
|
sudo apt install --no-install-recommends kicksecure-qubes-cli -y
|
||||||
|
sudo apt autoremove -y
|
||||||
|
sudo repository-dist --enable --repository stable-proposed-updates
|
||||||
|
sudo extrepo disable kicksecure
|
||||||
|
sudo mv /etc/apt/sources.list ~/
|
||||||
|
sudo touch /etc/apt/sources.list
|
||||||
|
|
||||||
|
#Enabling 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 adw-gtk3-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
|
11
etc/systemd/system/dnat-to-ns-boot.service
Normal file
11
etc/systemd/system/dnat-to-ns-boot.service
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Run /usr/lib/qubes/qubes-setup-dnat-to-ns 10 seconds after boot
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/sleep 10
|
||||||
|
ExecStart=/usr/bin/systemctl restart systemd-resolved
|
||||||
|
ExecStart=/usr/lib/qubes/qubes-setup-dnat-to-ns
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -68,6 +68,9 @@ unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Tomm
|
|||||||
sudo dconf update
|
sudo dconf update
|
||||||
umask 077
|
umask 077
|
||||||
|
|
||||||
|
# Setup ZRAM
|
||||||
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/systemd/zram-generator.conf | sudo tee /etc/systemd/zram-generator.conf
|
||||||
|
|
||||||
# Setup DNF
|
# Setup DNF
|
||||||
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/dnf/dnf.conf | sudo tee /etc/dnf/dnf.conf
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/dnf/dnf.conf | sudo tee /etc/dnf/dnf.conf
|
||||||
sudo sed -i 's/^metalink=.*/&\&protocol=https/g' /etc/yum.repos.d/*
|
sudo sed -i 's/^metalink=.*/&\&protocol=https/g' /etc/yum.repos.d/*
|
||||||
|
@ -24,7 +24,11 @@ sudo dnf install -y ivpn-ui
|
|||||||
sudo mkdir -p /etc/qubes-bind-dirs.d
|
sudo mkdir -p /etc/qubes-bind-dirs.d
|
||||||
echo 'binds+=( '\'''/etc/opt/ivpn/mutable''\'' )' | sudo tee /etc/qubes-bind-dirs.d/50_user.conf
|
echo 'binds+=( '\'''/etc/opt/ivpn/mutable''\'' )' | sudo tee /etc/qubes-bind-dirs.d/50_user.conf
|
||||||
|
|
||||||
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/systemd/system/dnat-to-ns-boot.service | sudo tee /etc/systemd/system/dnat-to-ns-boot.service
|
||||||
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/systemd/system/dnat-to-ns.service | sudo tee /etc/systemd/system/dnat-to-ns.service
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/systemd/system/dnat-to-ns.service | sudo tee /etc/systemd/system/dnat-to-ns.service
|
||||||
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/systemd/system/dnat-to-ns.path | sudo tee /etc/systemd/system/dnat-to-ns.path
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/systemd/system/dnat-to-ns.path | sudo tee /etc/systemd/system/dnat-to-ns.path
|
||||||
|
|
||||||
sudo systemctl enable dnat-to-ns.path
|
sudo systemctl enable dnat-to-ns-boot.service
|
||||||
|
sudo systemctl enable dnat-to-ns.path
|
||||||
|
|
||||||
|
# Follow these instructions on how to set up the ProxyVM: https://privsec.dev/posts/qubes/using-ivpn-on-qubes-os/#creating-the-proxyvm
|
@ -14,6 +14,10 @@
|
|||||||
# License for the specific language governing permissions and limitations under
|
# License for the specific language governing permissions and limitations under
|
||||||
# the License.
|
# the License.
|
||||||
|
|
||||||
|
unpriv(){
|
||||||
|
sudo -u nobody "$@"
|
||||||
|
}
|
||||||
|
|
||||||
# Compliance
|
# Compliance
|
||||||
systemctl mask debug-shell.service
|
systemctl mask debug-shell.service
|
||||||
systemctl mask kdump.service
|
systemctl mask kdump.service
|
||||||
@ -27,24 +31,27 @@ echo 'umask 077' | tee -a /etc/bashrc
|
|||||||
systemctl disable --now systemd-timesyncd
|
systemctl disable --now systemd-timesyncd
|
||||||
systemctl mask systemd-timesyncd
|
systemctl mask systemd-timesyncd
|
||||||
|
|
||||||
|
# Harden SSH
|
||||||
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/ssh/ssh_config.d/10-custom.conf | tee /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
|
chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
|
|
||||||
# Security kernel settings
|
# Security kernel settings
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Kicksecure/security-misc/master/etc/modprobe.d/30_security-misc.conf | tee /etc/modprobe.d/30_security-misc.conf
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Kicksecure/security-misc/master/etc/modprobe.d/30_security-misc.conf | tee /etc/modprobe.d/30_security-misc.conf
|
||||||
chmod 644 /etc/modprobe.d/30_security-misc.conf
|
chmod 644 /etc/modprobe.d/30_security-misc.conf
|
||||||
sed -i 's/#install msr/install msr/g' /etc/modprobe.d/30_security-misc.conf
|
sed -i 's/#install msr/install msr/g' /etc/modprobe.d/30_security-misc.conf
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Kicksecure/security-misc/master/usr/lib/sysctl.d/990-security-misc.conf | tee /etc/sysctl.d/990-security-misc.conf
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Kicksecure/security-misc/master/usr/lib/sysctl.d/990-security-misc.conf | tee /etc/sysctl.d/990-security-misc.conf
|
||||||
chmod 644 /etc/sysctl.d/990-security-misc.conf
|
chmod 644 /etc/sysctl.d/990-security-misc.conf
|
||||||
sed -i 's/kernel.yama.ptrace_scope=2/kernel.yama.ptrace_scope=3/g' /etc/sysctl.d/990-security-misc.conf
|
sed -i 's/kernel.yama.ptrace_scope=2/kernel.yama.ptrace_scope=3/g' /etc/sysctl.d/990-security-misc.conf
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Kicksecure/security-misc/master/usr/lib/sysctl.d/30_silent-kernel-printk.conf | tee /etc/sysctl.d/30_silent-kernel-printk.conf
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Kicksecure/security-misc/master/usr/lib/sysctl.d/30_silent-kernel-printk.conf | tee /etc/sysctl.d/30_silent-kernel-printk.conf
|
||||||
chmod 644 /etc/sysctl.d/30_silent-kernel-printk.conf
|
chmod 644 /etc/sysctl.d/30_silent-kernel-printk.conf
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Kicksecure/security-misc/master/usr/lib/sysctl.d/30_security-misc_kexec-disable.conf | tee /etc/sysctl.d/30_security-misc_kexec-disable.conf
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/Kicksecure/security-misc/master/usr/lib/sysctl.d/30_security-misc_kexec-disable.conf | tee /etc/sysctl.d/30_security-misc_kexec-disable.conf
|
||||||
chmod 644 /etc/sysctl.d/30_security-misc_kexec-disable.conf
|
chmod 644 /etc/sysctl.d/30_security-misc_kexec-disable.conf
|
||||||
# Dracut doesn't seem to work - need to investigate
|
# Dracut doesn't seem to work - need to investigate
|
||||||
# dracut -f
|
# dracut -f
|
||||||
sysctl -p
|
sysctl -p
|
||||||
|
|
||||||
# Harden SSH
|
# Setup ZRAM
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/ssh/ssh_config.d/10-custom.conf | tee /etc/ssh/ssh_config.d/10-custom.conf
|
unpriv curl https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/systemd/zram-generator.conf | sudo tee /etc/systemd/zram-generator.conf
|
||||||
chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
|
||||||
|
|
||||||
# Setup hardened_malloc
|
# Setup hardened_malloc
|
||||||
dnf install 'https://divested.dev/rpm/fedora/divested-release-20231210-2.noarch.rpm' -y
|
dnf install 'https://divested.dev/rpm/fedora/divested-release-20231210-2.noarch.rpm' -y
|
||||||
|
@ -19,19 +19,19 @@ dnf install -y @hardware-support arc-theme chrony gnome-keyring NetworkManager-w
|
|||||||
|
|
||||||
# Setup NTS
|
# Setup NTS
|
||||||
sudo rm -rf /etc/chrony.conf
|
sudo rm -rf /etc/chrony.conf
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/chrony.conf | tee /etc/chrony.conf
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/chrony.conf | tee /etc/chrony.conf
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/sysconfig/chronyd | tee /etc/sysconfig/chronyd
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/sysconfig/chronyd | tee /etc/sysconfig/chronyd
|
||||||
|
|
||||||
# Theming
|
# Theming
|
||||||
sudo mkdir -p /etc/gtk-3.0
|
sudo mkdir -p /etc/gtk-3.0
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/gtk-3.0/settings.ini | tee /etc/gtk-3.0/settings.ini
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/gtk-3.0/settings.ini | tee /etc/gtk-3.0/settings.ini
|
||||||
|
|
||||||
sudo mkdir -p /etc/gtk-4.0
|
sudo mkdir -p /etc/gtk-4.0
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/gtk-4.0/settings.ini | tee /etc/gtk-4.0/settings.ini
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/QubesOS-Scripts/main/etc/gtk-4.0/settings.ini | tee /etc/gtk-4.0/settings.ini
|
||||||
|
|
||||||
# Networking
|
# Networking
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/NetworkManager/conf.d/00-macrandomize.conf | tee /etc/NetworkManager/conf.d/00-macrandomize.conf
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/NetworkManager/conf.d/00-macrandomize.conf | tee /etc/NetworkManager/conf.d/00-macrandomize.conf
|
||||||
curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/NetworkManager/conf.d/01-transient-hostname.conf | tee /etc/NetworkManager/conf.d/01-transient-hostname.conf
|
unpriv curl --proxy http://127.0.0.1:8082 https://raw.githubusercontent.com/TommyTran732/Linux-Setup-Scripts/main/etc/NetworkManager/conf.d/01-transient-hostname.conf | tee /etc/NetworkManager/conf.d/01-transient-hostname.conf
|
||||||
sudo hostnamectl hostname 'localhost'
|
sudo hostnamectl hostname 'localhost'
|
||||||
sudo hostnamectl --transient hostname ''
|
sudo hostnamectl --transient hostname ''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user