Kaynağa Gözat

Add usb canary

Bob Mottram 8 yıl önce
ebeveyn
işleme
c7bffe6a77
2 değiştirilmiş dosya ile 19 ekleme ve 0 silme
  1. 11
    0
      src/freedombone-usb-canary
  2. 8
    0
      src/freedombone-utils-setup

+ 11
- 0
src/freedombone-usb-canary Dosyayı Görüntüle

@@ -0,0 +1,11 @@
1
+#!/bin/bash
2
+
3
+PROJECT_NAME=freedombone
4
+
5
+ADMIN_USER=$(cat /root/${PROJECT_NAME}-completed.txt | grep 'Admin user' | awk -F ':' '{print $2}')
6
+#MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname)
7
+MY_EMAIL_ADDRESS=root@$(cat /etc/hostname)
8
+echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" ${MY_EMAIL_ADDRESS}
9
+echo "${ACTION}" > /tmp/usb-canary
10
+echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary
11
+echo "$(date)" >> /tmp/usb-canary

+ 8
- 0
src/freedombone-utils-setup Dosyayı Görüntüle

@@ -551,6 +551,11 @@ function disable_null_passwords {
551 551
     sed -i 's| nullok_secure||g' /etc/pam.d/common-auth
552 552
 }
553 553
 
554
+function create_usb_canary {
555
+    echo "ACTION==\"add\", KERNEL==\"sd*[!0-9]\", RUN+=\"/usr/local/bin/${PROJECT_NAME}-usb-canary\"" > /etc/udev/rules.d/00-usb-canary.rules
556
+    udevadm control --reload-rules
557
+}
558
+
554 559
 function setup_firewall {
555 560
     function_check create_completion_file
556 561
     create_completion_file
@@ -778,6 +783,9 @@ function setup_utils {
778 783
 
779 784
     function_check schedule_stig_tests
780 785
     schedule_stig_tests
786
+
787
+    function_check create_usb_canary
788
+    create_usb_canary
781 789
 }
782 790
 
783 791
 function setup_email {