Update security.sh

This commit is contained in:
verita84 2023-12-29 23:53:23 -07:00
parent 1cc2b6cefb
commit 6a1f8eddf2

View File

@ -1,7 +1,6 @@
#!/bin/bash
KEY_LOCATION="/tmp/key"
VERACRYPT_KEY="$KEY_LOCATION/veracrypt"
KEEPASS_KEY="$KEY_LOCATION/keepass.key"
USB_KEY_LABEL="veracrypt"
COMPTUER_USER="verita84"
VERACRYPT_MOUNT_DIR="/home/$COMPTUER_USER/Nextcloud"
@ -9,6 +8,19 @@ VERACRYPT_VOLUME="/home/$COMPTUER_USER/home.vc"
mkdir $KEY_LOCATION
stop-Everything() {
killall -9 -u $COMPTUER_USER
systemctl disable --now gdm
veracrypt --dismount $VERACRYPT_VOLUME
umount $VERACRYPT_MOUNT_DIR
umount $KEY_LOCATION
}
start-Everything() {
veracrypt --mount $VERACRYPT_VOLUME $VERACRYPT_MOUNT_DIR --pim 0 --password="" --keyfiles $VERACRYPT_KEY --protect-hidden no --slot 1
systemctl enable --now gdm
}
while :; do
USB_CHECK=$(blkid | grep $USB_KEY_LABEL)
if [[ $USB_CHECK = *$USB_KEY_LABEL* ]]; then
@ -29,13 +41,13 @@ while :; do
else
echo
echo "Mounting Veracrypt Volume........."
veracrypt --mount $VERACRYPT_VOLUME $VERACRYPT_MOUNT_DIR --pim 0 --password="" --keyfiles $VERACRYPT_KEY --protect-hidden no --slot 1
systemctl enable --now gdm
start-Everything
fi
else
echo
echo "Error: Veracrypt Key not found!"
echo
stop-Everything
fi
else
echo
@ -47,11 +59,7 @@ while :; do
echo
echo "VeraCrypt USB Key not found! Killing Everything!"
echo
killall -9 -u $COMPTUER_USER
systemctl disable --now gdm
veracrypt --dismount $VERACRYPT_VOLUME
umount $VERACRYPT_MOUNT_DIR
umount $KEY_LOCATION
stop-Everything
fi
sleep 15
done