1.\"	$OpenBSD: Makefile.yp.8,v 1.10 2019/08/30 19:34:04 deraadt Exp $
2.\"
3.\" Copyright (c) 2008 Ingo Schwarze <schwarze@usta.de>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: August 30 2019 $
18.Dt MAKEFILE.YP 8
19.Os
20.Sh NAME
21.Nm Makefile.yp
22.Nd generate and distribute YP maps
23.Sh SYNOPSIS
24.Li cd /var/yp; make
25.Sh DESCRIPTION
26The
27.Nm
28utility generates or updates the YP maps to be served by
29.Xr ypserv 8 .
30.Pp
31Each YP domain to be served must have its own subdirectory below
32.Pa /var/yp .
33Use
34.Xr ypinit 8
35to set up such subdirectories.
36In particular,
37.Xr ypinit 8
38will copy
39.Pa /var/yp/Makefile.yp
40into each new domain subdirectory.
41For common configuration changes affecting all future domains, edit
42.Pa /var/yp/Makefile.yp
43before running
44.Xr ypinit 8 .
45For configuration changes affecting only one individual domain, edit the
46.Pa Makefile
47in the respective domain subdirectory after running
48.Xr ypinit 8 .
49Do
50.Em not
51edit
52.Pa /var/yp/Makefile.yp.dist .
53.Pp
54By default, input data for generating YP maps is collected from the
55.Pa /etc
56directory.
57Edit the
58.Dv DIR
59variable to choose a different source directory.
60.Pp
61To regenerate all maps for all domains, run
62.Xr make 1
63in
64.Pa /var/yp .
65To regenerate all maps for one single domain, run
66.Xr make 1
67in the respective domain subdirectory.
68The
69.Xr makedbm 8
70utility will be used to create the maps in Berkeley DB format,
71and they will be stored inside the appropriate domain subdirectory.
72.Pp
73Whenever a YP map has been updated, it is automatically distributed to all
74slave servers in the respective domain using the
75.Xr yppush 8
76utility.
77To disable automatic distribution, set the
78.Dv NOPUSH
79variable to an arbitrary, non-empty, value.
80.Sh STANDARD YP MAPS
81By default,
82.Nm
83provides the following
84.Xr make 1
85targets:
86.Bl -tag -width protocols
87.It Ic passwd
88Generates the
89.Pa passwd.byname ,
90.Pa passwd.byuid ,
91.Pa master.passwd.byname ,
92and
93.Pa master.passwd.byuid
94maps from
95.Xr master.passwd 5
96for use by
97.Xr getpwent 3 .
98.Pp
99The
100.Pa master.passwd.*\&
101maps always contain complete records in
102.Xr master.passwd 5
103format, including the encrypted passwords.
104.Pp
105The
106.Pa passwd.*\&
107maps follow the reduced
108.Xr passwd 5
109format having the class, change, and expire fields removed but by default
110the encrypted passwords are included too.
111If the
112.Dv UNSECURE
113variable is changed to be empty, the encrypted passwords are replaced by
114asterisks
115.Pq Ql \&* .
116This
117.Dq secure
118mode is compatible with
119.Ox
120and
121.Fx
122clients.
123.Pp
124The
125.Dv MINUID
126and
127.Dv MAXUID
128variables restrict the range of user IDs included into the four passwd maps.
129By default, system users are not included.
130.It Ic netgroup
131Generates the
132.Pa netgroup ,
133.Pa netgroup.byuser ,
134and
135.Pa netgroup.byhost
136maps from
137.Xr netgroup 5
138for use by
139.Xr getnetgrent 3
140and
141.Xr passwd 5 .
142Requires the
143.Xr revnetgroup 8
144utility.
145.It Ic group
146Generates the
147.Pa group.byname
148and
149.Pa group.bygid
150maps from
151.Xr group 5
152for use by
153.Xr getgrent 3 .
154.Pp
155The
156.Dv MINGID
157and
158.Dv MAXGID
159variables restrict the range of group IDs included into both group maps.
160By default, system groups are not included.
161.It Ic netid
162Generates the
163.Pa netid.byname
164map from
165.Xr netid 5 ,
166.Xr passwd 5 ,
167.Xr group 5 ,
168and
169.Xr hosts 5
170for use by
171.Xr getgrouplist 3 .
172Falls back to
173.Xr master.passwd 5
174in case
175.Xr passwd 5
176is not available.
177Requires the
178.Xr mknetid 8
179utility.
180.It Ic hosts
181Generates the
182.Pa hosts.byname
183and
184.Pa hosts.byaddr
185maps from
186.Xr hosts 5
187for use by
188.Xr gethostbyname 3 .
189.Pp
190To get
191.Xr ypserv 8
192to ask DNS for unknown hosts, set the
193.Dv USEDNS
194variable to
195.Fl b .
196.It Ic ethers
197Generates the
198.Pa ethers.byaddr
199and
200.Pa ethers.byname
201maps from
202.Xr ethers 5
203for use by
204.Xr ether_aton 3 .
205.It Ic rpc
206Generates the
207.Pa rpc.bynumber
208map from
209.Xr rpc 5
210for use by
211.Xr getrpcent 3 .
212.It Ic services
213Generates the
214.Pa services.byname
215map from
216.Xr services 5
217for use by
218.Xr getservent 3 .
219.It Ic protocols
220Generates the
221.Pa protocols.byname
222and
223.Pa protocols.bynumber
224maps from
225.Xr protocols 5
226for use by
227.Xr getprotoent 3 .
228.It Ic aliases
229Generates the
230.Pa mail.aliases
231and
232.Pa mail.byaddr
233maps from
234.Xr aliases 5 .
235This target uses both
236.Xr sendmail 8
237with the option
238.Fl bi
239and the
240.Xr mkalias 8
241utility.
242.It Ic amd.home
243Generates the
244.Pa amd.home
245map from the file
246.Pa /etc/amd/amd.home .
247.It Ic all
248Generates all of the above, and sends a hangup signal to
249.Xr ypserv 8
250such that it uses the new maps.
251.El
252.Pp
253In order to keep additional custom YP maps up to date, the
254.Pa Makefile
255should be extended to support additional targets.
256.Sh FILES
257.Bl -tag -width "/var/yp/domainname/ypservers.db" -compact
258.It /var/yp/Makefile
259Top level YP Makefile.
260.It /var/yp/ Ns Ar domainname Ns /Makefile
261Per domain YP maps Makefile.
262.It /var/yp/ Ns Ar domainname Ns /ypservers.db
263Database of hosts serving this domain.
264.It /var/yp/ Ns Ar domainname/mapname Ns .db
265Database files containing the YP maps.
266.It /var/yp/ Ns Ar domainname/target Ns .time
267Cookies controlling the operation of
268.Xr make 1 .
269.El
270.Sh SEE ALSO
271.Xr make 1 ,
272.Xr dbopen 3 ,
273.Xr makedbm 8 ,
274.Xr yp 8 ,
275.Xr ypinit 8 ,
276.Xr yppush 8 ,
277.Xr ypserv 8
278.Sh BUGS
279When
280.Dv NOPUSH
281is set and individual maps are regenerated (as opposed to
282.Ic all ) ,
283the hangup signal to
284.Xr ypserv 8
285must be sent manually, or the new maps won't be used.
286.Pp
287When
288.Dv NOPUSH
289is unset, maps are pushed to the master server on the local host too,
290slowing down
291.Nm .
292