-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathA:banners.sh
129 lines (113 loc) · 3.08 KB
/
A:banners.sh
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
echo
echo -e "\e[1;95m-------------------------[banners audit in progress]-------------------------"
fileowner=$(ls -l /etc/motd| awk '{ print $3 }'|grep -c root)
if [ $fileowner -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/motd owner\t\t\t\t\t\t\t\t$status"
filegroup=$(ls -l /etc/motd| awk '{ print $4 }'|grep -c root)
if [ $filegroup -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/motd group\t\t\t\t\t\t\t\t$status"
fileperms=$(stat --format '%a' /etc/motd|grep -c 644)
if [ $fileperms -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/motd file permissions\t\t\t\t\t\t\t$status"
filemessage=$(cat /etc/motd | grep -c "Authorized uses only. All activity may be monitored and reported.")
if [ $filemessage -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/motd content\t\t\t\t\t\t\t\t$status"
fileowner=$(ls -l /etc/issue| awk '{ print $3 }'|grep -c root)
if [ $fileowner -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/issue owner\t\t\t\t\t\t\t\t$status"
filegroup=$(ls -l /etc/issue| awk '{ print $4 }'|grep -c root)
if [ $filegroup -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/issue group\t\t\t\t\t\t\t\t$status"
fileperms=$(stat --format '%a' /etc/issue|grep -c 644)
if [ $fileperms -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/issue file permissions\t\t\t\t\t\t$status"
filemessage=$(cat /etc/issue | grep -c "Authorized uses only. All activity may be monitored and reported.")
if [ $filemessage -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/issue content\t\t\t\t\t\t\t\t$status"
fileowner=$(ls -l /etc/issue.net| awk '{ print $3 }'|grep -c root)
if [ $fileowner -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/issue.net owner\t\t\t\t\t\t\t$status"
filegroup=$(ls -l /etc/issue.net| awk '{ print $4 }'|grep -c root)
if [ $filegroup -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/issue.net group\t\t\t\t\t\t\t$status"
fileperms=$(stat --format '%a' /etc/issue.net|grep -c 644)
if [ $fileperms -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/issue.net file permissions\t\t\t\t\t\t$status"
filemessage=$(cmd < /etc/issue.net | grep -c "Authorized uses only. All activity may be monitored and reported.")
if [ $filemessage -eq 0 ];
then
status="\e[91m[ BAD ]"
#exit
else
status="\e[92m[ GOOD ]"
fi
echo -e "\e[39m[*] Checking /etc/issue.net content\t\t\t\t\t\t\t$status"
echo -e "\033[0m"
echo [SUCCESS] banners audit ran by $USER on $(date -u) | tee -a /bin/lib/sh/MK3S/data/MK3S.log