Skip to content

Commit

Permalink
Merge pull request #1554 from iasdeoupxe/patch-1
Browse files Browse the repository at this point in the history
host-deny.sh: Move duplicate entry check into the add action
  • Loading branch information
atomicturtle authored Oct 9, 2018
2 parents c7a3850 + 955af3c commit e68ba6a
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions active-response/host-deny.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,11 @@ if [ ! $? = 0 ]; then
fi


# Looking for duplication
IPKEY=$(grep -w "${IP}" /etc/hosts.deny)
if [ ! -z "$IPKEY" ]
then
IPKEY="1"
else
IPKEY="0"
fi


# Adding the ip to hosts.deny
if [ "x${ACTION}" = "xadd" ]; then
if [ "$IPKEY" -eq "1" ]; then
# Looking for duplication
IPKEY=$(grep -w "${IP}" /etc/hosts.deny)
if [ ! -z "$IPKEY" ]; then
echo "IP ${IP} already exists on host.deny..." >> ${PWD}/../logs/active-responses.log
exit 1
fi
Expand Down

0 comments on commit e68ba6a

Please sign in to comment.