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