-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathstep03_tcpwraps.sh
More file actions
executable file
·36 lines (32 loc) · 1015 Bytes
/
step03_tcpwraps.sh
File metadata and controls
executable file
·36 lines (32 loc) · 1015 Bytes
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
#!/bin/bash
xyz="`tail -1 /etc/hosts.deny`"
if [ "$xyz" != "ALL: ALL" ]; then
# Only make the change once
echo "ALL: ALL" >> /etc/hosts.deny
fi
chown root:root /etc/hosts.deny
chmod 0644 /etc/hosts.deny
echo "diff /etc/hosts.deny-preCIS /etc/hosts.deny"
diff /etc/hosts.deny-preCIS /etc/hosts.deny
#
#
# host.allow sample entires
# ASSUMTION: netmask is 255.255.255.0
#
# Change /etc/hosts.allow from:
# ALL: localhost, 192.168.50.2/255.255.255.0
# to:
# sshd : 192.168.50.4
# ALL EXCEPT sshd: localhost, 192.168.50.4/255.255.255.255
printf "ALL: localhost" >> /etc/hosts.allow
for I in `/sbin/ifconfig | grep "inet addr" | cut -f2 -d: | cut -f1-3 -d"." \
| grep -v ^127 | sort -n`
do
echo "Adding (, $I) to /etc/hosts.allow."
printf ", $I." >> /etc/hosts.allow;
done
echo >> /etc/hosts.allow
chown root:root /etc/hosts.allow
chmod 0644 /etc/hosts.allow
echo "diff /etc/hosts.allow-preCIS /etc/hosts.allow"
diff /etc/hosts.allow-preCIS /etc/hosts.allow