Skip to content
Snippets Groups Projects
Commit 924577a6 authored by Bob Mottram's avatar Bob Mottram
Browse files

Prevent usb canary from being activated during upgrades

parent 551ff387
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,11 @@ if [ $DEVELOPMENT_BRANCH ]; then
fi
fi
# upgrading file prevents USB canary from activating
if [ ! -f /tmp/.upgrading ]; then
touch /tmp/.upgrading
fi
if [ -f /usr/bin/backupdatabases ]; then
if grep -q "cat /root/dbpass" /usr/bin/backupdatabases; then
# update to using the password manager
......@@ -91,6 +96,7 @@ if [ -d "$PROJECT_DIR" ]; then
fi
if ! ${PROJECT_NAME} -c "$CONFIGURATION_FILE"; then
rm /tmp/.upgrading
exit 453536
fi
......@@ -118,4 +124,9 @@ fi
# If logging was left on then turn it off
${PROJECT_NAME}-logging off
# upgrading file prevents USB canary from activating
if [ -f /tmp/.upgrading ]; then
rm /tmp/.upgrading
fi
# deliberately there is no 'exit 0' here
......@@ -28,12 +28,14 @@
PROJECT_NAME=freedombone
UPTIME=$(awk -F '.' '{print $1}' < "/proc/uptime")
if [ "$UPTIME" -gt 240 ]; then
ADMIN_USER=$(grep 'Admin user' /root/${PROJECT_NAME}-completed.txt | awk -F ':' '{print $2}')
MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname)
echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" "${MY_EMAIL_ADDRESS}"
echo "${ACTION}" > /tmp/usb-canary
echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary
date >> /tmp/usb-canary
if [ ! -f /tmp/.upgrading ]; then
UPTIME=$(awk -F '.' '{print $1}' < "/proc/uptime")
if [ "$UPTIME" -gt 240 ]; then
ADMIN_USER=$(grep 'Admin user' /root/${PROJECT_NAME}-completed.txt | awk -F ':' '{print $2}')
MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname)
echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" "${MY_EMAIL_ADDRESS}"
echo "${ACTION}" > /tmp/usb-canary
echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary
date >> /tmp/usb-canary
fi
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment