Upload files to "/"
This commit is contained in:
commit
3f206d7f02
57
security.sh
Normal file
57
security.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
KEY_LOCATION="/tmp/key"
|
||||
VERACRYPT_KEY="$KEY_LOCATION/veracrypt"
|
||||
KEEPASS_KEY="$KEY_LOCATION/keepass.key"
|
||||
USB_KEY_UUID="817038c8-05c0-43ee-a704-443915bc40bb"
|
||||
COMPTUER_USER="verita84"
|
||||
VERACRYPT_MOUNT_DIR="/home/$COMPTUER_USER/Nextcloud"
|
||||
VERACRYPT_VOLUME="/home/$COMPTUER_USER/home.vc"
|
||||
|
||||
mkdir $KEY_LOCATION
|
||||
|
||||
while :; do
|
||||
USB_CHECK=$(blkid | grep $USB_KEY_UUID)
|
||||
if [[ $USB_CHECK = *$USB_KEY_UUID* ]]; then
|
||||
echo
|
||||
echo "USB Key plugged in."
|
||||
echo
|
||||
MOUNT_CHECK=$(mount | grep $KEY_LOCATION)
|
||||
if [[ $MOUNT_CHECK = *$KEY_LOCATION* ]]; then
|
||||
echo
|
||||
echo "USB Key Mounted"
|
||||
echo
|
||||
if [ -f "$VERACRYPT_KEY" ]; then
|
||||
MOUNT_CHECK=$(mount | grep $VERACRYPT_MOUNT_DIR)
|
||||
if [[ $MOUNT_CHECK = *$VERACRYPT_MOUNT_DIR* ]]; then
|
||||
echo
|
||||
echo "VeraCrypt already mounted."
|
||||
echo
|
||||
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
|
||||
fi
|
||||
else
|
||||
echo
|
||||
echo "Error: Veracrypt Key not found!"
|
||||
echo
|
||||
fi
|
||||
else
|
||||
echo
|
||||
echo "VeraCrypt Volume not mounted yet. Mounting now....."
|
||||
echo
|
||||
mount /dev/disk/by-uuid/$USB_KEY_UUID $KEY_LOCATION
|
||||
fi
|
||||
else
|
||||
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
|
||||
fi
|
||||
sleep 15
|
||||
done
|
Loading…
Reference in New Issue
Block a user