xref: /dflybsd-src/lib/libc/rpc/rpc_secure.3 (revision c6cf4f8f1ebc9e3fe2a8c566f08adfc86122c7bf)
1.\" @(#)rpc_secure.3n	2.1 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
2.\" $FreeBSD: src/lib/libc/rpc/rpc_secure.3,v 1.6.2.5 2001/12/14 18:33:57 ru Exp $
3.\" $DragonFly: src/lib/libc/rpc/rpc_secure.3,v 1.2 2003/06/17 04:26:45 dillon Exp $
4.\"
5.Dd February 16, 1988
6.Dt RPC 3
7.Os
8.Sh NAME
9.Nm rpc_secure
10.Nd library routines for secure remote procedure calls
11.Sh SYNOPSIS
12.In rpc/rpc.h
13.Ft AUTH *
14.Fo authdes_create
15.Fa "char *name"
16.Fa "unsigned window"
17.Fa "struct sockaddr *addr"
18.Fa "des_block *ckey"
19.Fc
20.Ft int
21.Fn authdes_getucred "struct authdes_cred *adc" "uid_t *uid" "gid_t *gid" "int *grouplen" "gid_t *groups"
22.Ft int
23.Fn getnetname "char *name"
24.Ft int
25.Fn host2netname "char *name" "char *host" "char *domain"
26.Ft int
27.Fn key_decryptsession "const char *remotename" "des_block *deskey"
28.Ft int
29.Fn key_encryptsession "const char *remotename" "des_block *deskey"
30.Ft int
31.Fn key_gendes "des_block *deskey"
32.Ft int
33.Fn key_setsecret "const char *key"
34.Ft int
35.Fn netname2host "char *name" "char *host" "int hostlen"
36.Ft int
37.Fn netname2user "char *name" "uid_t *uidp" "gid_t *gidp" "int *gidlenp" "gid_t *gidlist"
38.Ft int
39.Fn user2netname "char *name" "uid_t uid" "char *domain"
40.Sh DESCRIPTION
41These routines are part of the
42.Tn RPC
43library.  They implement
44.Tn DES
45Authentication.  See
46.Xr rpc 3
47for further details about
48.Tn RPC .
49.Pp
50The
51.Fn authdes_create
52is the first of two routines which interface to the
53.Tn RPC
54secure authentication system, known as
55.Tn DES
56authentication.
57The second is
58.Fn authdes_getucred ,
59below.
60.Pp
61Note: the keyserver daemon
62.Xr keyserv 8
63must be running for the
64.Tn DES
65authentication system to work.
66.Pp
67.Fn Authdes_create ,
68used on the client side, returns an authentication handle that
69will enable the use of the secure authentication system.
70The first parameter
71.Fa name
72is the network name, or
73.Fa netname ,
74of the owner of the server process.
75This field usually
76represents a
77.Fa hostname
78derived from the utility routine
79.Fn host2netname ,
80but could also represent a user name using
81.Fn user2netname .
82The second field is window on the validity of
83the client credential, given in seconds.  A small
84window is more secure than a large one, but choosing
85too small of a window will increase the frequency of
86resynchronizations because of clock drift.
87The third
88parameter
89.Fa addr
90is optional.  If it is
91.Dv NULL ,
92then the authentication system will assume
93that the local clock is always in sync with the server's
94clock, and will not attempt resynchronizations.
95If an address
96is supplied, however, then the system will use the address
97for consulting the remote time service whenever
98resynchronization
99is required.
100This parameter is usually the
101address of the
102.Tn RPC
103server itself.
104The final parameter
105.Fa ckey
106is also optional.  If it is
107.Dv NULL ,
108then the authentication system will
109generate a random
110.Tn DES
111key to be used for the encryption of credentials.
112If it is supplied, however, then it will be used instead.
113.Pp
114.Fn Authdes_getucred ,
115the second of the two
116.Tn DES
117authentication routines,
118is used on the server side for converting a
119.Tn DES
120credential, which is
121operating system independent, into a
122.Ux
123credential.
124This routine differs from utility routine
125.Fn netname2user
126in that
127.Fn authdes_getucred
128pulls its information from a cache, and does not have to do a
129Yellow Pages lookup every time it is called to get its information.
130.Pp
131.Fn Getnetname
132installs the unique, operating-system independent netname of
133the
134caller in the fixed-length array
135.Fa name .
136Returns
137.Dv TRUE
138if it succeeds and
139.Dv FALSE
140if it fails.
141.Pp
142.Fn Host2netname
143converts from a domain-specific hostname to an
144operating-system independent netname.
145Returns
146.Dv TRUE
147if it succeeds and
148.Dv FALSE
149if it fails.
150Inverse of
151.Fn netname2host .
152.Pp
153.Fn Key_decryptsession
154is an interface to the keyserver daemon, which is associated
155with
156.Tn RPC Ns 's
157secure authentication system
158.Tn ( DES
159authentication).
160User programs rarely need to call it, or its associated routines
161.Fn key_encryptsession ,
162.Fn key_gendes
163and
164.Fn key_setsecret .
165System commands such as
166.Xr login 1
167and the
168.Tn RPC
169library are the main clients of these four routines.
170.Pp
171.Fn Key_decryptsession
172takes a server netname and a
173.Tn DES
174key, and decrypts the key by
175using the public key of the server and the secret key
176associated with the effective uid of the calling process.  It
177is the inverse of
178.Fn key_encryptsession .
179.Pp
180.Fn Key_encryptsession
181is a keyserver interface routine.
182It
183takes a server netname and a des key, and encrypts
184it using the public key of the server and the secret key
185associated with the effective uid of the calling process.  It
186is the inverse of
187.Fn key_decryptsession .
188.Pp
189.Fn Key_gendes
190is a keyserver interface routine.
191It
192is used to ask the keyserver for a secure conversation key.
193Choosing one
194.Qq random
195is usually not good enough,
196because
197the common ways of choosing random numbers, such as using the
198current time, are very easy to guess.
199.Pp
200.Fn Key_setsecret
201is a keyserver interface routine.
202It is used to set the key for
203the effective
204.Fa uid
205of the calling process.
206.Pp
207.Fn Netname2host
208converts from an operating-system independent netname to a
209domain-specific hostname.
210Returns
211.Dv TRUE
212if it succeeds and
213.Dv FALSE
214if it fails.  Inverse of
215.Fn host2netname .
216.Pp
217.Fn Netname2user
218converts from an operating-system independent netname to a
219domain-specific user ID.
220Returns
221.Dv TRUE
222if it succeeds and
223.Dv FALSE
224if it fails.
225Inverse of
226.Fn user2netname .
227.Pp
228.Fn User2netname
229converts from a domain-specific username to an operating-system
230independent netname.
231Returns
232.Dv TRUE
233if it succeeds and
234.Dv FALSE
235if it fails.
236Inverse of
237.Fn netname2user .
238.Sh SEE ALSO
239.Xr rpc 3 ,
240.Xr xdr 3 ,
241.Xr keyserv 8
242.Pp
243The following manuals:
244.Rs
245.%B Remote Procedure Calls: Protocol Specification
246.Re
247.Rs
248.%B Remote Procedure Call Programming Guide
249.Re
250.Rs
251.%B Rpcgen Programming Guide
252.Re
253.Rs
254.%B RPC: Remote Procedure Call Protocol Specification
255.%O RFC1050, Sun Microsystems Inc., USC-ISI
256.Re
257