|
发表于 2006-2-8 16:43:12
|
显示全部楼层
刚才看了看hosts_access的man , 根据你的需要做了如下的配置满足了你的要求:
1. 编辑/etc/syslog.conf,在文件尾加入- local1.* /var/log/sshd.log
复制代码 2. 重启syslog服务3. 编辑/etc/hosts.allow,在文件尾加入- sshd : 192.168.0. 10.0. : spawn ( /sbin/initlog -f local1 -s "%a was allowed " ) &
复制代码 其中192.168.0.0/24和10.0.0.0/16 是允许ssh的网段,根据你的实际需要配置
4. 编辑/etc/hosts.allow,在文件尾加入- sshd : ALL : spawn ( /sbin/initlog -f local1 -s "%a was denied " ) &
复制代码
测试:
如果从192.168.0.1 ssh到 我的laptop , /var/log/sshd.log 显示:- Feb 8 16:37:38 zoukai-laptop : 192.168.0.1 was allowed
复制代码 如果从192.168.1.1 ssh到 我的laptop , /var/log/sshd.log 显示:- Feb 8 16:37:40 zoukai-laptop : 192.168.1.1 was denied
复制代码 |
|