xref: /dragonfly/share/man/man8/yp.8 (revision 0bb9290e)
1.\" Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. The name of the author may not be used to endorse or promote
13.\"    products derived from this software without specific prior written
14.\"    permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
17.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     from: @(#)yp.8	1.0 (deraadt) 4/26/93
29.\" $FreeBSD: src/share/man/man8/yp.8,v 1.30.2.2 2002/09/30 08:19:41 max Exp $
30.\" $DragonFly: src/share/man/man8/yp.8,v 1.5 2006/02/17 19:37:10 swildner Exp $
31.\"
32.Dd April 5, 1993
33.Dt YP 8
34.Os
35.Sh NAME
36.Nm yp
37.Nd description of the YP/NIS system
38.Sh SYNOPSIS
39.Nm
40.Sh DESCRIPTION
41The
42.Nm YP
43subsystem allows network management of passwd, group, netgroup, hosts,
44services, rpc, bootparams and ethers file
45entries through the functions
46.Xr getpwent 3 ,
47.Xr getgrent 3 ,
48.Xr getnetgrent 3 ,
49.Xr gethostent 3 ,
50.Xr getnetent 3 ,
51.Xr getrpcent 3 ,
52and
53.Xr ethers 3 .
54The
55.Xr bootparamd 8
56daemon makes direct
57.Tn NIS
58library calls since there are no
59functions in the standard C library for reading bootparams.
60.Tn NIS
61support for the hosts, services and rpc databases is enabled by
62uncommenting the
63.Dq Li nis
64line in
65.Pa /etc/host.conf .
66.Tn NIS
67support for the remaining services is
68activated by adding a special
69.Ql +
70entry to the appropriate file.
71.Pp
72The
73.Nm YP
74subsystem is started automatically in
75.Pa /etc/rc
76if it has been initialized in
77.Pa /etc/rc.conf
78and if the directory
79.Pa /var/yp
80exists (which it does in the default distribution).
81The default
82.Tn NIS
83domain must also be set with the
84.Xr domainname 1
85command, which will happen automatically at system startup if it is
86specified in
87.Pa /etc/rc.conf .
88.Pp
89.Tn NIS
90is an
91.Tn RPC Ns -based
92client/server system that allows a group of
93machines within an
94.Tn NIS
95domain to share a common set of configuration files.
96This permits a system
97administrator to set up
98.Tn NIS
99client systems with only minimal configuration
100data and add, remove or modify configuration data from a single location.
101.Pp
102The canonical copies of all
103.Tn NIS
104information are stored on a single machine
105called the
106.Tn NIS
107.Em "master server" .
108The databases used to store the information are called
109.Tn NIS
110.Em maps .
111In
112.Dx ,
113these maps are stored in
114.Pa /var/yp/ Ns Aq Ar domainname
115where
116.Aq Ar domainname
117is the name of the
118.Tn NIS
119domain being served.
120A single
121.Tn NIS
122server can
123support several domains at once, therefore it is possible to have several
124such directories, one for each supported domain.
125Each domain will have
126its own independent set of maps.
127.Pp
128In
129.Dx ,
130the
131.Tn NIS
132maps are Berkeley DB hashed database files (the
133same format used for the
134.Xr passwd 5
135database files).
136Other operating systems that support
137.Tn NIS
138use old-style
139.Nm ndbm
140databases instead (largely because Sun Microsystems originally based
141their
142.Tn NIS
143implementation on
144.Nm ndbm ,
145and other vendors have simply licensed
146Sun's code rather than design their own implementation with a different
147database format).
148On these systems, the databases are generally split
149into
150.Pa .dir
151and
152.Pa .pag
153files which the
154.Nm ndbm
155code uses to hold separate parts of the hash
156database.
157The Berkeley DB hash method instead uses a single file for
158both pieces of information.
159This means that while you may have
160.Pa passwd.byname.dir
161and
162.Pa passwd.byname.pag
163files on other operating systems (both of which are really parts of the
164same map),
165.Dx
166will have only one file called
167.Pa passwd.byname .
168The difference in format is not significant: only the
169.Tn NIS
170server,
171.Xr ypserv 8 ,
172and related tools need to know the database format of the
173.Tn NIS
174maps.
175Client
176.Tn NIS
177systems receive all
178.Tn NIS
179data in
180.Tn ASCII
181form.
182.Pp
183There are three main types of
184.Tn NIS
185systems:
186.Bl -enum
187.It
188.Tn NIS
189clients,
190which query
191.Tn NIS
192servers for information.
193.It
194.Tn NIS
195master servers,
196which maintain the canonical copies of all
197.Tn NIS
198maps.
199.It
200.Tn NIS
201slave servers,
202which maintain backup copies of
203.Tn NIS
204maps that are periodically
205updated by the master.
206.El
207.Pp
208A
209.Tn NIS
210client establishes what is called a
211.Em binding
212to a particular
213.Tn NIS
214server using the
215.Xr ypbind 8
216daemon.
217.Xr Ypbind 8
218checks the system's default domain (as set by the
219.Xr domainname 1
220command) and begins broadcasting
221.Tn RPC
222requests on the local network.
223These requests specify the name of the domain for which
224.Xr ypbind 8
225is attempting to establish a binding.
226If a server that has been
227configured to serve the requested domain receives one of the broadcasts,
228it will respond to
229.Xr ypbind 8 ,
230which will record the server's address.
231If there are several servers
232available (a master and several slaves, for example),
233.Xr ypbind 8
234will use the address of the first one to respond.
235From that point
236on, the client system will direct all of its
237.Tn NIS
238requests to that server.
239.Xr Ypbind 8
240will occasionally
241.Dq ping
242the server to make sure it is still up
243and running.
244If it fails to receive a reply to one of its pings
245within a reasonable amount of time,
246.Xr ypbind 8
247will mark the domain as unbound and begin broadcasting again in the
248hopes of locating another server.
249.Pp
250.Tn NIS
251master and slave servers handle all
252.Tn NIS
253requests with the
254.Xr ypserv 8
255daemon.
256.Xr Ypserv 8
257is responsible for receiving incoming requests from
258.Tn NIS
259clients,
260translating the requested domain and map name to a path to the
261corresponding database file and transmitting data from the database
262back to the client.
263There is a specific set of requests that
264.Xr ypserv 8
265is designed to handle, most of which are implemented as functions
266within the standard C library:
267.Bl -tag -width ".Fn yp_master"
268.It Fn yp_order
269check the creation date of a particular map
270.It Fn yp_master
271obtain the name of the
272.Tn NIS
273master server for a given
274map/domain
275.It Fn yp_match
276lookup the data corresponding to a given in key in a particular
277map/domain
278.It Fn yp_first
279obtain the first key/data pair in a particular map/domain
280.It Fn yp_next
281pass
282.Xr ypserv 8
283a key in a particular map/domain and have it return the
284key/data pair immediately following it (the functions
285.Fn yp_first
286and
287.Fn yp_next
288can be used to do a sequential search of an
289.Tn NIS
290map)
291.It Fn yp_all
292retrieve the entire contents of a map
293.El
294.Pp
295There are a few other requests which
296.Xr ypserv 8
297is capable of handling (i.e. acknowledge whether or not you can handle
298a particular domain
299.Pq Dv YPPROC_DOMAIN ,
300or acknowledge only if you can handle the domain and be silent otherwise
301.Pq Dv YPPROC_DOMAIN_NONACK )
302but
303these requests are usually generated only by
304.Xr ypbind 8
305and are not meant to be used by standard utilities.
306.Pp
307On networks with a large number of hosts, it is often a good idea to
308use a master server and several slaves rather than just a single master
309server.
310A slave server provides the exact same information as a master
311server: whenever the maps on the master server are updated, the new
312data should be propagated to the slave systems using the
313.Xr yppush 8
314command.
315The
316.Tn NIS
317.Pa Makefile
318.Pq Pa /var/yp/Makefile
319will do this automatically if the administrator comments out the
320line which says
321.Dq Li NOPUSH=true
322.Va ( NOPUSH
323is set to true by default because the default configuration is
324for a small network with only one
325.Tn NIS
326server).
327The
328.Xr yppush 8
329command will initiate a transaction between the master and slave
330during which the slave will transfer the specified maps from the
331master server using
332.Xr ypxfr 8 .
333(The slave server calls
334.Xr ypxfr 8
335automatically from within
336.Xr ypserv 8 ;
337therefore it is not usually necessary for the administrator
338to use it directly.
339It can be run manually if
340desired, however.)
341Maintaining
342slave servers helps improve
343.Tn NIS
344performance on large
345networks by:
346.Bl -bullet
347.It
348Providing backup services in the event that the
349.Tn NIS
350master crashes
351or becomes unreachable
352.It
353Spreading the client load out over several machines instead of
354causing the master to become overloaded
355.It
356Allowing a single
357.Tn NIS
358domain to extend beyond
359a local network
360.Po
361the
362.Xr ypbind 8
363daemon might not be able to locate a server automatically if it resides on
364a network outside the reach of its broadcasts.
365It is possible to force
366.Xr ypbind 8
367to bind to a particular server with
368.Xr ypset 8
369but this is sometimes inconvenient.
370This problem can be avoided simply by
371placing a slave server on the local network.
372.Pc
373.El
374.Pp
375The
376.Dx
377.Xr ypserv 8
378is specially designed to provided enhanced security
379.Po
380compared to other
381.Tn NIS
382implementations
383.Pc
384when used exclusively with
385.Dx
386and
387.Fx
388client
389systems.
390The
391.Dx
392password database system (which is derived directly
393from
394.Bx 4.4 )
395includes support for
396.Em "shadow passwords" .
397The standard password database does not contain users' encrypted
398passwords: these are instead stored (along with other information)
399in a separate database which is accessible only by the super-user.
400If the encrypted password database were made available as an
401.Tn NIS
402map, this security feature would be totally disabled, since any user
403is allowed to retrieve
404.Tn NIS
405data.
406.Pp
407To help prevent this,
408.Dx Ns 's
409.Tn NIS
410server handles the shadow password maps
411.Pa ( master.passwd.byname
412and
413.Pa master.passwd.byuid )
414in a special way: the server will only provide access to these
415maps in response to requests that originate on privileged ports.
416Since only the super-user is allowed to bind to a privileged port,
417the server assumes that all such requests come from privileged
418users.
419All other requests are denied: requests from non-privileged
420ports will receive only an error code from the server.
421Additionally,
422.Dx Ns 's
423.Xr ypserv 8
424includes support for
425.An Wietse Venema Ns 's
426tcp wrapper package; with tcp
427wrapper support enabled, the administrator can configure
428.Xr ypserv 8
429to respond only to selected client machines.
430.Pp
431While these enhancements provide better security than stock
432.Tn NIS Ns ,
433they are by no means 100% effective.
434It is still possible for
435someone with access to your network to spoof the server into disclosing
436the shadow password maps.
437.Pp
438On the client side,
439.Dx Ns 's
440.Xr getpwent 3
441functions will automatically search for the
442.Pa master.passwd
443maps and use them if they exist.
444If they do, they will be used, and
445all fields in these special maps (class, password age and account
446expiration) will be decoded.
447If they are not found, the standard
448.Pa passwd
449maps will be used instead.
450.Sh COMPATIBILITY
451When using a
452.No non- Ns Dx Ns / Ns Fx
453.Tn NIS
454server for
455.Xr passwd 5
456files, it is unlikely that the default MD5-based format that
457.Dx
458uses for passwords will be accepted by it.
459If this is the case, the value of the
460.Va passwd_format
461setting in
462.Xr login.conf 5
463should be changed to
464.Qq Li des
465for compatibility.
466.Pp
467Some systems, such as
468.Tn SunOS
4694.x, need
470.Tn NIS
471to be running in order
472for their hostname resolution functions
473.Fn ( gethostbyname ,
474.Fn gethostbyaddr ,
475etc.) to work properly.
476On these systems,
477.Xr ypserv 8
478performs
479.Tn DNS
480lookups when asked to return information about
481a host that does not exist in its
482.Pa hosts.byname
483or
484.Pa hosts.byaddr
485maps.
486.Dx Ns 's
487resolver uses
488.Tn DNS
489by default (it can be made to use
490.Tn NIS ,
491if desired), therefore its
492.Tn NIS
493server does not do
494.Tn DNS
495lookups
496by default.
497However,
498.Xr ypserv 8
499can be made to perform
500.Tn DNS
501lookups if it is started with a special
502flag.
503It can also be made to register itself as an
504.Tn NIS
505v1 server
506in order to placate certain systems that insist on the presence of
507a v1 server
508.No ( Dx
509uses only
510.Tn NIS
511v2, but many other systems,
512including
513.Tn SunOS
5144.x, search for both a v1 and v2 server when binding).
515.Dx Ns 's
516.Xr ypserv 8
517does not actually handle
518.Tn NIS
519v1 requests, but this
520.Dq "kludge mode"
521is useful for silencing stubborn systems that search for both
522a v1 and v2 server.
523.Pp
524(Please see the
525.Xr ypserv 8
526manual page for a detailed description of these special features
527and flags.)
528.Sh HISTORY
529The
530.Nm YP
531subsystem was written from the ground up by
532.An Theo de Raadt
533to be compatible to Sun's implementation.
534Bug fixes, improvements
535and
536.Tn NIS
537server support were later added by
538.An Bill Paul .
539The server-side code was originally written by
540.An Peter Eriksson
541and
542.An Tobias Reber
543and is subject to the GNU Public License.
544No Sun code was
545referenced.
546.Sh BUGS
547While
548.Dx
549now has both
550.Tn NIS
551client and server capabilities, it does not yet have support for
552.Xr ypupdated 8
553or the
554.Fn yp_update
555function.
556Both of these require secure
557.Tn RPC ,
558which
559.Dx
560does not
561support yet either.
562.Pp
563The
564.Xr getservent 3
565and
566.Xr getprotoent 3
567functions do not yet have
568.Tn NIS
569support.
570Fortunately, these files
571do not need to be updated that often.
572.Pp
573Many more manual pages should be written, especially
574.Xr ypclnt 3 .
575For the time being, seek out a local Sun machine and read the
576manuals for there.
577.Pp
578Neither Sun nor this author have found a clean way to handle
579the problems that occur when ypbind cannot find its server
580upon bootup.
581