xref: /illumos-gate/usr/src/cmd/tcpd/Makefile (revision d17be682)
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#
75661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
87c478bd9Sstevel@tonic-gate
9ead9bb4bSYuri PankovPROG=		safe_finger tcpd tcpdchk tcpdmatch try-from
107c478bd9Sstevel@tonic-gate
11ead9bb4bSYuri Pankovinclude		../Makefile.cmd
127c478bd9Sstevel@tonic-gate
137014882cSRichard LoweCFLAGS +=	$(CCVERBOSE)
147c478bd9Sstevel@tonic-gateCPPFLAGS +=	$(ACCESS) $(PARANOID) $(NETGROUP) $(TLI) \
157c478bd9Sstevel@tonic-gate		$(UMASK) $(STYLE) $(TABLES) $(KILL_OPT) $(BUGS) \
167c478bd9Sstevel@tonic-gate		-DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
177c478bd9Sstevel@tonic-gate		-DFACILITY=$(FACILITY) -DSEVERITY=$(SEVERITY) \
187c478bd9Sstevel@tonic-gate		-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \
19f998c95eSceastha		-I../../lib/libwrap
207c478bd9Sstevel@tonic-gatetcpd tcpdmatch try-from := \
21ead9bb4bSYuri Pankov		LDLIBS += -lwrap
22ead9bb4bSYuri Pankovtcpdchk :=	LDLIBS += -lwrap -lnsl
237c478bd9Sstevel@tonic-gate
247014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-unused-variable
257014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
26d3b5f563SJohn LevonCERRWARN +=	$(CNOWARN_UNINIT)
277014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-implicit-function-declaration
287014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-return-type
297014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-clobbered
307014882cSRichard Lowe
315661bb76SJohn Levon# not linted
325661bb76SJohn LevonSMATCH=off
335661bb76SJohn Levon
3424da5b34Srie# Various components must export interfaces, but also contain name-space
3524da5b34Srie# clashes with system libraries.
36ead9bb4bSYuri PankovMAPFILE.INT.D=	$(MAPFILE.NGB) mapfile-intf-tcpdchk
37ead9bb4bSYuri PankovMAPFILE.INT.M=	$(MAPFILE.NGB) mapfile-intf-tcpdmatch
38ead9bb4bSYuri PankovMAPFILE.INT.F=	$(MAPFILE.NGB) mapfile-intf-tryfrom
3924da5b34Srie
40*85f4cb87SRichard Lowetcpdchk :=	LDFLAGS +=$(MAPFILE.INT.D:%=-Wl,-M%)
41*85f4cb87SRichard Lowetcpdmatch :=	LDFLAGS +=$(MAPFILE.INT.M:%=-Wl,-M%)
42*85f4cb87SRichard Lowetry-from :=	LDFLAGS +=$(MAPFILE.INT.F:%=-Wl,-M%)
4324da5b34Srie
447c478bd9Sstevel@tonic-gate.KEEP_STATE:
457c478bd9Sstevel@tonic-gate
46ead9bb4bSYuri Pankovall:		$(PROG)
477c478bd9Sstevel@tonic-gate
48ead9bb4bSYuri Pankovinstall:	all $(ROOTUSRSBINPROG)
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gateclean:
51ead9bb4bSYuri Pankov		$(RM) *.o
52ead9bb4bSYuri Pankov
53ead9bb4bSYuri PankovTCPDMATCH_OBJ=	tcpdmatch.o fakelog.o inetcf.o scaffold.o
54ead9bb4bSYuri Pankov
55ead9bb4bSYuri Pankovtcpdmatch:	$(TCPDMATCH_OBJ) $(LIB) $(MAPFILE.INTF.M)
56ead9bb4bSYuri Pankov		$(LINK.c) -o $@ $(TCPDMATCH_OBJ) $(LDLIBS)
57ead9bb4bSYuri Pankov		$(POST_PROCESS)
58ead9bb4bSYuri Pankov
59ead9bb4bSYuri Pankovtry-from:	try-from.o fakelog.o $(LIB) $(MAPFILE.INTF.F)
60ead9bb4bSYuri Pankov		$(LINK.c) -o $@ try-from.o fakelog.o $(LDLIBS)
61ead9bb4bSYuri Pankov		$(POST_PROCESS)
62ead9bb4bSYuri Pankov
63ead9bb4bSYuri PankovTCPDCHK_OBJ=	tcpdchk.o fakelog.o inetcf.o scaffold.o
64ead9bb4bSYuri Pankov
65ead9bb4bSYuri Pankovtcpdchk:	$(TCPDCHK_OBJ) $(LIB) $(MAPFILE.INTF.C)
66ead9bb4bSYuri Pankov		$(LINK.c) -o $@ $(TCPDCHK_OBJ) $(LDLIBS)
67ead9bb4bSYuri Pankov		$(POST_PROCESS)
68ead9bb4bSYuri Pankov
69ead9bb4bSYuri Pankovinclude		../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).
94*85f4cb87SRichard Lowe#
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.
104*85f4cb87SRichard Lowe#
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.
108*85f4cb87SRichard Lowe#
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.
132*85f4cb87SRichard Lowe#
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.
190*85f4cb87SRichard Lowe#
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