freebsd-dev/usr.sbin/ypbind/ypbind.8
Bill Paul b2845e83db This commit adds support to ypbind(8) for binding to non-local servers.
The standard SunOS ypbind(8) (and, until now, the FreeBSD ypbind)
only selects servers based on whether or not they respond to clnt_broadcast().
Ypbind(8) broadcasts to the YPPROC_DOMAIN_NONACK procedure and waits
for answers; whichever server answers first is the one ypbind uses
for the local client binding.

This mechanism fails when binding across subnets is desired. In order
for a client on one subnet to bind to a server on another subnet, the
gateway(s) between the client and server must be configured to forward
broadcasts. If this is not possible, then a slave server must be
installed on the remote subnet. If this is also not possible, you
have to force the client to bind to the remote server with ypset(8).

Unfortunately, this last option is less than ideal. If the remote
server becomes unavailable, ypbind(8) will lose its binding and
revert to its broadcast-based search behavior. Even if there are
other servers available, or even if the original server comes back
up, ypbind(8) will not be able to create a new binding since all
the servers are on remote subnets where its broadcasts won't be heard.
If the administrator isn't around to run ypset(8) again, the system
is hosed.

In some Linux NIS implementations, there exists a yp.conf file where
you can explicitly specify a server address and avoid the use of
ypbind altogether. This is not desireable since it removes the
possibility of binding to an alternate server in the event that the
one specified in yp.conf crashes.

Some people have mentioned to me how they though the 'restricted mode'
operation (using the -S flag) could be used as a solution for this
problem since it allows one to specify a list of servers. In fact,
this is not the case: the -S flag just tells ypbind(8) that when it
listens for replies to its broadcasts, it should only honor them if
the replying hosts appear in the specified restricted list.

This behavior has now been changed. If you use the -m flag in conjunction
with the -S flag, ypbind(8) will use a 'many-cast' instead of a broadcast
for choosing a server. In many-cast mode, ypbind(8) will transmit directly
to the YPPROC_DOMAIN_NONACK procedure of all the servers specified in
the restricted mode list and then wait for a reply. As with the broadcast
method, whichever server from the list answers first is used for the
local binding. All other behavior is the same: ypbind(8) continues
to ping its bound server every 60 seconds to insure it's still alive
and will many-cast again if the server fails to respond. The code used
to achieve this is in yp_ping.c; it includes a couple of modified RPC
library routines.

Note that it is not possible to use this mechanism without using
the restricted list since we need to know the addresses of the available
NIS servers ahead of time in order to transmit to them.

Most-recently-requested by: Tom Samplonius
1997-05-25 19:49:33 +00:00

185 lines
6.4 KiB
Groff

.\" Copyright (c) 1991, 1993, 1995
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: ypbind.8,v 1.9 1997/04/15 07:15:47 jmg Exp $
.\"
.Dd April 9, 1995
.Dt YPBIND 8
.Os
.Sh NAME
.Nm ypbind
.Nd "NIS domain binding daemon"
.Sh SYNOPSIS
.Nm
.Op Fl ypset
.Op Fl ypsetme
.Op Fl s
.Op Fl m
.Op Fl S Ar domainname,server1,server2,...
.Sh DESCRIPTION
.Nm
is the process that maintains NIS binding information. At startup,
it searches for an NIS server responsible for serving the system's
default domain (as set by the
.Xr domainname 1
command) using network broadcasts.
Once it receives a reply,
it will store the address of the server and other
information in a special file located in
.Pa /var/yp/binding .
The NIS routines in the standard C library can then use this file
when processing NIS requests. There may be several such files
since it is possible for an NIS client to be bound to more than
one domain.
.Pp
After a binding has been established,
.Nm
will send DOMAIN_NONACK requests to the NIS server at one minute
intervals. If it fails to receive a reply to one of these requests,
.Nm
assumes that the server is no longer running and resumes its network
broadcasts until another binding is established.
.Nm
will also log warning messages using the
.Xr syslog 3
facility each time it detects that a server has stopped responding,
as well as when it has bound to a new server.
.Pp
.Sh OPTIONS
The following options are supported by
.Nm Ns :
.Bl -tag -width flag
.It Fl ypset
It is possible to force
.Nm
to bind to a particular NIS server host for a given domain by using the
.Xr ypset 8
command. However,
.Nm
refuses YPBINDPROC_SETDOM requests by default since it has no way of
knowing exactly who is sending them. Using the
.Fl ypset
flag causes
.Nm
to accept YPBINDPROC_SETDOM requests from any host. This option should only
be used for diagnostic purposes and only for limited periods since allowing
arbitrary users to reset the binding of an NIS client poses a severe
security risk.
.It Fl ypsetme
This is similar to the
.Fl ypset
flag, except that it only permits YPBINDPROC_SETDOM requests to be processed
if they originated from the local host.
.It Fl s
The
.Fl s
flag causes
.Nm
to run in secure mode: it will refuse to bind to any NIS server
that is not running as root (i.e. that is not using privileged
TCP ports).
.It Fl S Ar domainname,server1,server2,server3,...
The
.Fl S
flag allows the system administrator to lock ypbind to a particular
domain and group of NIS servers. Up to ten servers can be specified.
There must not be any spaces between the commas in the domain/server
specification. This option is used to insure that the system binds
only to one domain and only to one of the specified servers, which
is useful for systems that are both NIS servers and NIS
clients: it provides a way to restrict what machines the system can
bind to without the need for specifying the
.Fl ypset
or
.Fl ypsetme
options, which are often considered to be security holes. The specified
servers must have valid entries in the local
.Pa /etc/hosts
file. IP addresses may be specified in place of hostnames. If
.Nm
can't make sense ouf of the arguments, it will ignore
the
.Fl S
flag and continue running normally.
.Pp
Note that
.Nm
will consider the domainname specified with the
.Fl S
flag to be the system default domain.
.It Fl m
The
.Fl m
flag can only be used in conjunction with the
.Fl S
flag above (if used without the
.Fl S
flag, it has no effect). It causes
.Nm ypbind
to use a 'many-cast' rather than a broadcast for choosing a server
from the restricted mode server list. In many-cast mode,
.Nm ypbind
will transmit directly to the YPPROC_DOMAIN_NONACK procedure of the
servers specified in the restricted list and bind to the server that
responds the fastest.
This mode of operation is useful for NIS clients on remote subnets
where no local NIS servers are available.
.El
.Sh NOTES
The
.Nm
program will not make continuous attempts to keep secondary domains bound.
If a server for a secondary domain fails to respond to a ping,
.Nm
will broadcast for a new server only once before giving up. If a
client program attempts to reference the unbound domain,
.Nm
will try broadcasting again. By contrast,
.Nm
will automatically maintain a binding for the default domain whether
client programs reference it ot not.
.Sh FILES
.Bl -tag -width Pa -compact
.It Pa /var/yp/binding/[domainname].[version]
The files used to hold binding information for each NIS domain.
.It Pa /etc/sysconfig
System configuration file where the system default domain and
ypbind startup options are specified.
.El
.Sh SEE ALSO
.Xr domainname 1 ,
.Xr syslog 3 ,
.Xr yp 4 ,
.Xr ypserv 8 ,
.Xr ypset 8
.Sh AUTHOR
Theo de Raadt <deraadt@fsa.ca>