-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlabcheck7.bash
More file actions
48 lines (42 loc) · 1.21 KB
/
Copy pathlabcheck7.bash
File metadata and controls
48 lines (42 loc) · 1.21 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
#!/bin/bash
# OPS335 Lab 7 configuration check
# Written by: Peter Callaghan
# Last Modified: 29 Nov, '19
# This script runs a series of commands to show the current configuration of the machine it is run on
# Run it on each of your machines, and attach the output from all of them to your lab submission.
if [ `getenforce` != "Enforcing" ]
then
echo "SELinux is not currently enforcing on this machine. Turn it back on, and do not turn it off again." >&2
exit 2
fi
if [ `systemctl is-active iptables` != "active" ]
then
echo "This machine does not have a running firewall. Turn it back on, and do not turn it off again." >&2
exit 3
elif [ `iptables -L INPUT | wc -l` -le 2 -a `iptables -L INPUT | grep -c "policy ACCEPT"` -gt 0 ]
then
echo "The firewall on this machine is allowing all incoming traffic. It should not be. Fix this." >&2
exit 4
fi
date
echo
echo "hostname:"`hostname`
echo
echo "SELinux status:"`getenforce`
echo
echo "Static Addressing"
for each in /etc/sysconfig/network-scripts/ifcfg-*
do
echo "Static configuration for $each"
cat $each
echo
done
#VM4 only
echo "LDAP Configuration"
if [ "`hostname -s`" == "vm4" ]
then
ldapsearch -x -b 'dc=andrew,dc=ops'
else
#everyone else
authconfig --test
fi