xref: /freebsd/contrib/tcp_wrappers/Banners.Makefile (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1# @(#) Banners.Makefile 1.3 97/02/12 02:13:18
2#
3# Install this file as the Makefile in your directory with banner files.
4# It will convert a prototype banner text to a form that is suitable for
5# the ftp, telnet, rlogin, and other services.
6#
7# You'll have to comment out the IN definition below if your daemon
8# names don't start with `in.'.
9#
10# The prototype text should live in the banners directory, as a file with
11# the name "prototype". In the prototype text you can use %<character>
12# sequences as described in the hosts_access.5 manual page (`nroff -man'
13# format).  The sequences will be expanded while the banner message is
14# sent to the client. For example:
15#
16#	Hello %u@%h, what brings you here?
17#
18# Expands to: Hello username@hostname, what brings you here? Note: the
19# use of %u forces a client username lookup.
20#
21# In order to use banners, build the tcp wrapper with -DPROCESS_OPTIONS
22# and use hosts.allow rules like this:
23#
24#	daemons ... : clients ... : banners /some/directory ...
25#
26# Of course, nothing prevents you from using multiple banner directories.
27# For example, one banner directory for clients that are granted service,
28# one banner directory for rejected clients, and one banner directory for
29# clients with a hostname problem.
30#
31SHELL	= /bin/sh
32IN	= in.
33BANNERS	= $(IN)telnetd $(IN)ftpd $(IN)rlogind # $(IN)fingerd $(IN)rshd
34
35all:	$(BANNERS)
36
37$(IN)telnetd: prototype
38	cp prototype $@
39	chmod 644 $@
40
41$(IN)ftpd: prototype
42	sed 's/^/220-/' prototype > $@
43	chmod 644 $@
44
45$(IN)rlogind: prototype nul
46	( ./nul ; cat prototype ) > $@
47	chmod 644 $@
48
49# Other services: banners may interfere with normal operation
50# so they should probably be used only when refusing service.
51# In particular, banners don't work with standard rsh daemons.
52# You would have to use an rshd that has built-in tcp wrapper
53# support, for example the rshd that is part of the logdaemon
54# utilities.
55
56$(IN)fingerd: prototype
57	cp prototype $@
58	chmod 644 $@
59
60$(IN)rshd: prototype nul
61	( ./nul ; cat prototype ) > $@
62	chmod 644 $@
63
64# In case no /dev/zero available, let's hope they have at least
65# a C compiler of some sort.
66
67nul:
68	echo 'main() { write(1,"",1); return(0); }' >nul.c
69	$(CC) $(CFLAGS) -s -o nul nul.c
70	rm -f nul.c
71