17c478bd9Sstevel@tonic-gate# 2*f998c95eSceastha# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 37c478bd9Sstevel@tonic-gate# Use is subject to license terms. 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 67c478bd9Sstevel@tonic-gate# 77c478bd9Sstevel@tonic-gate 87c478bd9Sstevel@tonic-gatePROG = safe_finger tcpd tcpdchk tcpdmatch try-from 97c478bd9Sstevel@tonic-gate 107c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd 117c478bd9Sstevel@tonic-gate 127c478bd9Sstevel@tonic-gateERROFF = -erroff=E_FUNC_HAS_NO_RETURN_STMT \ 1372398d67Smditto -erroff=E_IMPLICIT_DECL_FUNC_RETURN_INT \ 1472398d67Smditto -_gcc=-Wno-return-type -_gcc=-Wno-implicit 157c478bd9Sstevel@tonic-gateCFLAGS += $(CCVERBOSE) $(ERROFF) 167c478bd9Sstevel@tonic-gateCPPFLAGS += $(ACCESS) $(PARANOID) $(NETGROUP) $(TLI) \ 177c478bd9Sstevel@tonic-gate $(UMASK) $(STYLE) $(TABLES) $(KILL_OPT) $(BUGS) \ 187c478bd9Sstevel@tonic-gate -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \ 197c478bd9Sstevel@tonic-gate -DFACILITY=$(FACILITY) -DSEVERITY=$(SEVERITY) \ 207c478bd9Sstevel@tonic-gate -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \ 21*f998c95eSceastha -I../../lib/libwrap 227c478bd9Sstevel@tonic-gatetcpd tcpdmatch try-from := \ 23*f998c95eSceastha LDLIBS += -lwrap 247c478bd9Sstevel@tonic-gatetcpdchk := \ 25*f998c95eSceastha LDLIBS += -lwrap -lnsl 267c478bd9Sstevel@tonic-gate 2724da5b34Srie# Various components must export interfaces, but also contain name-space 2824da5b34Srie# clashes with system libraries. 2924da5b34SrieMAPFILE.INT.D = $(MAPFILE.NGB) mapfile-intf-tcpdchk 3024da5b34SrieMAPFILE.INT.M = $(MAPFILE.NGB) mapfile-intf-tcpdmatch 3124da5b34SrieMAPFILE.INT.F = $(MAPFILE.NGB) mapfile-intf-tryfrom 3224da5b34Srie 3324da5b34Srietcpdchk := LDFLAGS +=$(MAPFILE.INT.D:%=-M%) 3424da5b34Srietcpdmatch := LDFLAGS +=$(MAPFILE.INT.M:%=-M%) 3524da5b34Srietry-from := LDFLAGS +=$(MAPFILE.INT.F:%=-M%) 3624da5b34Srie 377c478bd9Sstevel@tonic-gate# SRCONLY files are not used for building but are included in the source code 387c478bd9Sstevel@tonic-gate# package SUNWtcpdS for consistency and completeness with respect to the 397c478bd9Sstevel@tonic-gate# public tcp_wrappers distribution. 407c478bd9Sstevel@tonic-gateSRCONLY = BLURB Banners.Makefile CHANGES DISCLAIMER Makefile \ 417c478bd9Sstevel@tonic-gate Makefile.dist Makefile.org README README.IRIX README.NIS \ 427c478bd9Sstevel@tonic-gate README.ipv6 hosts_access.c.org misc.c.org miscd.c myvsyslog.c \ 437c478bd9Sstevel@tonic-gate ncr.c printf.ck ptx.c rfc931.c.org scaffold.c.org \ 447c478bd9Sstevel@tonic-gate socket.c.diff socket.c.org strcasecmp.c tags tcpd.h.org \ 457c478bd9Sstevel@tonic-gate tcpdchk.c.org tcpdmatch.c.org tli-sequent.c tli-sequent.h \ 467c478bd9Sstevel@tonic-gate tli.c.org update.c.org vfprintf.c 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gateMANDIRS = man3 man4 man1m 497c478bd9Sstevel@tonic-gateMANPAGES = man3/hosts_access.3 man3/libwrap.3 man4/hosts_access.4 \ 507c478bd9Sstevel@tonic-gate man4/hosts_options.4 man4/hosts.allow.4 man4/hosts.deny.4 \ 517c478bd9Sstevel@tonic-gate man1m/tcpd.1m man1m/tcpdchk.1m man1m/tcpdmatch.1m 527c478bd9Sstevel@tonic-gateDISTFILES = environ.c fakelog.c hosts_access.3 hosts_access.4 \ 537c478bd9Sstevel@tonic-gate hosts_options.4 inetcf.c inetcf.h safe_finger.c scaffold.c \ 547c478bd9Sstevel@tonic-gate scaffold.h tcpd.1m tcpd.c tcpdchk.1m tcpdchk.c tcpdmatch.1m \ 557c478bd9Sstevel@tonic-gate tcpdmatch.c try-from.c README.sfw $(SRCONLY) 567c478bd9Sstevel@tonic-gate 57*f998c95eSceasthaROOTSRC = $(ROOT)/usr/share/src/tcp_wrappers 58*f998c95eSceastha$(ROOTSRC) := OWNER = root 59*f998c95eSceastha$(ROOTSRC) := GROUP = bin 60*f998c95eSceasthaROOTMAN = $(ROOT)/usr/share/man 61*f998c95eSceasthaROOTMANPAGES = $(MANPAGES:%=$(ROOTMAN)/%) 62*f998c95eSceasthaROOTMANDIRS = $(MANDIRS:%=$(ROOTMAN)/%) 63*f998c95eSceasthaROOTSRCFILES = $(DISTFILES:%=$(ROOTSRC)/%) 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate.KEEP_STATE: 667c478bd9Sstevel@tonic-gate 674e5b757fSkupferall: $(PROG) THIRDPARTYLICENSE 687c478bd9Sstevel@tonic-gate 69*f998c95eSceasthainstall: all $(ROOTUSRSBINPROG) $(ROOTMANPAGES) $(ROOTSRCFILES) 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gateclean: 727c478bd9Sstevel@tonic-gate $(RM) *.o 737c478bd9Sstevel@tonic-gate $(RM) -r sunman 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gatelint: lint_PROG 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate# These Solaris-specific man page aliases are installed verbatim. 787c478bd9Sstevel@tonic-gatesunman/libwrap.3: libwrap.3 797c478bd9Sstevel@tonic-gate mkdir -p sunman; cat libwrap.3 > $@ 807c478bd9Sstevel@tonic-gatesunman/hosts.allow.4: hosts.allow.4 817c478bd9Sstevel@tonic-gate mkdir -p sunman; cat hosts.allow.4 > $@ 827c478bd9Sstevel@tonic-gatesunman/hosts.deny.4: hosts.deny.4 837c478bd9Sstevel@tonic-gate mkdir -p sunman; cat hosts.deny.4 > $@ 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate# The rest of the man pages are in the form provided in the original 867c478bd9Sstevel@tonic-gate# distribution, but get edited and renamed to follow Solaris man page 87*f998c95eSceastha# conventions. E.g. tcpd.8 gets installed as /usr/share/man/man1m/tcpd.1m. 887c478bd9Sstevel@tonic-gate# Create temporary copies in the sunman directory with modified names 897c478bd9Sstevel@tonic-gate# and contents. The sed program man.sed contains the content edits. 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gatesunman/%.1m: %.8 927c478bd9Sstevel@tonic-gate mkdir -p sunman; sed -f man.sed < $< > $@ 937c478bd9Sstevel@tonic-gatesunman/%.4: %.5 947c478bd9Sstevel@tonic-gate mkdir -p sunman; sed -f man.sed < $< > $@ 957c478bd9Sstevel@tonic-gatesunman/%.3: %.3 967c478bd9Sstevel@tonic-gate mkdir -p sunman; sed -f man.sed < $< > $@ 977c478bd9Sstevel@tonic-gate 98*f998c95eSceastha$(ROOTMANPAGES) := FILEMODE = 0444 99*f998c95eSceastha$(ROOTMANPAGES): $(ROOTMANDIRS) $(ROOT)/usr/share/man 100*f998c95eSceastha$(ROOTMANDIRS): $(ROOTMAN) 1017c478bd9Sstevel@tonic-gate $(INS.dir) 102*f998c95eSceastha$(ROOTMAN): 1037c478bd9Sstevel@tonic-gate $(INS.dir) 104*f998c95eSceastha$(ROOTMAN1M)/% $(ROOTMAN3)/% $(ROOTMAN)/man4/%: sunman/% 1057c478bd9Sstevel@tonic-gate $(INS.file) 1067c478bd9Sstevel@tonic-gate 107*f998c95eSceastha$(ROOTSRCFILES) := FILEMODE = 0444 108*f998c95eSceastha$(ROOTSRCFILES): $(ROOTSRC) 109*f998c95eSceastha$(ROOTSRC): 1107c478bd9Sstevel@tonic-gate $(INS.dir) 111*f998c95eSceastha$(ROOTSRC)/%: %.sfwsrc 1127c478bd9Sstevel@tonic-gate $(INS.rename) 113*f998c95eSceastha$(ROOTSRC)/%: sunman/% 1147c478bd9Sstevel@tonic-gate $(INS.file) 115*f998c95eSceastha$(ROOTSRC)/%: % 1167c478bd9Sstevel@tonic-gate $(INS.file) 1177c478bd9Sstevel@tonic-gate 118*f998c95eSceastha$(ROOT)/usr/share: $(ROOT)/usr 1197c478bd9Sstevel@tonic-gate $(INS.dir) 120*f998c95eSceastha$(ROOT)/usr: $(ROOT) 1217c478bd9Sstevel@tonic-gate $(INS.dir) 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gateTCPDMATCH_OBJ = tcpdmatch.o fakelog.o inetcf.o scaffold.o 1247c478bd9Sstevel@tonic-gate 12524da5b34Srietcpdmatch: $(TCPDMATCH_OBJ) $(LIB) $(MAPFILE.INTF.M) 1267c478bd9Sstevel@tonic-gate $(LINK.c) -o $@ $(TCPDMATCH_OBJ) $(LDLIBS) 1277c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1287c478bd9Sstevel@tonic-gate 12924da5b34Srietry-from: try-from.o fakelog.o $(LIB) $(MAPFILE.INTF.F) 1307c478bd9Sstevel@tonic-gate $(LINK.c) -o $@ try-from.o fakelog.o $(LDLIBS) 1317c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gateTCPDCHK_OBJ = tcpdchk.o fakelog.o inetcf.o scaffold.o 1347c478bd9Sstevel@tonic-gate 13524da5b34Srietcpdchk: $(TCPDCHK_OBJ) $(LIB) $(MAPFILE.INTF.C) 1367c478bd9Sstevel@tonic-gate $(LINK.c) -o $@ $(TCPDCHK_OBJ) $(LDLIBS) 1377c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1387c478bd9Sstevel@tonic-gate 1394e5b757fSkupferTHIRDPARTYLICENSE: DISCLAIMER 1404e5b757fSkupfer $(GREP) -v '\*\*\*\*' DISCLAIMER > $@ 1417c478bd9Sstevel@tonic-gate 1424e5b757fSkupferCLOBBERFILES += THIRDPARTYLICENSE 1434e5b757fSkupfer 1444e5b757fSkupferinclude ../Makefile.targ 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate# The rest of this file contains definitions more-or-less directly from the 1477c478bd9Sstevel@tonic-gate# original Makefile of the tcp_wrappers distribution. 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate############################## 1507c478bd9Sstevel@tonic-gate# System parameters appropriate for Solaris 9 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gateREAL_DAEMON_DIR = /usr/sbin 1537c478bd9Sstevel@tonic-gateTLI = -DTLI 1547c478bd9Sstevel@tonic-gateNETGROUP = -DNETGROUP 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate############################## 1577c478bd9Sstevel@tonic-gate# Start of the optional stuff. 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate########################################### 1607c478bd9Sstevel@tonic-gate# Optional: Turning on language extensions 1617c478bd9Sstevel@tonic-gate# 1627c478bd9Sstevel@tonic-gate# Instead of the default access control language that is documented in 1637c478bd9Sstevel@tonic-gate# the hosts_access.5 document, the wrappers can be configured to 1647c478bd9Sstevel@tonic-gate# implement an extensible language documented in the hosts_options.5 1657c478bd9Sstevel@tonic-gate# document. This language is implemented by the "options.c" source 1667c478bd9Sstevel@tonic-gate# module, which also gives hints on how to add your own extensions. 1677c478bd9Sstevel@tonic-gate# Uncomment the next definition to turn on the language extensions 1687c478bd9Sstevel@tonic-gate# (examples: allow, deny, banners, twist and spawn). 1697c478bd9Sstevel@tonic-gate# 1707c478bd9Sstevel@tonic-gateSTYLE = -DPROCESS_OPTIONS # Enable language extensions. 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate################################################################ 1737c478bd9Sstevel@tonic-gate# Optional: Changing the default disposition of logfile records 1747c478bd9Sstevel@tonic-gate# 1757c478bd9Sstevel@tonic-gate# By default, logfile entries are written to the same file as used for 1767c478bd9Sstevel@tonic-gate# sendmail transaction logs. See your /etc/syslog.conf file for actual 1777c478bd9Sstevel@tonic-gate# path names of logfiles. The tutorial section in the README file 1787c478bd9Sstevel@tonic-gate# gives a brief introduction to the syslog daemon. 1797c478bd9Sstevel@tonic-gate# 1807c478bd9Sstevel@tonic-gate# Change the FACILITY definition below if you disagree with the default 1817c478bd9Sstevel@tonic-gate# disposition. Some syslog versions (including Ultrix 4.x) do not provide 1827c478bd9Sstevel@tonic-gate# this flexibility. 1837c478bd9Sstevel@tonic-gate# 1847c478bd9Sstevel@tonic-gate# If nothing shows up on your system, it may be that the syslog records 1857c478bd9Sstevel@tonic-gate# are sent to a dedicated loghost. It may also be that no syslog daemon 1867c478bd9Sstevel@tonic-gate# is running at all. The README file gives pointers to surrogate syslog 1877c478bd9Sstevel@tonic-gate# implementations for systems that have no syslog library routines or 1887c478bd9Sstevel@tonic-gate# no syslog daemons. When changing the syslog.conf file, remember that 1897c478bd9Sstevel@tonic-gate# there must be TABs between fields. 1907c478bd9Sstevel@tonic-gate# 1917c478bd9Sstevel@tonic-gate# The LOG_XXX names below are taken from the /usr/include/syslog.h file. 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gateFACILITY= LOG_MAIL # LOG_MAIL is what most sendmail daemons use 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate# The syslog priority at which successful connections are logged. 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gateSEVERITY= LOG_INFO # LOG_INFO is normally not logged to the console 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate###################################################### 2007c478bd9Sstevel@tonic-gate# Optional: Changing the default file protection mask 2017c478bd9Sstevel@tonic-gate# 2027c478bd9Sstevel@tonic-gate# On many systems, network daemons and other system processes are started 2037c478bd9Sstevel@tonic-gate# with a zero umask value, so that world-writable files may be produced. 2047c478bd9Sstevel@tonic-gate# It is a good idea to edit your /etc/rc* files so that they begin with 2057c478bd9Sstevel@tonic-gate# an explicit umask setting. On our site we use `umask 022' because it 2067c478bd9Sstevel@tonic-gate# does not break anything yet gives adequate protection against tampering. 2077c478bd9Sstevel@tonic-gate# 2087c478bd9Sstevel@tonic-gate# The following macro specifies the default umask for processes run under 2097c478bd9Sstevel@tonic-gate# control of the daemon wrappers. Comment it out only if you are certain 2107c478bd9Sstevel@tonic-gate# that inetd and its children are started with a safe umask value. 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gateUMASK = -DDAEMON_UMASK=022 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate####################################### 2157c478bd9Sstevel@tonic-gate# Optional: Turning off access control 2167c478bd9Sstevel@tonic-gate# 2177c478bd9Sstevel@tonic-gate# By default, host access control is enabled. To disable host access 2187c478bd9Sstevel@tonic-gate# control, comment out the following definition. Host access control 2197c478bd9Sstevel@tonic-gate# can also be turned off at runtime by providing no or empty access 2207c478bd9Sstevel@tonic-gate# control tables. 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gateACCESS = -DHOSTS_ACCESS 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate#################################################### 2257c478bd9Sstevel@tonic-gate# Optional: dealing with host name/address conflicts 2267c478bd9Sstevel@tonic-gate# 2277c478bd9Sstevel@tonic-gate# By default, the software tries to protect against hosts that claim to 2287c478bd9Sstevel@tonic-gate# have someone elses host name. This is relevant for network services 2297c478bd9Sstevel@tonic-gate# whose authentication depends on host names, such as rsh and rlogin. 2307c478bd9Sstevel@tonic-gate# 2317c478bd9Sstevel@tonic-gate# With paranoid mode on, connections will be rejected when the host name 2327c478bd9Sstevel@tonic-gate# does not match the host address. Connections will also be rejected when 2337c478bd9Sstevel@tonic-gate# the host name is available but cannot be verified. 2347c478bd9Sstevel@tonic-gate# 2357c478bd9Sstevel@tonic-gate# Comment out the following definition if you want more control over such 2367c478bd9Sstevel@tonic-gate# requests. When paranoid mode is off and a host name double check fails, 2377c478bd9Sstevel@tonic-gate# the client can be matched with the PARANOID access control pattern. 2387c478bd9Sstevel@tonic-gate# 2397c478bd9Sstevel@tonic-gate# Paranoid mode implies hostname lookup. In order to disable hostname 2407c478bd9Sstevel@tonic-gate# lookups altogether, see the next section. 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gatePARANOID= -DPARANOID 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate# The default username lookup timeout is 10 seconds. This may not be long 2457c478bd9Sstevel@tonic-gate# enough for slow hosts or networks, but is enough to irritate PC users. 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gateRFC931_TIMEOUT = 10 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate######################################################## 2507c478bd9Sstevel@tonic-gate# Optional: Changing the access control table pathnames 2517c478bd9Sstevel@tonic-gate# 2527c478bd9Sstevel@tonic-gate# The HOSTS_ALLOW and HOSTS_DENY macros define where the programs will 2537c478bd9Sstevel@tonic-gate# look for access control information. Watch out for the quotes and 2547c478bd9Sstevel@tonic-gate# backslashes when you make changes. 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gateTABLES = -DHOSTS_DENY=\"/etc/hosts.deny\" -DHOSTS_ALLOW=\"/etc/hosts.allow\" 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate############################################# 2597c478bd9Sstevel@tonic-gate# Optional: Turning on host ADDRESS checking 2607c478bd9Sstevel@tonic-gate# 2617c478bd9Sstevel@tonic-gate# Optionally, the software tries to protect against hosts that pretend to 2627c478bd9Sstevel@tonic-gate# have someone elses host address. This is relevant for network services 2637c478bd9Sstevel@tonic-gate# whose authentication depends on host names, such as rsh and rlogin, 2647c478bd9Sstevel@tonic-gate# because the network address is used to look up the remote host name. 2657c478bd9Sstevel@tonic-gate# 2667c478bd9Sstevel@tonic-gate# The protection is to refuse TCP connections with IP source routing 2677c478bd9Sstevel@tonic-gate# options. 2687c478bd9Sstevel@tonic-gate# 2697c478bd9Sstevel@tonic-gate# This feature cannot be used with SunOS 4.x because of a kernel bug in 2707c478bd9Sstevel@tonic-gate# the implementation of the getsockopt() system call. Kernel panics have 2717c478bd9Sstevel@tonic-gate# been observed for SunOS 4.1.[1-3]. Symptoms are "BAD TRAP" and "Data 2727c478bd9Sstevel@tonic-gate# fault" while executing the tcp_ctloutput() kernel function. 2737c478bd9Sstevel@tonic-gate# 2747c478bd9Sstevel@tonic-gate# Reportedly, Sun patch 100804-03 or 101790 fixes this for SunOS 4.1.x. 2757c478bd9Sstevel@tonic-gate# 2767c478bd9Sstevel@tonic-gate# Uncomment the following macro definition if your getsockopt() is OK. 2777c478bd9Sstevel@tonic-gate# 2787c478bd9Sstevel@tonic-gate# -DKILL_IP_OPTIONS is not needed on modern UNIX systems that can stop 2797c478bd9Sstevel@tonic-gate# source-routed traffic in the kernel. Examples: 4.4BSD derivatives, 2807c478bd9Sstevel@tonic-gate# Solaris 2.x, and Linux. See your system documentation for details. 2817c478bd9Sstevel@tonic-gate# 2827c478bd9Sstevel@tonic-gate# KILL_OPT= -DKILL_IP_OPTIONS 2837c478bd9Sstevel@tonic-gate 2847c478bd9Sstevel@tonic-gate## End configuration options 2857c478bd9Sstevel@tonic-gate############################ 286