1997-05-28 05:00:11 +00:00
|
|
|
.\" @(#)rpc_secure.3n 2.1 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1999-07-12 20:50:10 +00:00
|
|
|
.\"
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dd February 16, 1988
|
|
|
|
.Dt RPC 3
|
2000-12-14 13:58:15 +00:00
|
|
|
.Os
|
1998-01-05 07:12:16 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm rpc_secure
|
|
|
|
.Nd library routines for secure remote procedure calls
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Fd #include <rpc/rpc.h>
|
|
|
|
.Ft AUTH *
|
|
|
|
.Fo authdes_create
|
|
|
|
.Fa "char *name"
|
|
|
|
.Fa "unsigned window"
|
1998-01-16 13:33:09 +00:00
|
|
|
.Fa "struct sockaddr *addr"
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fa "des_block *ckey"
|
|
|
|
.Fc
|
1998-01-16 13:33:09 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn authdes_getucred "struct authdes_cred *adc" "uid_t *uid" "gid_t *gid" "int *grouplen" "gid_t *groups"
|
|
|
|
.Ft int
|
|
|
|
.Fn getnetname "char *name"
|
|
|
|
.Ft int
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn host2netname "char *name" "char *host" "char *domain"
|
1998-01-16 13:33:09 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn key_decryptsession "const char *remotename" "des_block *deskey"
|
|
|
|
.Ft int
|
|
|
|
.Fn key_encryptsession "const char *remotename" "des_block *deskey"
|
|
|
|
.Ft int
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn key_gendes "des_block *deskey"
|
1998-01-16 13:33:09 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn key_setsecret "const char *key"
|
|
|
|
.Ft int
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn netname2host "char *name" "char *host" "int hostlen"
|
1998-01-16 13:33:09 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn netname2user "char *name" "uid_t *uidp" "gid_t *gidp" "int *gidlenp" "gid_t *gidlist"
|
|
|
|
.Ft int
|
|
|
|
.Fn user2netname "char *name" "uid_t uid" "char *domain"
|
1998-01-05 07:12:16 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
These routines are part of the
|
|
|
|
.Tn RPC
|
|
|
|
library. They implement
|
|
|
|
.Tn DES
|
1997-05-28 05:00:11 +00:00
|
|
|
Authentication. See
|
1998-01-05 07:12:16 +00:00
|
|
|
.Xr rpc 3
|
|
|
|
for further details about
|
|
|
|
.Tn RPC .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn authdes_create
|
1997-05-28 05:00:11 +00:00
|
|
|
is the first of two routines which interface to the
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn RPC
|
1997-05-28 05:00:11 +00:00
|
|
|
secure authentication system, known as
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn DES
|
1997-05-28 05:00:11 +00:00
|
|
|
authentication.
|
|
|
|
The second is
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn authdes_getucred ,
|
|
|
|
below.
|
|
|
|
.Pp
|
|
|
|
Note: the keyserver daemon
|
|
|
|
.Xr keyserv 8
|
1997-05-28 05:00:11 +00:00
|
|
|
must be running for the
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn DES
|
1997-05-28 05:00:11 +00:00
|
|
|
authentication system to work.
|
1998-01-05 07:12:16 +00:00
|
|
|
.Pp
|
|
|
|
.Fn Authdes_create ,
|
1997-05-28 05:00:11 +00:00
|
|
|
used on the client side, returns an authentication handle that
|
|
|
|
will enable the use of the secure authentication system.
|
|
|
|
The first parameter
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fa name
|
1997-05-28 05:00:11 +00:00
|
|
|
is the network name, or
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fa netname ,
|
2000-03-02 09:14:21 +00:00
|
|
|
of the owner of the server process.
|
|
|
|
This field usually
|
1997-05-28 05:00:11 +00:00
|
|
|
represents a
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fa hostname
|
1997-05-28 05:00:11 +00:00
|
|
|
derived from the utility routine
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn host2netname ,
|
1997-05-28 05:00:11 +00:00
|
|
|
but could also represent a user name using
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn user2netname .
|
1997-05-28 05:00:11 +00:00
|
|
|
The second field is window on the validity of
|
|
|
|
the client credential, given in seconds. A small
|
|
|
|
window is more secure than a large one, but choosing
|
|
|
|
too small of a window will increase the frequency of
|
2000-03-02 09:14:21 +00:00
|
|
|
resynchronizations because of clock drift.
|
|
|
|
The third
|
1997-05-28 05:00:11 +00:00
|
|
|
parameter
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fa addr
|
1997-05-28 05:00:11 +00:00
|
|
|
is optional. If it is
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv NULL ,
|
1997-05-28 05:00:11 +00:00
|
|
|
then the authentication system will assume
|
|
|
|
that the local clock is always in sync with the server's
|
2000-03-02 09:14:21 +00:00
|
|
|
clock, and will not attempt resynchronizations.
|
|
|
|
If an address
|
1997-05-28 05:00:11 +00:00
|
|
|
is supplied, however, then the system will use the address
|
|
|
|
for consulting the remote time service whenever
|
|
|
|
resynchronization
|
2000-03-02 09:14:21 +00:00
|
|
|
is required.
|
|
|
|
This parameter is usually the
|
1997-05-28 05:00:11 +00:00
|
|
|
address of the
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn RPC
|
2000-03-02 09:14:21 +00:00
|
|
|
server itself.
|
|
|
|
The final parameter
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fa ckey
|
1997-05-28 05:00:11 +00:00
|
|
|
is also optional. If it is
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv NULL ,
|
1997-05-28 05:00:11 +00:00
|
|
|
then the authentication system will
|
|
|
|
generate a random
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn DES
|
1997-05-28 05:00:11 +00:00
|
|
|
key to be used for the encryption of credentials.
|
|
|
|
If it is supplied, however, then it will be used instead.
|
1998-01-05 07:12:16 +00:00
|
|
|
.Pp
|
|
|
|
.Fn Authdes_getucred ,
|
1997-05-28 05:00:11 +00:00
|
|
|
the second of the two
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn DES
|
1997-05-28 05:00:11 +00:00
|
|
|
authentication routines,
|
|
|
|
is used on the server side for converting a
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn DES
|
1997-05-28 05:00:11 +00:00
|
|
|
credential, which is
|
|
|
|
operating system independent, into a
|
1998-01-05 07:12:16 +00:00
|
|
|
.Ux
|
2000-03-02 09:14:21 +00:00
|
|
|
credential.
|
|
|
|
This routine differs from utility routine
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn netname2user
|
1997-05-28 05:00:11 +00:00
|
|
|
in that
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn authdes_getucred
|
1997-05-28 05:00:11 +00:00
|
|
|
pulls its information from a cache, and does not have to do a
|
|
|
|
Yellow Pages lookup every time it is called to get its information.
|
1998-01-05 07:12:16 +00:00
|
|
|
.Pp
|
|
|
|
.Fn Getnetname
|
|
|
|
installs the unique, operating-system independent netname of
|
|
|
|
the
|
|
|
|
caller in the fixed-length array
|
|
|
|
.Fa name .
|
|
|
|
Returns
|
|
|
|
.Dv TRUE
|
|
|
|
if it succeeds and
|
|
|
|
.Dv FALSE
|
|
|
|
if it fails.
|
|
|
|
.Pp
|
|
|
|
.Fn Host2netname
|
|
|
|
converts from a domain-specific hostname to an
|
2000-03-02 09:14:21 +00:00
|
|
|
operating-system independent netname.
|
|
|
|
Returns
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv TRUE
|
1997-05-28 05:00:11 +00:00
|
|
|
if it succeeds and
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv FALSE
|
2000-03-02 09:14:21 +00:00
|
|
|
if it fails.
|
|
|
|
Inverse of
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn netname2host .
|
|
|
|
.Pp
|
|
|
|
.Fn Key_decryptsession
|
1997-05-28 05:00:11 +00:00
|
|
|
is an interface to the keyserver daemon, which is associated
|
|
|
|
with
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn RPC Ns 's
|
2001-08-10 17:35:21 +00:00
|
|
|
secure authentication system
|
|
|
|
.Tn ( DES
|
1997-05-28 05:00:11 +00:00
|
|
|
authentication).
|
|
|
|
User programs rarely need to call it, or its associated routines
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn key_encryptsession ,
|
|
|
|
.Fn key_gendes
|
1997-05-28 05:00:11 +00:00
|
|
|
and
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn key_setsecret .
|
1997-05-28 05:00:11 +00:00
|
|
|
System commands such as
|
1998-01-05 07:12:16 +00:00
|
|
|
.Xr login 1
|
1997-05-28 05:00:11 +00:00
|
|
|
and the
|
1998-01-05 07:12:16 +00:00
|
|
|
.Tn RPC
|
1997-05-28 05:00:11 +00:00
|
|
|
library are the main clients of these four routines.
|
1998-01-05 07:12:16 +00:00
|
|
|
.Pp
|
|
|
|
.Fn Key_decryptsession
|
|
|
|
takes a server netname and a
|
|
|
|
.Tn DES
|
|
|
|
key, and decrypts the key by
|
2001-06-24 01:34:38 +00:00
|
|
|
using the public key of the server and the secret key
|
1997-05-28 05:00:11 +00:00
|
|
|
associated with the effective uid of the calling process. It
|
|
|
|
is the inverse of
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn key_encryptsession .
|
|
|
|
.Pp
|
|
|
|
.Fn Key_encryptsession
|
2000-03-02 09:14:21 +00:00
|
|
|
is a keyserver interface routine.
|
|
|
|
It
|
1997-05-28 05:00:11 +00:00
|
|
|
takes a server netname and a des key, and encrypts
|
2001-07-24 08:30:55 +00:00
|
|
|
it using the public key of the server and the secret key
|
1997-05-28 05:00:11 +00:00
|
|
|
associated with the effective uid of the calling process. It
|
|
|
|
is the inverse of
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn key_decryptsession .
|
|
|
|
.Pp
|
|
|
|
.Fn Key_gendes
|
2000-03-02 09:14:21 +00:00
|
|
|
is a keyserver interface routine.
|
|
|
|
It
|
1997-05-28 05:00:11 +00:00
|
|
|
is used to ask the keyserver for a secure conversation key.
|
1998-01-05 07:12:16 +00:00
|
|
|
Choosing one
|
|
|
|
.Qq random
|
|
|
|
is usually not good enough,
|
1997-05-28 05:00:11 +00:00
|
|
|
because
|
|
|
|
the common ways of choosing random numbers, such as using the
|
|
|
|
current time, are very easy to guess.
|
1998-01-05 07:12:16 +00:00
|
|
|
.Pp
|
|
|
|
.Fn Key_setsecret
|
2000-03-02 09:14:21 +00:00
|
|
|
is a keyserver interface routine.
|
|
|
|
It is used to set the key for
|
1997-05-28 05:00:11 +00:00
|
|
|
the effective
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fa uid
|
1997-05-28 05:00:11 +00:00
|
|
|
of the calling process.
|
1998-01-05 07:12:16 +00:00
|
|
|
.Pp
|
|
|
|
.Fn Netname2host
|
|
|
|
converts from an operating-system independent netname to a
|
2000-03-02 09:14:21 +00:00
|
|
|
domain-specific hostname.
|
|
|
|
Returns
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv TRUE
|
1997-05-28 05:00:11 +00:00
|
|
|
if it succeeds and
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv FALSE
|
1997-05-28 05:00:11 +00:00
|
|
|
if it fails. Inverse of
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn host2netname .
|
|
|
|
.Pp
|
|
|
|
.Fn Netname2user
|
|
|
|
converts from an operating-system independent netname to a
|
|
|
|
domain-specific user ID.
|
1997-05-28 05:00:11 +00:00
|
|
|
Returns
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv TRUE
|
1997-05-28 05:00:11 +00:00
|
|
|
if it succeeds and
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv FALSE
|
2000-03-02 09:14:21 +00:00
|
|
|
if it fails.
|
|
|
|
Inverse of
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn user2netname .
|
|
|
|
.Pp
|
|
|
|
.Fn User2netname
|
|
|
|
converts from a domain-specific username to an operating-system
|
2000-03-02 09:14:21 +00:00
|
|
|
independent netname.
|
|
|
|
Returns
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv TRUE
|
1997-05-28 05:00:11 +00:00
|
|
|
if it succeeds and
|
1998-01-05 07:12:16 +00:00
|
|
|
.Dv FALSE
|
2000-03-02 09:14:21 +00:00
|
|
|
if it fails.
|
|
|
|
Inverse of
|
1998-01-05 07:12:16 +00:00
|
|
|
.Fn netname2user .
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr rpc 3 ,
|
|
|
|
.Xr xdr 3 ,
|
|
|
|
.Xr keyserv 8
|
|
|
|
.Pp
|
1997-05-28 05:00:11 +00:00
|
|
|
The following manuals:
|
1998-01-05 07:12:16 +00:00
|
|
|
.Rs
|
|
|
|
.%B Remote Procedure Calls: Protocol Specification
|
|
|
|
.Re
|
|
|
|
.Rs
|
|
|
|
.%B Remote Procedure Call Programming Guide
|
|
|
|
.Re
|
|
|
|
.Rs
|
|
|
|
.%B Rpcgen Programming Guide
|
|
|
|
.Re
|
|
|
|
.Rs
|
|
|
|
.%B RPC: Remote Procedure Call Protocol Specification
|
|
|
|
.%O RFC1050, Sun Microsystems Inc., USC-ISI
|
|
|
|
.Re
|