Prevent usb canary from being activated during upgrades

This commit is contained in:
Bob Mottram 2018-05-13 09:53:00 +01:00
parent 551ff38736
commit 924577a6f2
2 changed files with 21 additions and 8 deletions

View File

@ -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

View File

@ -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