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

USB canary includes details of the device which was connected or disconnected

parent 1b349bbd
No related branches found
No related tags found
No related merge requests found
......@@ -33,9 +33,19 @@ if [ ! -f /tmp/.upgrading ]; then
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}"
# Which devices have changed?
devices_changed=
if [ -f /tmp/.usb_devices ]; then
lsusb -v > /tmp/.curr_usb_devices
devices_changed=$(diff /tmp/.curr_usb_devices /tmp/.usb_devices)
rm /tmp/.curr_usb_devices
fi
echo -e "USB device connected on ${DEVPATH}\\n\\n${devices_changed}" | 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
lsusb -v > /tmp/.usb_devices
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