dont supsend if outgoing connections present
This commit is contained in:
parent
1ea39b8117
commit
c8a916d5ac
1 changed files with 12 additions and 3 deletions
|
@ -34,12 +34,21 @@ do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# CHECK FOR ACTIVE LOGINS
|
# CHECK FOR INCOMING SSH CONNECTIONS
|
||||||
|
|
||||||
LOGINS=$(netstat -tnpa | grep 'ESTABLISHED.*sshd' | tr -s ' ' | cut -d' ' -f5,7-8 | paste -d',' -s | sed 's/,/, /')
|
LOGINS=$(netstat -np | grep 'ESTABLISHED.*sshd' | tr -s ' ' | cut -d' ' -f5,7,8)
|
||||||
if ! [[ -z "$LOGINS" ]]
|
if ! [[ -z "$LOGINS" ]]
|
||||||
then
|
then
|
||||||
echo "ABORT: users logged in: $LOGINS"
|
echo "ABORT: incoming ssh connections: $LOGINS"
|
||||||
|
exit 75
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CHECK FOR OUTGOING SSH CONNECTIONS
|
||||||
|
|
||||||
|
LOGINS=$(netstat -np | grep 'ESTABLISHED.*ssh[^d]' | tr -s ' ' | cut -d' ' -f5,7,8)
|
||||||
|
if ! [[ -z "$LOGINS" ]]
|
||||||
|
then
|
||||||
|
echo "ABORT: outgoing ssh connections: $LOGINS"
|
||||||
exit 75
|
exit 75
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue