1.\"	$OpenBSD: Makefile.yp.8,v 1.6 2010/01/20 23:20:28 schwarze 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: January 20 2010 $
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
71.Xr db 3
72format, and they will be stored inside the appropriate domain subdirectory.
73.Pp
74Whenever a YP map has been updated, it is automatically distributed to all
75slave servers in the respective domain using the
76.Xr yppush 8
77utility.
78To disable automatic distribution, set the
79.Dv NOPUSH
80variable to an arbitrary, non-empty, value.
81.Sh STANDARD YP MAPS
82By default,
83.Nm
84provides the following
85.Xr make 1
86targets:
87.Bl -tag -width protocols
88.It Ic passwd
89Generates the
90.Pa passwd.byname ,
91.Pa passwd.byuid ,
92.Pa master.passwd.byname ,
93and
94.Pa master.passwd.byuid
95maps from
96.Xr master.passwd 5
97for use by
98.Xr getpwent 3 .
99.Pp
100The
101.Pa master.passwd.*\&
102maps always contain complete records in
103.Xr master.passwd 5
104format, including the encrypted passwords.
105.Pp
106The
107.Pa passwd.*\&
108maps follow the reduced
109.Xr passwd 5
110format having the class, change, and expire fields removed but by default
111the encrypted passwords are included too.
112If the
113.Dv UNSECURE
114variable is changed to be empty, the encrypted passwords are replaced by
115asterisks
116.Pq Ql \&* .
117This
118.Dq secure
119mode is compatible with
120.Ox
121and
122.Fx
123clients.
124.Pp
125The
126.Dv MINUID
127and
128.Dv MAXUID
129variables restrict the range of user IDs included into the four passwd maps.
130By default, system users are not included.
131.It Ic netgroup
132Generates the
133.Pa netgroup ,
134.Pa netgroup.byuser ,
135and
136.Pa netgroup.byhost
137maps from
138.Xr netgroup 5
139for use by
140.Xr getnetgrent 3
141and
142.Xr passwd 5 .
143Requires the
144.Xr revnetgroup 8
145utility.
146.It Ic group
147Generates the
148.Pa group.byname
149and
150.Pa group.bygid
151maps from
152.Xr group 5
153for use by
154.Xr getgrent 3 .
155.Pp
156The
157.Dv MINGID
158and
159.Dv MAXGID
160variables restrict the range of group IDs included into both group maps.
161By default, system groups are not included.
162.It Ic netid
163Generates the
164.Pa netid.byname
165map from
166.Xr netid 5 ,
167.Xr passwd 5 ,
168.Xr group 5 ,
169and
170.Xr hosts 5
171for use by
172.Xr getgrouplist 3 .
173Falls back to
174.Xr master.passwd 5
175in case
176.Xr passwd 5
177is not available.
178Requires the
179.Xr mknetid 8
180utility.
181.It Ic hosts
182Generates the
183.Pa hosts.byname
184and
185.Pa hosts.byaddr
186maps from
187.Xr hosts 5
188for use by
189.Xr gethostbyname 3 .
190Requires the
191.Xr stdhosts 8
192utility.
193.Pp
194To get
195.Xr ypserv 8
196to ask DNS for unknown hosts, set the
197.Dv USEDNS
198variable to
199.Fl b .
200.It Ic ethers
201Generates the
202.Pa ethers.byaddr
203and
204.Pa ethers.byname
205maps from
206.Xr ethers 5
207for use by
208.Xr ethers 3 .
209Requires the
210.Xr stdethers 8
211utility.
212.It Ic networks
213Generates the
214.Pa networks.byname
215and
216.Pa networks.byaddr
217maps from
218.Xr networks 5
219for use by
220.Xr getnetent 3 .
221.It Ic rpc
222Generates the
223.Pa rpc.bynumber
224map from
225.Xr rpc 5
226for use by
227.Xr getrpcent 3 .
228.It Ic services
229Generates the
230.Pa services.byname
231map from
232.Xr services 5
233for use by
234.Xr getservent 3 .
235.It Ic protocols
236Generates the
237.Pa protocols.byname
238and
239.Pa protocols.bynumber
240maps from
241.Xr protocols 5
242for use by
243.Xr getprotoent 3 .
244.It Ic aliases
245Generates the
246.Pa mail.aliases
247and
248.Pa mail.byaddr
249maps from
250.Xr aliases 5 .
251This target uses both
252.Xr sendmail 8
253with the option
254.Fl bi
255and the
256.Xr mkalias 8
257utility.
258.It Ic amd.home
259Generates the
260.Pa amd.home
261map from the file
262.Pa /etc/amd/amd.home .
263.It Ic all
264Generates all of the above, and sends a hangup signal to
265.Xr ypserv 8
266such that it uses the new maps.
267.El
268.Pp
269In order to keep additional custom YP maps up to date, the
270.Pa Makefile
271should be extended to support additional targets.
272.Sh FILES
273.Bl -tag -width "/var/yp/domainname/ypservers.db" -compact
274.It /var/yp/Makefile
275Top level YP Makefile.
276.It /var/yp/ Ns Ar domainname Ns /Makefile
277Per domain YP maps Makefile.
278.It /var/yp/ Ns Ar domainname Ns /ypservers.db
279Database of hosts serving this domain.
280.It /var/yp/ Ns Ar domainname/mapname Ns .db
281Database files containing the YP maps.
282.It /var/yp/ Ns Ar domainname/target Ns .time
283Cookies controlling the operation of
284.Xr make 1 .
285.El
286.Sh SEE ALSO
287.Xr make 1 ,
288.Xr db 3 ,
289.Xr makedbm 8 ,
290.Xr yp 8 ,
291.Xr ypinit 8 ,
292.Xr yppush 8 ,
293.Xr ypserv 8
294.Sh BUGS
295When
296.Dv NOPUSH
297is set and individual maps are regenerated (as opposed to
298.Ic all ) ,
299the hangup signal to
300.Xr ypserv 8
301must be sent manually, or the new maps won't be used.
302.Pp
303When
304.Dv NOPUSH
305is unset, maps are pushed to the master server on the local host too,
306slowing down
307.Nm .
308