diff options
Diffstat (limited to 'core/modules/usbguard/data/usr/local')
-rwxr-xr-x | core/modules/usbguard/data/usr/local/etc/usbguard/sendUSBInfo.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/modules/usbguard/data/usr/local/etc/usbguard/sendUSBInfo.sh b/core/modules/usbguard/data/usr/local/etc/usbguard/sendUSBInfo.sh new file mode 100755 index 00000000..3fe91fef --- /dev/null +++ b/core/modules/usbguard/data/usr/local/etc/usbguard/sendUSBInfo.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# use SLX_KCL_SERVERS +. /opt/openslx/config + +SERVER_IP=${SLX_PXE_SERVER_IP} +CLIENT_IP=${SLX_PXE_CLIENT_IP} +NADAPTER="br0" + +if [ "$USBGUARD_DEVICE_EVENT" == "Insert" ] +then + id=$(echo $USBGUARD_DEVICE_RULE | grep -Pzo '(?s)(?<=id\s).*(?=\sserial)') + serial=$(echo $USBGUARD_DEVICE_RULE | grep -Pzo '(?s)(?<=serial\s").*(?="\sname)') + name=$(echo $USBGUARD_DEVICE_RULE | grep -Pzo '(?s)(?<=name\s").*(?="\shash)') + vhash=$(echo $USBGUARD_DEVICE_RULE | grep -Pzo '(?s)(?<=\shash\s").*(?="\sparent-hash)') + phash=$(echo $USBGUARD_DEVICE_RULE | grep -Pzo '(?s)(?<=\sparent-hash\s").*(?="\svia-port)') + vport=$(echo $USBGUARD_DEVICE_RULE | grep -Pzo '(?s)(?<=\svia-port\s").*(?="\swith-interface)') + interface=$(echo $USBGUARD_DEVICE_RULE | grep -Pzo '(?s)(?<=\swith-interface\s).*') + # nat1 ONLY WORKS FOR some VM's THIS NEEDS TO BE EDITED. IP Info only needed for getting the machineuuid -> location of the machine. + # interface-policy is not needed here is it? --> Once it's implemented in usbguard it is.. but currently the device rule doesn't have those information. + url=$(echo "http://$SERVER_IP/slx-admin/api.php?do=usbguard&action=newdevice&id=$id&serial=$serial&name=$name&ip=$CLIENT_IP&hash=$vhash&parent-hash=$phash&via-port=$vport&with-interface=$interface" | sed 's/ /%20/g') + curl $url +fi |