17c478bd9Sstevel@tonic-gate# 224fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 37c478bd9Sstevel@tonic-gate# Use is subject to license terms. 47c478bd9Sstevel@tonic-gate# 5ead9bb4bSYuri Pankov# Copyright 2011 Nexenta Systems, Inc. All rights reserved. 6ead9bb4bSYuri Pankov# 77c478bd9Sstevel@tonic-gate 87c478bd9Sstevel@tonic-gatePROG= safe_finger tcpd tcpdchk tcpdmatch try-from 97c478bd9Sstevel@tonic-gate 107c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd 117c478bd9Sstevel@tonic-gate 12*7014882cSRichard LoweCFLAGS += $(CCVERBOSE) 137c478bd9Sstevel@tonic-gateCPPFLAGS += $(ACCESS) $(PARANOID) $(NETGROUP) $(TLI) \ 147c478bd9Sstevel@tonic-gate $(UMASK) $(STYLE) $(TABLES) $(KILL_OPT) $(BUGS) \ 157c478bd9Sstevel@tonic-gate -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \ 167c478bd9Sstevel@tonic-gate -DFACILITY=$(FACILITY) -DSEVERITY=$(SEVERITY) \ 177c478bd9Sstevel@tonic-gate -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \ 18f998c95eSceastha -I../../lib/libwrap 197c478bd9Sstevel@tonic-gatetcpd tcpdmatch try-from := \ 20f998c95eSceastha LDLIBS += -lwrap 21ead9bb4bSYuri Pankovtcpdchk := LDLIBS += -lwrap -lnsl 227c478bd9Sstevel@tonic-gate 23*7014882cSRichard LoweCERRWARN += -erroff=E_FUNC_HAS_NO_RETURN_STMT 24*7014882cSRichard LoweCERRWARN += -erroff=E_IMPLICIT_DECL_FUNC_RETURN_INT 25*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 26*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 27*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized 28*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-implicit-function-declaration 29*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-return-type 30*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered 31*7014882cSRichard Lowe 3224da5b34Srie# Various components must export interfaces, but also contain name-space 3324da5b34Srie# clashes with system libraries. 3424da5b34SrieMAPFILE.INT.D= $(MAPFILE.NGB) mapfile-intf-tcpdchk 3524da5b34SrieMAPFILE.INT.M= $(MAPFILE.NGB) mapfile-intf-tcpdmatch 3624da5b34SrieMAPFILE.INT.F= $(MAPFILE.NGB) mapfile-intf-tryfrom 3724da5b34Srie 3824da5b34Srietcpdchk := LDFLAGS +=$(MAPFILE.INT.D:%=-M%) 3924da5b34Srietcpdmatch := LDFLAGS +=$(MAPFILE.INT.M:%=-M%) 4024da5b34Srietry-from := LDFLAGS +=$(MAPFILE.INT.F:%=-M%) 4124da5b34Srie 427c478bd9Sstevel@tonic-gate.KEEP_STATE: 437c478bd9Sstevel@tonic-gate 44ead9bb4bSYuri Pankovall: $(PROG) 457c478bd9Sstevel@tonic-gate 46ead9bb4bSYuri Pankovinstall: all $(ROOTUSRSBINPROG) 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gateclean: 497c478bd9Sstevel@tonic-gate $(RM) *.o 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gatelint: lint_PROG 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gateTCPDMATCH_OBJ= tcpdmatch.o fakelog.o inetcf.o scaffold.o 547c478bd9Sstevel@tonic-gate 5524da5b34Srietcpdmatch: $(TCPDMATCH_OBJ) $(LIB) $(MAPFILE.INTF.M) 567c478bd9Sstevel@tonic-gate $(LINK.c) -o $@ $(TCPDMATCH_OBJ) $(LDLIBS) 577c478bd9Sstevel@tonic-gate $(POST_PROCESS) 587c478bd9Sstevel@tonic-gate 5924da5b34Srietry-from: try-from.o fakelog.o $(LIB) $(MAPFILE.INTF.F) 607c478bd9Sstevel@tonic-gate $(LINK.c) -o $@ try-from.o fakelog.o $(LDLIBS) 617c478bd9Sstevel@tonic-gate $(POST_PROCESS) 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gateTCPDCHK_OBJ= tcpdchk.o fakelog.o inetcf.o scaffold.o 647c478bd9Sstevel@tonic-gate 6524da5b34Srietcpdchk: $(TCPDCHK_OBJ) $(LIB) $(MAPFILE.INTF.C) 667c478bd9Sstevel@tonic-gate $(LINK.c) -o $@ $(TCPDCHK_OBJ) $(LDLIBS) 677c478bd9Sstevel@tonic-gate $(POST_PROCESS) 687c478bd9Sstevel@tonic-gate 694e5b757fSkupferinclude ../Makefile.targ 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate# The rest of this file contains definitions more-or-less directly from the 727c478bd9Sstevel@tonic-gate# original Makefile of the tcp_wrappers distribution. 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate############################## 757c478bd9Sstevel@tonic-gate# System parameters appropriate for Solaris 9 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gateREAL_DAEMON_DIR = /usr/sbin 787c478bd9Sstevel@tonic-gateTLI = -DTLI 797c478bd9Sstevel@tonic-gateNETGROUP = -DNETGROUP 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate############################## 827c478bd9Sstevel@tonic-gate# Start of the optional stuff. 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate########################################### 857c478bd9Sstevel@tonic-gate# Optional: Turning on language extensions 867c478bd9Sstevel@tonic-gate# 877c478bd9Sstevel@tonic-gate# Instead of the default access control language that is documented in 887c478bd9Sstevel@tonic-gate# the hosts_access.5 document, the wrappers can be configured to 897c478bd9Sstevel@tonic-gate# implement an extensible language documented in the hosts_options.5 907c478bd9Sstevel@tonic-gate# document. This language is implemented by the "options.c" source 917c478bd9Sstevel@tonic-gate# module, which also gives hints on how to add your own extensions. 927c478bd9Sstevel@tonic-gate# Uncomment the next definition to turn on the language extensions 937c478bd9Sstevel@tonic-gate# (examples: allow, deny, banners, twist and spawn). 947c478bd9Sstevel@tonic-gate# 957c478bd9Sstevel@tonic-gateSTYLE = -DPROCESS_OPTIONS # Enable language extensions. 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate################################################################ 987c478bd9Sstevel@tonic-gate# Optional: Changing the default disposition of logfile records 997c478bd9Sstevel@tonic-gate# 1007c478bd9Sstevel@tonic-gate# By default, logfile entries are written to the same file as used for 1017c478bd9Sstevel@tonic-gate# sendmail transaction logs. See your /etc/syslog.conf file for actual 1027c478bd9Sstevel@tonic-gate# path names of logfiles. The tutorial section in the README file 1037c478bd9Sstevel@tonic-gate# gives a brief introduction to the syslog daemon. 1047c478bd9Sstevel@tonic-gate# 1057c478bd9Sstevel@tonic-gate# Change the FACILITY definition below if you disagree with the default 1067c478bd9Sstevel@tonic-gate# disposition. Some syslog versions (including Ultrix 4.x) do not provide 1077c478bd9Sstevel@tonic-gate# this flexibility. 1087c478bd9Sstevel@tonic-gate# 1097c478bd9Sstevel@tonic-gate# If nothing shows up on your system, it may be that the syslog records 1107c478bd9Sstevel@tonic-gate# are sent to a dedicated loghost. It may also be that no syslog daemon 1117c478bd9Sstevel@tonic-gate# is running at all. The README file gives pointers to surrogate syslog 1127c478bd9Sstevel@tonic-gate# implementations for systems that have no syslog library routines or 1137c478bd9Sstevel@tonic-gate# no syslog daemons. When changing the syslog.conf file, remember that 1147c478bd9Sstevel@tonic-gate# there must be TABs between fields. 1157c478bd9Sstevel@tonic-gate# 1167c478bd9Sstevel@tonic-gate# The LOG_XXX names below are taken from the /usr/include/syslog.h file. 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gateFACILITY= LOG_MAIL # LOG_MAIL is what most sendmail daemons use 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate# The syslog priority at which successful connections are logged. 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gateSEVERITY= LOG_INFO # LOG_INFO is normally not logged to the console 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate###################################################### 1257c478bd9Sstevel@tonic-gate# Optional: Changing the default file protection mask 1267c478bd9Sstevel@tonic-gate# 1277c478bd9Sstevel@tonic-gate# On many systems, network daemons and other system processes are started 1287c478bd9Sstevel@tonic-gate# with a zero umask value, so that world-writable files may be produced. 1297c478bd9Sstevel@tonic-gate# It is a good idea to edit your /etc/rc* files so that they begin with 1307c478bd9Sstevel@tonic-gate# an explicit umask setting. On our site we use `umask 022' because it 1317c478bd9Sstevel@tonic-gate# does not break anything yet gives adequate protection against tampering. 1327c478bd9Sstevel@tonic-gate# 1337c478bd9Sstevel@tonic-gate# The following macro specifies the default umask for processes run under 1347c478bd9Sstevel@tonic-gate# control of the daemon wrappers. Comment it out only if you are certain 1357c478bd9Sstevel@tonic-gate# that inetd and its children are started with a safe umask value. 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gateUMASK = -DDAEMON_UMASK=022 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate####################################### 1407c478bd9Sstevel@tonic-gate# Optional: Turning off access control 1417c478bd9Sstevel@tonic-gate# 1427c478bd9Sstevel@tonic-gate# By default, host access control is enabled. To disable host access 1437c478bd9Sstevel@tonic-gate# control, comment out the following definition. Host access control 1447c478bd9Sstevel@tonic-gate# can also be turned off at runtime by providing no or empty access 1457c478bd9Sstevel@tonic-gate# control tables. 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gateACCESS = -DHOSTS_ACCESS 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate#################################################### 1507c478bd9Sstevel@tonic-gate# Optional: dealing with host name/address conflicts 1517c478bd9Sstevel@tonic-gate# 1527c478bd9Sstevel@tonic-gate# By default, the software tries to protect against hosts that claim to 1537c478bd9Sstevel@tonic-gate# have someone elses host name. This is relevant for network services 1547c478bd9Sstevel@tonic-gate# whose authentication depends on host names, such as rsh and rlogin. 1557c478bd9Sstevel@tonic-gate# 1567c478bd9Sstevel@tonic-gate# With paranoid mode on, connections will be rejected when the host name 1577c478bd9Sstevel@tonic-gate# does not match the host address. Connections will also be rejected when 1587c478bd9Sstevel@tonic-gate# the host name is available but cannot be verified. 1597c478bd9Sstevel@tonic-gate# 1607c478bd9Sstevel@tonic-gate# Comment out the following definition if you want more control over such 1617c478bd9Sstevel@tonic-gate# requests. When paranoid mode is off and a host name double check fails, 1627c478bd9Sstevel@tonic-gate# the client can be matched with the PARANOID access control pattern. 1637c478bd9Sstevel@tonic-gate# 1647c478bd9Sstevel@tonic-gate# Paranoid mode implies hostname lookup. In order to disable hostname 1657c478bd9Sstevel@tonic-gate# lookups altogether, see the next section. 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gatePARANOID= -DPARANOID 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate# The default username lookup timeout is 10 seconds. This may not be long 1707c478bd9Sstevel@tonic-gate# enough for slow hosts or networks, but is enough to irritate PC users. 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gateRFC931_TIMEOUT = 10 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate######################################################## 1757c478bd9Sstevel@tonic-gate# Optional: Changing the access control table pathnames 1767c478bd9Sstevel@tonic-gate# 1777c478bd9Sstevel@tonic-gate# The HOSTS_ALLOW and HOSTS_DENY macros define where the programs will 1787c478bd9Sstevel@tonic-gate# look for access control information. Watch out for the quotes and 1797c478bd9Sstevel@tonic-gate# backslashes when you make changes. 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gateTABLES = -DHOSTS_DENY=\"/etc/hosts.deny\" -DHOSTS_ALLOW=\"/etc/hosts.allow\" 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate############################################# 1847c478bd9Sstevel@tonic-gate# Optional: Turning on host ADDRESS checking 1857c478bd9Sstevel@tonic-gate# 1867c478bd9Sstevel@tonic-gate# Optionally, the software tries to protect against hosts that pretend to 1877c478bd9Sstevel@tonic-gate# have someone elses host address. This is relevant for network services 1887c478bd9Sstevel@tonic-gate# whose authentication depends on host names, such as rsh and rlogin, 1897c478bd9Sstevel@tonic-gate# because the network address is used to look up the remote host name. 1907c478bd9Sstevel@tonic-gate# 1917c478bd9Sstevel@tonic-gate# The protection is to refuse TCP connections with IP source routing 1927c478bd9Sstevel@tonic-gate# options. 1937c478bd9Sstevel@tonic-gate# 1947c478bd9Sstevel@tonic-gate# This feature cannot be used with SunOS 4.x because of a kernel bug in 1957c478bd9Sstevel@tonic-gate# the implementation of the getsockopt() system call. Kernel panics have 1967c478bd9Sstevel@tonic-gate# been observed for SunOS 4.1.[1-3]. Symptoms are "BAD TRAP" and "Data 1977c478bd9Sstevel@tonic-gate# fault" while executing the tcp_ctloutput() kernel function. 1987c478bd9Sstevel@tonic-gate# 1997c478bd9Sstevel@tonic-gate# Reportedly, Sun patch 100804-03 or 101790 fixes this for SunOS 4.1.x. 2007c478bd9Sstevel@tonic-gate# 2017c478bd9Sstevel@tonic-gate# Uncomment the following macro definition if your getsockopt() is OK. 2027c478bd9Sstevel@tonic-gate# 2037c478bd9Sstevel@tonic-gate# -DKILL_IP_OPTIONS is not needed on modern UNIX systems that can stop 2047c478bd9Sstevel@tonic-gate# source-routed traffic in the kernel. Examples: 4.4BSD derivatives, 2057c478bd9Sstevel@tonic-gate# Solaris 2.x, and Linux. See your system documentation for details. 2067c478bd9Sstevel@tonic-gate# 2077c478bd9Sstevel@tonic-gate# KILL_OPT= -DKILL_IP_OPTIONS 2087c478bd9Sstevel@tonic-gate 2097c478bd9Sstevel@tonic-gate## End configuration options 2107c478bd9Sstevel@tonic-gate############################ 211