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
|
||||
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" ]]
|
||||
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
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue