2 ####################################
3 ### Beginning of configurable stuff.
5 # By default, logfile entries are written to the same file as used for
6 # sendmail transaction logs. Change the definition of the following macro
7 # if you disagree. See `man 3 syslog' for examples. Some syslog versions
8 # do not provide this flexibility.
12 # To disable tcp-wrapper style access control, comment out the following
13 # macro definitions. Access control can also be turned off by providing
14 # no access control tables. The local system, since it runs the portmap
15 # daemon, is always treated as an authorized host.
16 # By default, access control does not do hostname lookup as there is a risk
17 # that will require portmap access, hence deadlock. If you are sure the
18 # target system will never user NIS for hostname lookup, you can define
19 # USE_DNS to add hostname tests in hosts.allow/deny.
21 #ifeq ($(NO_TCP_WRAPPER),)
22 #CPPFLAGS += -DHOSTS_ACCESS
25 #CPPFLAGS += -DENABLE_DNS
26 #MAN_SED += -e 's/USE_DNS/yes/'
30 # Comment out if your RPC library does not allocate privileged ports for
31 # requests from processes with root privilege, or the new portmap will
32 # always reject requests to register/unregister services on privileged
33 # ports. You can find out by running "rpcinfo -p"; if all mountd and NIS
34 # daemons use a port >= 1024 you should probably disable the next line.
36 CPPFLAGS
+= -DCHECK_PORT
38 # The portmap daemon runs a uid=1/gid=1 by default. You can change that
39 # be defining DAEMON_UID and DAMEON_GID to numbers, or RPCUSER to a
40 # name, though you must be sure that name lookup will not require use
43 CPPFLAGS
+= -DRPCUSER
=\"$(RPCUSER
)\"
44 MAN_SED
+= -e
's/RPCUSER/$(RPCUSER)/'
46 MAN_SED
+= -e
's/RPCUSER//'
49 CPPFLAGS
+= -DDAEMON_UID
=$(DAEMON_UID
) -DDAEMON_GID
=$(DAEMON_GID
)
50 MAN_SED
+= -e
's/DAEMON_UID/$(DAEMON_UID)/' -e
's/DAEMON_GID/$(DAEMON_GID)/'
52 MAN_SED
+= -e
's/DAEMON_UID/1/' -e
's/DAEMON_GID/1/'
55 # Warning: troublesome feature ahead!! Enable only when you are really
58 # It is possible to prevent an attacker from manipulating your portmapper
59 # tables from outside with requests that contain spoofed source addresses.
60 # The countermeasure is to force all rpc servers to register and
61 # unregister with the portmapper via the loopback network interface,
62 # instead of via the primary network interface that every host can talk
63 # to. For this countermeasure to work it is necessary to uncomment the
64 # LOOPBACK definition below, and to take the following additional steps:
66 # (1) Modify the libc library (or librpc if you have one) and replace
67 # get_myaddress() by a version that selects the loopback address instead
68 # of the primary network interface address. A suitable version is
69 # provided in the file get_myaddress.c. This forces rpc servers to send
70 # all set/unset requests to the loopback address.
72 # (2) Rebuild all statically-linked rpc servers with the modified
75 # (3) Disable IP source routing in the kernel (otherwise an outside
76 # attacker can still send requests that appear to come from the local
79 # Instead of (1) it may be sufficient to run the rpc servers with a
80 # preload shared object that implements the alternate get_myaddress()
81 # behavior (see Makefile.shlib). You still need to disable IP source
84 # I warned you, you need to be really desperate to do this. It is
85 # probably much easier to just block port UDP and TCP ports 111 on
88 # CPPFLAGS += -DLOOPBACK_SETUNSET
90 # When the portmapper cannot find any local interfaces (it will complain
91 # to the syslog daemon) your system probably has variable-length socket
92 # address structures (struct sockaddr has a sa_len component; examples:
93 # AIX 4.1 and 4.4BSD). Uncomment next macro definition in that case.
95 # CPPFLAGS += -DHAS_SA_LEN # AIX 4.x, BSD 4.4, FreeBSD, NetBSD
97 # With verbose logging on, HP-UX 9.x and AIX 4.1 leave zombies behind when
98 # SIGCHLD is not ignored. Enable next macro for a fix.
100 CPPFLAGS
+= -DIGNORE_SIGCHLD
# AIX 4.x, HP-UX 9.x
102 # Uncomment the following macro if your system does not have u_long.
104 # CPPFLAGS +=-Du_long="unsigned long"
108 # CFLAGS += -arch m68k -arch i386 -arch hppa
110 # Auxiliary libraries that you may have to specify
114 # Comment out if your compiler talks ANSI and understands const
116 # CPPFLAGS += -Dconst=
118 ### End of configurable stuff.
119 ##############################
121 CPPFLAGS
+= -DFACILITY
=$(FACILITY
)
124 CFLAGS
+= -Wall
-Wstrict-prototypes
126 all: portmap pmap_dump pmap_set portmap.man
128 #CPPFLAGS += $(HOSTS_ACCESS)
129 #portmap: CFLAGS += -fpie
130 #portmap: LDLIBS += $(WRAP_LIB)
131 #portmap: LDFLAGS += -pie
132 portmap
: portmap.o pmap_check.o from_local.o
134 from_local
: CPPFLAGS
+= -DTEST
136 portmap.man
: portmap
.8
137 sed
$(MAN_SED
) < portmap
.8 > portmap.man
140 install -o root
-g root
-m
0755 -s portmap
${BASEDIR}/sbin
141 install -o root
-g root
-m
0755 -s pmap_dump
${BASEDIR}/sbin
142 install -o root
-g root
-m
0755 -s pmap_set
${BASEDIR}/sbin
143 install -o root
-g root
-m
0644 portmap.man
${BASEDIR}/usr
/share
/man
/man8
/portmap
.8
144 install -o root
-g root
-m
0644 pmap_dump
.8 ${BASEDIR}/usr
/share
/man
/man8
145 install -o root
-g root
-m
0644 pmap_set
.8 ${BASEDIR}/usr
/share
/man
/man8
148 rm -f
*.o portmap pmap_dump pmap_set from_local \
153 $(CC
) -MM
$(CFLAGS
) *.c
> .depend
155 .PHONY
: all clean install