Skip to content

Commit

Permalink
Improvement - Minor improvements to linux disk auditing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Sep 15, 2019
1 parent dc0e107 commit a22f1cb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions other/audit_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,12 @@ else
if [ "$test" = "1" ]; then
hard_drive_interface_type="sata"
fi
if [ -z "$hard_drive_interface_type" ]; then
test=$(nvme --list 2>/dev/null | grep "/dev/$disk")
if [ -n "$test" ]; then
hard_drive_interface_type="nvme"
fi
fi
hard_drive_model=$(udevadm info -a -n /dev/"$disk" 2>/dev/null | grep "ATTRS{model}==" | head -n 1 | cut -d\" -f2)
if [ -z "$hard_drive_model" ]; then
Expand All @@ -1877,6 +1883,9 @@ else
hard_drive_status=""
hard_drive_model_family=""
hard_drive_firmware=$(udevadm info -q all -n /dev/"$disk" 2>/dev/null | grep ID_REVISION= | cut -d= -f2)
if [ -z "$hard_drive_firmware" ]; then
hard_drive_firmware=$(smartctl -i /dev/"$disk" 2>/dev/null | grep "Firmware Version" | cut -d: -f2)
fi
mycommand="lshw -class disk 2>/dev/null"
mydelimiter="*-disk"
Expand All @@ -1900,6 +1909,14 @@ else
hard_drive_manufacturer="Crucial"
fi
if [ -z "$hard_drive_manufacturer" ] && echo "$hard_drive_model" | grep -q "Samsung" ; then
hard_drive_manufacturer="Samsung"
fi
if [ -z "$hard_drive_manufacturer" ] && echo "$hard_drive_model" | grep -q "WDC " ; then
hard_drive_manufacturer="Western Digital"
fi
if echo "$hard_drive_manufacturer" | grep -q "VMware" ; then
hard_drive_manufacturer="VMware"
hard_drive_model_family="VMware"
Expand Down

0 comments on commit a22f1cb

Please sign in to comment.