当前位置:首页 > 操作系统 > Ios

nagios监控登陆地址

我们在做安全的时候经常会限制一些可以使用ssh登陆的ip地址,这一点我觉得很有必要。这里我写了一个监控登陆地址的脚本

#!/bin/bash
iplist=$(w|awk ‘NR!=1&&NR!=2&&/pts/||/pty/{print $3}‘)
flag=0
for ip in $iplist
do
  if [ $ip = ‘180.168.*.*‘ ] || echo $ip|grep -q ‘192.168.4.‘;then
    :
  else
    flag=1
    illegal=${ip}
  fi
done
if [ $flag -eq 1 ];then
  echo $illegal is illegal
  exit 1
else
  echo All loginer is legal
  exit 0
fi

本文出自 “不抛弃!不放弃” 博客,请务必保留此出处http://thedream.blog.51cto.com/6427769/1676339

原文:http://thedream.blog.51cto.com/6427769/1676339


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!