1c1d06ca1SGarrett Wollman.\" Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca> 2c1d06ca1SGarrett Wollman.\" All rights reserved. 3c1d06ca1SGarrett Wollman.\" 4c1d06ca1SGarrett Wollman.\" Redistribution and use in source and binary forms, with or without 5c1d06ca1SGarrett Wollman.\" modification, are permitted provided that the following conditions 6c1d06ca1SGarrett Wollman.\" are met: 7c1d06ca1SGarrett Wollman.\" 1. Redistributions of source code must retain the above copyright 8c1d06ca1SGarrett Wollman.\" notice, this list of conditions and the following disclaimer. 9c1d06ca1SGarrett Wollman.\" 2. Redistributions in binary form must reproduce the above copyright 10c1d06ca1SGarrett Wollman.\" notice, this list of conditions and the following disclaimer in the 11c1d06ca1SGarrett Wollman.\" documentation and/or other materials provided with the distribution. 12c1d06ca1SGarrett Wollman.\" 3. The name of the author may not be used to endorse or promote 13c1d06ca1SGarrett Wollman.\" products derived from this software without specific prior written 14c1d06ca1SGarrett Wollman.\" permission. 15c1d06ca1SGarrett Wollman.\" 16c1d06ca1SGarrett Wollman.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 17c1d06ca1SGarrett Wollman.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18c1d06ca1SGarrett Wollman.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19c1d06ca1SGarrett Wollman.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 20c1d06ca1SGarrett Wollman.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21c1d06ca1SGarrett Wollman.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22c1d06ca1SGarrett Wollman.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23c1d06ca1SGarrett Wollman.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24c1d06ca1SGarrett Wollman.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25c1d06ca1SGarrett Wollman.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26c1d06ca1SGarrett Wollman.\" SUCH DAMAGE. 27c1d06ca1SGarrett Wollman.\" 28c1d06ca1SGarrett Wollman.\" from: @(#)yp.8 1.0 (deraadt) 4/26/93 2921421932SMike Pritchard.\" $Id: yp.4,v 1.6 1996/04/08 04:18:09 mpp Exp $ 30c1d06ca1SGarrett Wollman.\" 31c1d06ca1SGarrett Wollman.Dd April 5, 1993 32c1d06ca1SGarrett Wollman.Dt YP 4 33c1d06ca1SGarrett Wollman.Os BSD 4.2 34c1d06ca1SGarrett Wollman.Sh NAME 35c1d06ca1SGarrett Wollman.Nm yp 360c319849SBill Paul.Nd description of the YP/NIS system 37c1d06ca1SGarrett Wollman.Sh SYNOPSIS 38c1d06ca1SGarrett Wollman.Nm yp 39c1d06ca1SGarrett Wollman.Sh DESCRIPTION 40c1d06ca1SGarrett WollmanThe 41c1d06ca1SGarrett Wollman.Nm YP 420c319849SBill Paulsubsystem allows network management of passwd, group, netgroup, hosts, 430c319849SBill Paulservices, rpc, bootparams and ethers file 440c319849SBill Paulentries through the functions 450c319849SBill Paul.Xr getpwent 3 , 460c319849SBill Paul.Xr getgrent 3 , 470c319849SBill Paul.Xr getnetgrent 3 , 480c319849SBill Paul.Xr gethostent 3 , 490c319849SBill Paul.Xr getnetent 3 , 500c319849SBill Paul.Xr getrpcent 3 , 510c319849SBill Pauland 520c319849SBill Paul.Xr ethers 3 . 530c319849SBill PaulThe 54edf0e5b3SMike Pritchard.Xr bootparamd 8 550c319849SBill Pauldaemon makes direct NIS library calls since there are no 560c319849SBill Paulfunctions in the standard C library for reading bootparams. NIS 570c319849SBill Paulsupport for the hosts, services and rpc databases is enabled by 580c319849SBill Pauluncommenting the 590c319849SBill Paul.Pa nis 600c319849SBill Paulline in 610c319849SBill Paul.Pa /etc/host.conf. 620c319849SBill PaulNIS support for the remaining services is 630c319849SBill Paulactivated by adding a special '+' entry to the appropriate file. 640c319849SBill Paul.Pp 65c1d06ca1SGarrett WollmanThe 66c1d06ca1SGarrett Wollman.Nm YP 67c1d06ca1SGarrett Wollmansubsystem is started automatically in 680c319849SBill Paul.Pa /etc/rc 690c319849SBill Paulif it has been initialized in 700c319849SBill Paul.Pa /etc/sysconfig 710c319849SBill Pauland if the directory 72edf0e5b3SMike Pritchard.Pa /var/yp 730c319849SBill Paulexists (which it does in the default distribution). The default 740c319849SBill PaulNIS domain must also be set with the 750c319849SBill Paul.Xr domainname 1 760c319849SBill Paulcommand, which will happen automatically at system startup if it is 770c319849SBill Paulspecified in 780c319849SBill Paul.Pa /etc/sysconfig. 790c319849SBill Paul.Pp 800c319849SBill PaulNIS is an RPC-based client/server system that allows a group of 810c319849SBill Paulmachines within an NIS 820c319849SBill Paul.Nm domain 830c319849SBill Paulto share a common set of configuration files. This permits a system 840c319849SBill Pauladministrator to set up NIS client systems with only minimal configuration 850c319849SBill Pauldata and add, remove or modify configuration data from a single location. 860c319849SBill Paul.Pp 870c319849SBill PaulThe canonical copies of all NIS information are stored on a single machine 880c319849SBill Paulcalled the 890c319849SBill Paul.Pa NIS master server . 900c319849SBill PaulThe databases used to store the information are called 910c319849SBill Paul.Pa NIS maps. 920c319849SBill PaulIn FreeBSD, these maps are stored in 930c319849SBill Paul.Pa /var/yp/[domainname] 940c319849SBill Paulwhere 950c319849SBill Paul.Pa [domainname] 960c319849SBill Paulis the name of the NIS domain being served. A single NIS server can 970c319849SBill Paulsupport several domains at once, therefore it is possible to have several 980c319849SBill Paulsuch directories, one for each supported domain. Each domain will have 990c319849SBill Paulits own independent set of maps. 1000c319849SBill Paul.Pp 1010c319849SBill PaulIn FreeBSD, the NIS maps are Berkeley DB hashed database files (the 1020c319849SBill Paulsame format used for the 1030c319849SBill Paul.Xr passwd 5 1040c319849SBill Pauldatabase files). Other operating systems that support NIS use old-style 1050c319849SBill Paulndbm databases instead (largely because Sun Microsystems originally based 1060c319849SBill Paultheir NIS implementation on ndbm, and other vendors have simply licensed 1070c319849SBill PaulSun's code rather than design their own implementation with a different 1080c319849SBill Pauldatabase format). On these systems, the databases are generally split 1090c319849SBill Paulinto 1100c319849SBill Paul.Nm .dir 111c1d06ca1SGarrett Wollmanand 1120c319849SBill Paul.Nm .pag 1134a8d0283SMike Pritchardfiles which the ndbm code uses to hold separate parts of the hash 1140c319849SBill Pauldatabase. The Berkeley DB hash method instead uses a single file for 1150c319849SBill Paulboth pieces of information. This means that while you may have 1160c319849SBill Paul.Pa passwd.byname.dir 1170c319849SBill Pauland 1180c319849SBill Paul.Pa passwd.byname.pag 1190c319849SBill Paulfiles on other operating systems (both of which are really parts of the 1200c319849SBill Paulsame map), FreeBSD will have only one file called 1210c319849SBill Paul.Pa passwd.byname . 1220c319849SBill PaulThe difference in format is not significant: only the 1230c319849SBill PaulNIS server, 1240c319849SBill Paul.Xr ypserv 8 , 1250c319849SBill Pauland related tools need to know the database format of the NIS maps. Client 1260c319849SBill PaulNIS systems receive all NIS data in ASCII form. 1270c319849SBill Paul.Pp 1280c319849SBill PaulThere are three main types of NIS systems: 1290c319849SBill Paul.Bl -enum -offset indent 1300c319849SBill Paul.It 1310c319849SBill Paul.Pa NIS clients , 1320c319849SBill Paulwhich query NIS servers for information. 1330c319849SBill Paul.It 1340c319849SBill Paul.Pa NIS master servers , 1350c319849SBill Paulwhich maintain the canonical copies of all NIS maps. 1360c319849SBill Paul.It 1370c319849SBill Paul.Pa NIS slave servers , 1380c319849SBill Paulwhich maintain backup copies of NIS maps that are periodically 1390c319849SBill Paulupdated by the master. 1400c319849SBill Paul.El 1410c319849SBill Paul.Pp 1420c319849SBill PaulAn NIS client establishes what is called a 143edf0e5b3SMike Pritchard.Em binding 1440c319849SBill Paulto a particular NIS server using the 1450c319849SBill Paul.Xr ypbind 8 1460c319849SBill Pauldaemon. 1470c319849SBill Paul.Xr Ypbind 8 1480c319849SBill Paulchecks the system's default domain (as set by the 1490c319849SBill Paul.Xr domainname 1 1500c319849SBill Paulcommand) and begins broadcasting RPC requests on the local network. 1510c319849SBill PaulThese requests specify the name of the domain for which 1520c319849SBill Paul.Xr ypbind 8 1530c319849SBill Paulis attempting to establish a binding. If a server that has been 1540c319849SBill Paulconfigured to serve the requested domain receives one of the broadcasts, 1550c319849SBill Paulit will respond to 1560c319849SBill Paul.Xr ypbind 8 , 1570c319849SBill Paulwhich will record the server's address. If there are several servers 1580c319849SBill Paulavailable (a master and several slaves, for example), 1590c319849SBill Paul.Xr ypbind 8 1600c319849SBill Paulwill use the address of the first one to respond. From that point 1610c319849SBill Paulon, the client system will direct all of its NIS requests to that server. 1620c319849SBill Paul.Xr Ypbind 8 1630c319849SBill Paulwill occasionally ``ping'' the server to make sure it's still up 1640c319849SBill Pauland running. If it fails to receive a reply to one of its pings 1654a8d0283SMike Pritchardwithin a reasonable amount of time, 1660c319849SBill Paul.Xr ypbind 8 1670c319849SBill Paulwill mark the domain as unbound and begin broadcasting again in the 1680c319849SBill Paulhopes of locating another server. 1690c319849SBill Paul.Pp 1700c319849SBill PaulNIS master and slave servers handle all NIS requests with the 1710c319849SBill Paul.Xr ypserv 8 1720c319849SBill Pauldaemon. 1730c319849SBill Paul.Xr Ypserv 8 1740c319849SBill Paulis responsible for receiving incoming requests from NIS clients, 1750c319849SBill Paultranslating the requested domain and map name to a path to the 1760c319849SBill Paulcorresponding database file and transmitting data from the database 1770c319849SBill Paulback to the client. There is a specific set of requests that 1780c319849SBill Paul.Xr ypserv 8 1790c319849SBill Paulis designed to handle, most of which are implemented as functions 1800c319849SBill Paulwithin the standard C library: 1810c319849SBill Paul.Bl -bullet -offset indent 1820c319849SBill Paul.It 183edf0e5b3SMike Pritchard.Fn yp_order 1840c319849SBill Paul-- check the creation date of a particular map 1850c319849SBill Paul.It 186edf0e5b3SMike Pritchard.Fn yp_master 1870c319849SBill Paul-- obtain the name of the NIS master server for a given 1880c319849SBill Paulmap/domain 1890c319849SBill Paul.It 190edf0e5b3SMike Pritchard.Fn yp_match 1910c319849SBill Paul-- lookup the data corresponding to a given in key in a particular 1920c319849SBill Paulmap/domain 1930c319849SBill Paul.It 194edf0e5b3SMike Pritchard.Fn yp_first 1950c319849SBill Paul-- obtain the first key/data pair in a particular map/domain 1960c319849SBill Paul.It 197edf0e5b3SMike Pritchard.Fn yp_next 1980c319849SBill Paul-- pass 1990c319849SBill Paul.Xr ypserv 8 2000c319849SBill Paula key in a particular map/domain and have it return the 201edf0e5b3SMike Pritchardkey/data pair immediately following it (the functions 202edf0e5b3SMike Pritchard.Fn yp_first 203edf0e5b3SMike Pritchardand 204edf0e5b3SMike Pritchard.Fn yp_next 2050c319849SBill Paulcan be used to do a sequential search of an NIS map) 2060c319849SBill Paul.It 207edf0e5b3SMike Pritchard.Fn yp_all 2084a8d0283SMike Pritchard-- retrieve the entire contents of a map 2090c319849SBill Paul.El 2100c319849SBill Paul.Pp 2110c319849SBill PaulThere are a few other requests which 212edf0e5b3SMike Pritchard.Xr ypserv 8 2130c319849SBill Paulis capable of handling (i.e. acknowledge whether or not you can handle 2140c319849SBill Paula particular domain (YPPROC_DOMAIN), or acknowledge only if you can 2150c319849SBill Paulhandle the domain and be silent otherwise (YPPROC_DOMAIN_NONACK)) but 2160c319849SBill Paulthese requests are usually generated only by 217edf0e5b3SMike Pritchard.Xr ypbind 8 2180c319849SBill Pauland are not meant to be used by standard utilities. 2190c319849SBill Paul.Pp 2200c319849SBill PaulOn networks with a large number of hosts, it is often a good idea to 2210c319849SBill Pauluse a master server and several slaves rather than just a single master 2220c319849SBill Paulserver. A slave server provides the exact same information as a master 2230c319849SBill Paulserver: whenever the maps on the master server are updated, the new 2240c319849SBill Pauldata should be propagated to the slave systems using the 2250c319849SBill Paul.Xr yppush 8 2260c319849SBill Paulcommand. The NIS Makefile ( 2270c319849SBill Paul.Pa /var/yp/Makefile ) 2280c319849SBill Paulwill do this automatically if the administrator comments out the 2290c319849SBill Paulline which says 2300c319849SBill Paul.Nm NOPUSH=true 2310c319849SBill Paul(NOPUSH is set to true by default because the default configuration is 2320c319849SBill Paulfor a small network with only one NIS server). The 2330c319849SBill Paul.Xr yppush 8 2340c319849SBill Paulcommand will initiate a transaction between the master and slave 2350c319849SBill Paulduring which the slave will transfer the specified maps from the 2360c319849SBill Paulmaster server using 2370c319849SBill Paul.Xr ypxfr 8 . 2380c319849SBill Paul(The slave server calls 2390c319849SBill Paul.Xr ypxfr 8 2400c319849SBill Paulautomatically from within 2410c319849SBill Paul.Xr ypserv 8 ; 2420c319849SBill Paultherefore it is not usually necessary for the administrator 2430c319849SBill Paulto use it directly. It can be run manually if 2440c319849SBill Pauldesired, however.) Maintaining 2450c319849SBill Paulslave servers helps improve NIS performance on large 2460c319849SBill Paulnetworks by: 2470c319849SBill Paul.Pp 2480c319849SBill Paul.Bl -bullet -offset indent 2490c319849SBill Paul.It 2500c319849SBill PaulProviding backup services in the event that the NIS master crashes 2514a8d0283SMike Pritchardor becomes unreachable 2520c319849SBill Paul.It 2530c319849SBill PaulSpreading the client load out over several machines instead of 2540c319849SBill Paulcausing the master to become overloaded 2550c319849SBill Paul.It 2560c319849SBill PaulAllowing a single NIS domain to extend beyond 2570c319849SBill Paula local network (the 2580c319849SBill Paul.Xr ypbind 8 2590c319849SBill Pauldaemon might not be able to locate a server automatically if it resides on 2600c319849SBill Paula network outside the reach of its broadcasts. It is possible to force 2610c319849SBill Paul.Xr ypbind 8 2620c319849SBill Paulto bind to a particular server with 2630c319849SBill Paul.Xr ypset 8 2640c319849SBill Paulbut this is sometimes inconvenient. This problem can be avoided simply by 2650c319849SBill Paulplacing a slave server on the local network.) 2660c319849SBill Paul.El 2670c319849SBill Paul.Pp 2680c319849SBill PaulThe FreeBSD 2690c319849SBill Paul.Xr ypserv 8 2700c319849SBill Paulis specially designed to provided enhanced security (compared to 2710c319849SBill Paulother NIS implementations) when used exclusively with FreeBSD client 2720c319849SBill Paulsystems. The FreeBSD password database system (which is derived directly 27321421932SMike Pritchardfrom 27421421932SMike Pritchard.Bx 4.4 ) 27521421932SMike Pritchardincludes support for 276edf0e5b3SMike Pritchard.Em "shadow passwords" . 2774a8d0283SMike PritchardThe standard password database does not contain users' encrypted 2780c319849SBill Paulpasswords: these are instead stored (along with other information) 2794a8d0283SMike Pritchardis a separate database which is accessible only by the super-user. 2800c319849SBill PaulIf the encrypted password database were made available as an NIS 2810c319849SBill Paulmap, this security feature would be totally disabled, since any user 2820c319849SBill Paulis allowed to retrieve NIS data. 2830c319849SBill Paul.Pp 2840c319849SBill PaulTo help prevent this, FreeBSD's NIS server 2850c319849SBill Paulhandles the shadow password maps ( 2860c319849SBill Paul.Pa master.passwd.byname 2870c319849SBill Pauland 2880c319849SBill Paul.Pa master.passwd.byuid ) 2890c319849SBill Paulin a special way: the server will only provide access to these 2900c319849SBill Paulmaps in response to requests that originate on privileged ports. 2910c319849SBill PaulSince only the super-user is allowed to bind to a privileged port, 2920c319849SBill Paulthe server assumes that all such requests come from privileged 2930c319849SBill Paulusers. All other requests are denied: requests from non-privileged 2940c319849SBill Paulports will receive only an error code from the server. Additionally, 2950c319849SBill PaulFreeBSD's 2960c319849SBill Paul.Xr ypserv 8 2970c319849SBill Paulincludes support for Wietse Venema's tcp wrapper package; with tcp 2980c319849SBill Paulwrapper support enabled, the administrator can configure 2990c319849SBill Paul.Xr ypserv 8 3000c319849SBill Paulto respond only to selected client machines. 3010c319849SBill Paul.Pp 3020c319849SBill PaulWhile these enhancements provide better security than stock NIS, 3030c319849SBill Paulthey are by no means 100% effective. It is still possible for 3040c319849SBill Paulsomeone with access to your network to spoof the server into disclosing 3050c319849SBill Paulthe shadow password maps. 3060c319849SBill Paul.Pp 3070c319849SBill PaulOn the client side, FreeBSD's 3080c319849SBill Paul.Fn getpwent 3 3090c319849SBill Paulfunctions will automatically search for the 3100c319849SBill Paul.Pa master.passwd 3110c319849SBill Paulmaps and use them if they exist. If they do, they will be used, and 3120c319849SBill Paulall fields in these special maps (class, password age and account 3130c319849SBill Paulexpiration) will be decoded. If they aren't found, the standard 3140c319849SBill Paul.Pa passwd 3150c319849SBill Paulmaps will be used instead. 3160c319849SBill Paul.Sh COMPATIBILITY 3170c319849SBill PaulSome systems, such as SunOS 4.x, need NIS to be running in order 3180c319849SBill Paulfor their hostname resolution functions ( 3190c319849SBill Paul.Fn gethostbyname , 3200c319849SBill Paul.Fn gethostbyaddr , 3210c319849SBill Pauletc) to work properly. On these systems, 3220c319849SBill Paul.Xr ypserv 8 3230c319849SBill Paulperforms DNS lookups when asked to return information about 3240c319849SBill Paula host that doesn't exist in its 3250c319849SBill Paul.Pa hosts.byname 3260c319849SBill Paulor 3270c319849SBill Paul.Pa hosts.byaddr 3280c319849SBill Paulmaps. FreeBSD's resolver uses DNS by default (it can be made to use 3290c319849SBill PaulNIS, if desired), therefore its NIS server doesn't do DNS lookups 3300c319849SBill Paulby default. However, 3310c319849SBill Paul.Xr ypserv 8 3320c319849SBill Paulcan be made to perform DNS lookups if it is started with a special 3330c319849SBill Paulflag. It can also be made to register itself as an NIS v1 server 3340c319849SBill Paulin order to placate certain systems that insist on the presence of 3350c319849SBill Paula v1 server (FreeBSD uses only NIS v2, but many other systems, 3360c319849SBill Paulincluding SunOS 4.x, search for both a v1 and v2 server when binding). 3370c319849SBill PaulFreeBSD's 3380c319849SBill Paul.Xr ypserv 8 3390c319849SBill Pauldoes not actually handle NIS v1 requests, but this ``kludge mode'' 3400c319849SBill Paulis useful for silencing stubborn systems that search for both 3410c319849SBill Paula v1 and v2 server. 3420c319849SBill Paul.Pp 3430c319849SBill Paul(Please see the 3440c319849SBill Paul.Xr ypserv 8 3450c319849SBill Paulmanual page for a detailed description of these special features 3460c319849SBill Pauland flags.) 3470c319849SBill Paul.Sh BUGS 3480c319849SBill PaulWhile FreeBSD now has both NIS client and server capabilities, 3490c319849SBill Paulit does not yet have support for 3500c319849SBill Paul.Nm ypupdated 3510c319849SBill Paulor the 3520c319849SBill Paul.Fn yp_update 3530c319849SBill Paulfunction. Both of these require secure RPC, which FreeBSD doesn't 3540c319849SBill Paulsupport yet either. 3550c319849SBill Paul.Pp 3560c319849SBill PaulThe 3570c319849SBill Paul.Xr getservent 3 3580c319849SBill Pauland 3590c319849SBill Paul.Xr getprotoent 3 3600c319849SBill Paulfunctions do not yet have NIS support. Fortunately, these files 3610c319849SBill Pauldon't need to be updated that often. 3620c319849SBill Paul.Pp 363edf0e5b3SMike PritchardMany more manual pages should be written, especially 364edf0e5b3SMike Pritchard.Xr ypclnt 3 . 365c1d06ca1SGarrett WollmanFor the time being, seek out a local Sun machine and read the 366c1d06ca1SGarrett Wollmanmanuals for there. 3670c319849SBill Paul.Pp 3680c319849SBill PaulFreeBSD's server-side support is based on GPL'ed code originally 3690c319849SBill Paulwritten for Linux. It really needs its own implementation that is not 3700c319849SBill Paulsubject to the GPL. 3710c319849SBill Paul.Pp 372c1d06ca1SGarrett WollmanNeither Sun nor this author have found a clean way to handle 373c1d06ca1SGarrett Wollmanthe problems that occur when ypbind cannot find its server 374c1d06ca1SGarrett Wollmanupon bootup. 375c1d06ca1SGarrett Wollman.Sh HISTORY 376c1d06ca1SGarrett WollmanThe 377c1d06ca1SGarrett Wollman.Nm YP 378c1d06ca1SGarrett Wollmansubsystem was written from the ground up by Theo de Raadt 3794a8d0283SMike Pritchardto be compatible to Sun's implementation. Bug fixes, improvements 3800c319849SBill Pauland NIS server support were later added by Bill Paul. The server-side 3810c319849SBill Paulcode was originally written by Peter Eriksson and Tobias Reber and 3820c319849SBill Paulis subject to the GNU Public License. No Sun code was 383c1d06ca1SGarrett Wollmanreferenced. 384