2018-04-12 15:24:46 -04:00
|
|
|
#!/bin/bash
|
|
|
|
# From https://github.com/tasket/Qubes-VM-hardening
|
2019-08-13 13:46:52 -04:00
|
|
|
# installer version 0.9.0
|
2018-04-12 15:24:46 -04:00
|
|
|
|
2018-04-03 10:53:15 -04:00
|
|
|
set -e
|
2018-02-20 17:40:29 -05:00
|
|
|
[ `id -u` -eq 0 ] || exit
|
|
|
|
|
2019-08-13 13:46:52 -04:00
|
|
|
if [ "$1" = "--uninstall" ]; then
|
|
|
|
echo "Removing vm-boot-protect.service..."
|
|
|
|
echo "Warning: This will remove any custom files added to /etc/default/vms!"
|
|
|
|
read -p "Proceed [y/N]? " ans
|
|
|
|
if [[ $ans == @(Y|y) ]]; then
|
|
|
|
systemctl disable vm-boot-protect.service
|
|
|
|
rm -r /lib/systemd/system/vm-boot-protect.service /usr/lib/qubes/init/vm-boot-protect.sh /etc/default/vms
|
|
|
|
systemctl daemon-reload
|
|
|
|
echo "Done."
|
|
|
|
else
|
|
|
|
echo "Aborted."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-03-29 07:22:22 -04:00
|
|
|
|
2018-04-03 10:53:15 -04:00
|
|
|
echo "Installing vm-boot-protect.service..."
|
2018-03-29 02:57:06 -04:00
|
|
|
cp vm-boot-protect.sh /usr/lib/qubes/init
|
|
|
|
chmod +x /usr/lib/qubes/init/vm-boot-protect.sh
|
|
|
|
cp vm-boot-protect.service /lib/systemd/system
|
2018-02-20 17:40:29 -05:00
|
|
|
systemctl daemon-reload
|
2018-03-29 02:57:06 -04:00
|
|
|
systemctl enable vm-boot-protect.service
|
2018-02-20 17:40:29 -05:00
|
|
|
|
2018-04-03 10:53:15 -04:00
|
|
|
echo "Adding defaults in /etc/default/vms..."
|
2019-01-29 23:09:53 -05:00
|
|
|
mkdir -p /etc/default/vms
|
2018-04-03 10:53:15 -04:00
|
|
|
# Careful... ownership & mode are not preserved here!
|
2018-04-14 11:18:55 -04:00
|
|
|
cp -riv default/vms/* /etc/default/vms
|
2018-04-03 10:53:15 -04:00
|
|
|
|
2019-08-13 13:46:52 -04:00
|
|
|
|
|
|
|
# echo
|
|
|
|
# echo "Setup empty Firefox default profile in /etc/skel..."
|
|
|
|
# echo "A fixed-name profile will be defined in the /home/user folder"
|
|
|
|
# echo "whenever home is reset/initialized. This is required when"
|
|
|
|
# echo "using vm-boot-protect features (such as ibrowse) to"
|
|
|
|
# echo "whitelist parts of the browser configuration."
|
|
|
|
# echo
|
|
|
|
# read -p "Add Firefox default profile [y/N]? " ans
|
|
|
|
# if [[ $ans == @(Y|y) ]]; then
|
|
|
|
# mkdir -p /etc/skel/.mozilla/firefox/profile.default
|
|
|
|
# cat <<__END1__ >/etc/skel/.mozilla/firefox/profiles.ini
|
|
|
|
# [General]
|
|
|
|
# StartWithLastProfile=1
|
|
|
|
#
|
|
|
|
# [Profile0]
|
|
|
|
# Name=default
|
|
|
|
# IsRelative=1
|
|
|
|
# Path=profile.default
|
|
|
|
# Default=1
|
|
|
|
# __END1__
|
|
|
|
#
|
|
|
|
# fi
|
|
|
|
|
2018-04-12 15:24:46 -04:00
|
|
|
echo -e "\nvm-boot-protect installed!\n"
|
|
|
|
|
|
|
|
bash ./configure-sudo-prompt
|
|
|
|
exit 0
|
2018-02-20 17:40:29 -05:00
|
|
|
|