-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathaudit-status
More file actions
executable file
·66 lines (57 loc) · 1.28 KB
/
audit-status
File metadata and controls
executable file
·66 lines (57 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
function get_processes_with_name(){
process_name="$1"
result="Process(es) with name '$process_name'"
count=1
while IFS= read -r line
do
result="${result}\n\t${count}. ${line}"
count=$((count+1))
done < <(ps aux | grep $process_name | sed 's/ \{1,\}/,/g')
if [ $count -eq 1 ]
then
result="${result}\n\tNONE"
fi
echo "$result"
}
function get_lines_in_file(){
file="$1"
pattern="$2"
result="Line(s) with pattern '$pattern' in file '$file'"
count=1
if [ -f "$file" ]
then
while IFS= read -r line
do
result="${result}\n\t${count}. ${line}"
count=$((count+1))
done < <(grep "$pattern" "$file")
fi
if [ $count -eq 1 ]
then
result="${result}\n\tNONE"
fi
echo "$result"
}
echo ""
for i in "[k]auditd" "[/]sbin/auditd" "[/]sbin/audispd" "[s]pade.core.Kernel " "[s]padeAuditBridge"
do
out=`get_processes_with_name $i`
echo -e $out
echo ""
done
echo -e `get_lines_in_file /etc/audit/auditd.conf disp_qos`
echo ""
echo -e `get_lines_in_file /etc/audisp/plugins.d/af_unix.conf active`
echo ""
echo -e "Audit rules:\n\t`auditctl -l`"
echo ""
echo -e `get_lines_in_file cfg/spade.client.Control.config "^.*$"`
echo ""
lsmod_output=`lsmod | grep spade_audit`
if [ -z "$lsmod_output" ]
then
lsmod_output="NONE"
fi
echo -e "Kernel modules:\n\t${lsmod_output}"
echo ""