TCP Wrapper 特殊使用
更多,更好内容请参见: http://www.ibm.com/developerworks/cn/aix/library/au-tcpwrapper/
一. 用处和用法
没有符合hosts.allow,hosts.deny中的配置的主机,用ssh登陆到我的系统的时候,我希望记录下他的动作,以便用于查询认证只用,这个时候就可以用到TCP Wrappers 的特殊功能。 但是要确定安装tcp_wrappers软件才能使用: " yum install tcp_wrappers"。 这时,就会有更加详细的操作:
spawn : 可以利用后续的shell进行额外的工作,并且可以使用变量:
%h: hostname
%a: address
%d: daemon
twist: 立刻一后续的命令进行,且执行完后终止此次连接
二. 简单范例
1. spawn的使用:
1.1 设置hosts.allow,hosts.deny. 加入相应的spawn配置。
达到的目标: 如果是未经允许的网段登录到我的主机时,就向root账户发送一条mail,mail的内容形式为:
security notice from host ****
the host **** which is not permitted tried to ssh to you computer
hosts.allow
#
# hosts.allow This file contains access rules which are used to
# allow or deny connections to network services that
# either use the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#
sshd: 192.168.1.2,192.168.1.1: allow
hosts.deny
#
# hosts.deny This file contains access rules which are used to
# deny connections to network services that either use
# the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# The rules in this file can also be set up in
# /etc/hosts.allow with a 'deny' option instead.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#
sshd: ALL :spawn ( echo "security notice from host $(/bin/hostname)"; \
echo "the host %h which is not permitted tried to ssh to you computer"; echo;) | \
/bin/mail -s "%d-%h security" root
1.2 用不在允许范围的主机192.168.1.12尝试用ssh登陆到这台主机(192.168.1.11)
主机拒绝登陆
1.3 在主机(192.168.1.11)查看收到的新mai,内容如下:
l
2.twist用法
在hosts.deny文件后边加上设置:
#
# hosts.deny This file contains access rules which are used to
# deny connections to network services that either use
# the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# The rules in this file can also be set up in
# /etc/hosts.allow with a 'deny' option instead.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#
sshd: ALL :spawn ( echo "security notice from host $(/bin/hostname)"; \
echo "the host %h which is not permitted tried to ssh to you computer"; echo;) | \
/bin/mail -s "%d-%h security" root & \
:twist (/bin/echo "YOU ARE NOT ALLOWED TO ENTER THE COMPUTER")
在192.168.1.12上用ssh登陆到192.168.1.11上时,并没有出现YOU ARE NOT ALLOWED TO ENTER THE COMPUTER。 查找了很长时间的问题,但是依然没有解决。
这样 sshd: ALL :twist (/bin/echo "YOU ARE NOT ALLOWED TO ENTER THE COMPUTER"),也不行。
求高手解答
TCP Wrapper 特殊使用的更多相关文章
- Linux中TCP wrapper的使用
Linux中TCP wrapper的使用 tcpwrapper的目的是对那些访问控制功能较弱的服务提供访问控制功能要想了解访问控制就必须先知道服务监听的概念: 服务监听的两种方式: listen ...
- linux TCP Wrappers
1. TCP Wrapper简介 (出处:http://www.softpanorama.org/Net/Network_security/TCP_wrappers/) (维基百科)TCP Wrapp ...
- Linux 防火墙之TCP Wrappers
1.TCPWrappers 原理 Telnet.SSH.FTP.POP和SMTP等很多网络服务都会用到TCPWrapper,它被设计为一个介于外来服务请求和系统服务回应的中间处理软件. ...
- Linux服务器安全配置
众所周知,网络安全是一个非常重要的课题,而服务器是网络安全中最关键的环节.Linux被认为是一个比较安全的Internet服务器,作为一种开放源代码操作系统,一旦Linux系统中发现有安全漏洞,Int ...
- VsFtpd服务配置简明笔记
Ftp服务是最常用的文件传输方式,把配置步骤记录下来,以备将来使用. 1.用YUM安装VsFtpd服务:[root@Redis usr]# yum install vsftpd 2.安装完成后启动Vs ...
- VsFtpd配置文件详解
1.默认配置:1>允许匿名用户和本地用户登陆. anonymous_enable=YES local_enable=YES2>匿名用户使用的登陆名为ftp或anonymou ...
- vsftp 搭建及虚拟账号配置
安装vsftpd yum -y install vsftpd chkconfig vsftpd on 修改主配置文件 vi /etc/vsftpd/vsftpd.conf # 允许匿名用户登陆,登陆时 ...
- 详解Linux目录(目录树详细解释)
给大家一篇关于Linux目录 方面的详细说明,好好读一下! Linux目录详解(RHEL5.4) linux有四种基本文件系统类型:--普通文件:如文本文件.c语言源代码.shell脚本等,可以用ca ...
- /etc/xinetd.conf 和 /etc/xinetd.d/*【新网络服务配置】
http://blog.csdn.net/kelven2004/article/details/1701930 xinetd 是 inetd 的安全加强版,它内置了自己的 TCP wrapper, 可 ...
随机推荐
- August 11th 2016, Week 33rd Thursday
A particular fine spring came around. 转眼又是一番分外明媚的春光. Hey, it is hot outside, sometimes even unbearab ...
- python基础——返回函数
python基础——返回函数 函数作为返回值 高阶函数除了可以接受函数作为参数外,还可以把函数作为结果值返回. 我们来实现一个可变参数的求和.通常情况下,求和的函数是这样定义的: def calc_ ...
- 2.3顺序容器-deque
deque(双向队列) 1) * :包含deque头文件 ** :deque也是一个可变长数组,适用于vector的操作都适用于deque ***:对比vector的优势在于在头部存取元素可以 ...
- JavaScript基础——使用数组
Array对象提供存储和处理一组其他对象的一种手段.数组可以存储数值.字符串或其他JavaScript对象.创建JavaScript数组有几种不同的方法.例如,下面的语句穿件同样的驻足的3个相同的版本 ...
- 三、jQuery--jQuery基础--jQuery基础课程--第11章 jQuery 工具类函数
1.获取浏览器的名称与版本信息 在jQuery中,通过$.browser对象可以获取浏览器的名称和版本信息,如$.browser.chrome为true,表示当前为Chrome浏览器,$.browse ...
- 三、jQuery--jQuery基础--jQuery基础课程--第7章 jQuery 动画特效
1.调用show()和hide()方法显示和隐藏元素 show()和hide()方法用于显示或隐藏页面中的元素,它的调用格式分别为:$(selector).hide(speed,[callback]) ...
- HTTP 请求头中的 X-Forwarded-For
https://imququ.com/post/x-forwarded-for-header-in-http.html
- 菜鸟学Linux命令:nohup命令启动程序
在UNIX/LINUX中,普通进程用&符号放到后台运行,如果启动该程序的控制台logout,则该进程随即终止. 要实现守护进程,一种方法是按守护进程的规则去编程,比较麻烦:另一种方法是仍然用普 ...
- Sphinx的介绍和原理探索
What/Sphinx是什么 定义 Sphinx是一个全文检索引擎. 特性 索引和性能优异 易于集成SQL和XML数据源,并可使用SphinxAPI.SphinxQL或者SphinxSE搜索接口 易于 ...
- HTML CSS微信CSS显示一些总结
微信显示网页是调用腾讯自带的浏览器内核,由于腾讯浏览器内核对css展示效果没有谷歌浏览器好,导致用谷歌浏览器写好的网页,放到微信页面之后,显示的效果就发生变化,所以调整css样式显得那么吃力: 1. ...