Ver código fonte

Prevent usb canary from being activated during upgrades

Bob Mottram 7 anos atrás
pai
commit
924577a6f2
2 arquivos alterados com 21 adições e 8 exclusões
  1. 11
    0
      src/freedombone-upgrade
  2. 10
    8
      src/freedombone-usb-canary

+ 11
- 0
src/freedombone-upgrade Ver arquivo

61
     fi
61
     fi
62
 fi
62
 fi
63
 
63
 
64
+# upgrading file prevents USB canary from activating
65
+if [ ! -f /tmp/.upgrading ]; then
66
+    touch /tmp/.upgrading
67
+fi
68
+
64
 if [ -f /usr/bin/backupdatabases ]; then
69
 if [ -f /usr/bin/backupdatabases ]; then
65
     if grep -q "cat /root/dbpass" /usr/bin/backupdatabases; then
70
     if grep -q "cat /root/dbpass" /usr/bin/backupdatabases; then
66
         # update to using the password manager
71
         # update to using the password manager
91
         fi
96
         fi
92
 
97
 
93
         if ! ${PROJECT_NAME} -c "$CONFIGURATION_FILE"; then
98
         if ! ${PROJECT_NAME} -c "$CONFIGURATION_FILE"; then
99
+            rm /tmp/.upgrading
94
             exit 453536
100
             exit 453536
95
         fi
101
         fi
96
 
102
 
118
 # If logging was left on then turn it off
124
 # If logging was left on then turn it off
119
 ${PROJECT_NAME}-logging off
125
 ${PROJECT_NAME}-logging off
120
 
126
 
127
+# upgrading file prevents USB canary from activating
128
+if [ -f /tmp/.upgrading ]; then
129
+    rm /tmp/.upgrading
130
+fi
131
+
121
 # deliberately there is no 'exit 0' here
132
 # deliberately there is no 'exit 0' here

+ 10
- 8
src/freedombone-usb-canary Ver arquivo

28
 
28
 
29
 PROJECT_NAME=freedombone
29
 PROJECT_NAME=freedombone
30
 
30
 
31
-UPTIME=$(awk -F '.' '{print $1}' < "/proc/uptime")
32
-if [ "$UPTIME" -gt 240 ]; then
33
-    ADMIN_USER=$(grep 'Admin user' /root/${PROJECT_NAME}-completed.txt | awk -F ':' '{print $2}')
34
-    MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname)
35
-    echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" "${MY_EMAIL_ADDRESS}"
36
-    echo "${ACTION}" > /tmp/usb-canary
37
-    echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary
38
-    date >> /tmp/usb-canary
31
+if [ ! -f /tmp/.upgrading ]; then
32
+    UPTIME=$(awk -F '.' '{print $1}' < "/proc/uptime")
33
+    if [ "$UPTIME" -gt 240 ]; then
34
+        ADMIN_USER=$(grep 'Admin user' /root/${PROJECT_NAME}-completed.txt | awk -F ':' '{print $2}')
35
+        MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname)
36
+        echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" "${MY_EMAIL_ADDRESS}"
37
+        echo "${ACTION}" > /tmp/usb-canary
38
+        echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary
39
+        date >> /tmp/usb-canary
40
+    fi
39
 fi
41
 fi