Update comment
Signed-off-by: Alban Vidal <alban.vidal@zordhak.fr>
This commit is contained in:
parent
4749fb6f01
commit
8a265289a8
@ -1,14 +1,18 @@
|
|||||||
|
# Extract ip address
|
||||||
ip=`echo $SSH_CONNECTION | cut -d " " -f 1`
|
ip=`echo $SSH_CONNECTION | cut -d " " -f 1`
|
||||||
|
|
||||||
# Test if ip arealy present
|
# Test if the ip address is already present
|
||||||
if ! grep $ip /tmp/list_ip_ssh_$USER >/dev/null 2>&1
|
if ! grep $ip /tmp/list_ip_ssh_$USER >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
#logger -t ssh-wrapper $USER login from $ip
|
# New ip address
|
||||||
|
# Write to log
|
||||||
logger -t ssh-wrapper -p warning $USER login from unknown ip: $ip - $(host $ip|awk '{print $5}')
|
logger -t ssh-wrapper -p warning $USER login from unknown ip: $ip - $(host $ip|awk '{print $5}')
|
||||||
|
# Send by mail
|
||||||
echo "User $USER just logged in from $ip - $(host $ip|awk '{print $5}')" |mail -s "New SSH Login to $USER in $(hostname)" __ALERT_EMAIL__
|
echo "User $USER just logged in from $ip - $(host $ip|awk '{print $5}')" |mail -s "New SSH Login to $USER in $(hostname)" __ALERT_EMAIL__
|
||||||
|
|
||||||
# add the ip in temporary list
|
# add the ip in temporary list
|
||||||
echo "$(date) - $ip" >> /tmp/list_ip_ssh_$USER
|
echo "$(date) - $ip" >> /tmp/list_ip_ssh_$USER
|
||||||
else
|
else
|
||||||
|
# IP address already present in temporary file
|
||||||
logger -t ssh-wrapper -p info $USER login from known ip: $ip
|
logger -t ssh-wrapper -p info $USER login from known ip: $ip
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user