LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 734|回复: 2

tcp wrapper中的banners为何无效?

[复制链接]
发表于 2006-9-1 10:50:24 | 显示全部楼层 |阅读模式
请教各位高手:
我的配置如下,为何banners没有生效啊?
[root@taobao root]# cat [color="Blue"]/etc/hosts.allow
#
# hosts.allow   This file describes the names of the hosts which are
#               allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
vsftpd : ALL : banners /etc/banners/
sshd   : ALL : banners /etc/banners/

[root@taobao root]# cat [color="blue"]/etc/banners/vsftpd
220-Hello, %c
220-All activity on ftp.example.com is logged.
220-Act up and you will be banned.

[root@taobao root]# cat  [color="blue"]/etc/banners/sshd
220-Hello, %c
220-All ssh activity to  %H is logged.
220-Act up and you will be banned.

有了以上的配置,按说我无论是ssh连接到server还是ftp到server,都应该会有相应文件的内容显示,但实际上却没有,和没配banners以前一样。
请高手指点,谢谢!
 楼主| 发表于 2006-9-1 14:16:28 | 显示全部楼层
自己顶一下:
log里有这个报错:
Aug 29 17:25:37 taobao vsftpd: warning: can't get client address: Bad file descriptor
请高人指点啊
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-1 15:26:53 | 显示全部楼层
继续研究发现:
1、In order to support banner messages the wrappers have to be built with
language extensions enabled.
2、the language extensions are not enabled by default because they
introduce an incompatible change to the access control language
syntax.  Instructions to enable the extensions are given in the
Makefile.
下面是makefile的内容
# @(#) Banners.Makefile 1.3 97/02/12 02:13:18
#
# Install this file as the Makefile in your directory with banner files.
# It will convert a prototype banner text to a form that is suitable for
# the ftp, telnet, rlogin, and other services.
#
# You'll have to comment out the IN definition below if your daemon
# names don't start with `in.'.
#
# The prototype text should live in the banners directory, as a file with
# the name "prototype". In the prototype text you can use %<character>
# sequences as described in the hosts_access.5 manual page (`nroff -man'
# format).  The sequences will be expanded while the banner message is
# sent to the client. For example:
#
#       Hello %u@%h, what brings you here?
#
# Expands to: Hello username@hostname, what brings you here? Note: the
# use of %u forces a client username lookup.
#
# In order to use banners, build the tcp wrapper with -DPROCESS_OPTIONS
# and use hosts.allow rules like this:
#
#       daemons ... : clients ... : banners /some/directory ...
#
# Of course, nothing prevents you from using multiple banner directories.
# For example, one banner directory for clients that are granted service,
# one banner directory for rejected clients, and one banner directory for
# clients with a hostname problem.
#
SHELL   = /bin/sh
IN      = in.
BANNERS = $(IN)telnetd $(IN)ftpd $(IN)rlogind # $(IN)fingerd $(IN)rshd

all:    $(BANNERS)

$(IN)telnetd: prototype
        cp prototype $@# Other services: banners may interfere with normal operation
# so they should probably be used only when refusing service.
# In particular, banners don't work with standard rsh daemons.
# You would have to use an rshd that has built-in tcp wrapper
# support, for example the rshd that is part of the logdaemon
# utilities.

$(IN)fingerd: prototype
        cp prototype $@
        chmod 644 $@

$(IN)rshd: prototype nul
        ( ./nul ; cat prototype ) > $@
        chmod 644 $@

# In case no /dev/zero available, let's hope they have at least
# a C compiler of some sort.

nul:
        echo 'main() { write(1,"",1); return(0); }' >nul.c
        $(CC) $(CFLAGS) -s -o nul nul.c
        rm -f nul.c

        chmod 644 $@

$(IN)ftpd: prototype
        sed 's/^/220-/' prototype > $@
        chmod 644 $@


$(IN)rlogind: prototype nul
        ( ./nul ; cat prototype ) > $@
        chmod 644 $@

# Other services: banners may interfere with normal operation
# so they should probably be used only when refusing service.
# In particular, banners don't work with standard rsh daemons.
# You would have to use an rshd that has built-in tcp wrapper
# support, for example the rshd that is part of the logdaemon
# utilities.

$(IN)fingerd: prototype
        cp prototype $@
        chmod 644 $@

$(IN)rshd: prototype nul
        ( ./nul ; cat prototype ) > $@
        chmod 644 $@

# In case no /dev/zero available, let's hope they have at least
# a C compiler of some sort.

nul:
        echo 'main() { write(1,"",1); return(0); }' >nul.c
        $(CC) $(CFLAGS) -s -o nul nul.c
        rm -f nul.c


关键是Makefile中的说明不是很看得懂,请有经验的人指点啊,多谢了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表