xref: /freebsd/lib/libc/rpc/rpc_secure.3 (revision d142a33b7f25506b98f15dcf0555d7aa4691cdc6)
1e8636dfdSBill Paul.\" @(#)rpc_secure.3n	2.1 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
2d142a33bSBruce Evans.\" $Id: rpc_secure.3,v 1.2 1998/01/05 07:12:16 charnier Exp $
3125c8263SPhilippe Charnier.Dd February 16, 1988
4125c8263SPhilippe Charnier.Dt RPC 3
5125c8263SPhilippe Charnier.Sh NAME
6125c8263SPhilippe Charnier.Nm rpc_secure
7125c8263SPhilippe Charnier.Nd library routines for secure remote procedure calls
8125c8263SPhilippe Charnier.Sh SYNOPSIS
9125c8263SPhilippe Charnier.Fd #include <rpc/rpc.h>
10125c8263SPhilippe Charnier.Ft AUTH *
11125c8263SPhilippe Charnier.Fo authdes_create
12125c8263SPhilippe Charnier.Fa "char *name"
13125c8263SPhilippe Charnier.Fa "unsigned window"
14d142a33bSBruce Evans.Fa "struct sockaddr *addr"
15125c8263SPhilippe Charnier.Fa "des_block *ckey"
16125c8263SPhilippe Charnier.Fc
17d142a33bSBruce Evans.Ft int
18d142a33bSBruce Evans.Fn authdes_getucred "struct authdes_cred *adc" "uid_t *uid" "gid_t *gid" "int *grouplen" "gid_t *groups"
19d142a33bSBruce Evans.Ft int
20d142a33bSBruce Evans.Fn getnetname "char *name"
21d142a33bSBruce Evans.Ft int
22125c8263SPhilippe Charnier.Fn host2netname "char *name" "char *host" "char *domain"
23d142a33bSBruce Evans.Ft int
24d142a33bSBruce Evans.Fn key_decryptsession "const char *remotename" "des_block *deskey"
25d142a33bSBruce Evans.Ft int
26d142a33bSBruce Evans.Fn key_encryptsession "const char *remotename" "des_block *deskey"
27d142a33bSBruce Evans.Ft int
28125c8263SPhilippe Charnier.Fn key_gendes "des_block *deskey"
29d142a33bSBruce Evans.Ft int
30d142a33bSBruce Evans.Fn key_setsecret "const char *key"
31d142a33bSBruce Evans.Ft int
32125c8263SPhilippe Charnier.Fn netname2host "char *name" "char *host" "int hostlen"
33d142a33bSBruce Evans.Ft int
34d142a33bSBruce Evans.Fn netname2user "char *name" "uid_t *uidp" "gid_t *gidp" "int *gidlenp" "gid_t *gidlist"
35d142a33bSBruce Evans.Ft int
36d142a33bSBruce Evans.Fn user2netname "char *name" "uid_t uid" "char *domain"
37125c8263SPhilippe Charnier.Sh DESCRIPTION
38125c8263SPhilippe CharnierThese routines are part of the
39125c8263SPhilippe Charnier.Tn RPC
40125c8263SPhilippe Charnierlibrary.  They implement
41125c8263SPhilippe Charnier.Tn DES
42e8636dfdSBill PaulAuthentication.  See
43125c8263SPhilippe Charnier.Xr rpc 3
44125c8263SPhilippe Charnierfor further details about
45125c8263SPhilippe Charnier.Tn RPC .
46125c8263SPhilippe Charnier.Pp
47125c8263SPhilippe CharnierThe
48125c8263SPhilippe Charnier.Fn authdes_create
49e8636dfdSBill Paulis the first of two routines which interface to the
50125c8263SPhilippe Charnier.Tn RPC
51e8636dfdSBill Paulsecure authentication system, known as
52125c8263SPhilippe Charnier.Tn DES
53e8636dfdSBill Paulauthentication.
54e8636dfdSBill PaulThe second is
55125c8263SPhilippe Charnier.Fn authdes_getucred ,
56125c8263SPhilippe Charnierbelow.
57125c8263SPhilippe Charnier.Pp
58125c8263SPhilippe CharnierNote: the keyserver daemon
59125c8263SPhilippe Charnier.Xr keyserv 8
60e8636dfdSBill Paulmust be running for the
61125c8263SPhilippe Charnier.Tn DES
62e8636dfdSBill Paulauthentication system to work.
63125c8263SPhilippe Charnier.Pp
64125c8263SPhilippe Charnier.Fn Authdes_create ,
65e8636dfdSBill Paulused on the client side, returns an authentication handle that
66e8636dfdSBill Paulwill enable the use of the secure authentication system.
67e8636dfdSBill PaulThe first parameter
68125c8263SPhilippe Charnier.Fa name
69e8636dfdSBill Paulis the network name, or
70125c8263SPhilippe Charnier.Fa netname ,
71e8636dfdSBill Paulof the owner of the server process. This field usually
72e8636dfdSBill Paulrepresents a
73125c8263SPhilippe Charnier.Fa hostname
74e8636dfdSBill Paulderived from the utility routine
75125c8263SPhilippe Charnier.Fn host2netname ,
76e8636dfdSBill Paulbut could also represent a user name using
77125c8263SPhilippe Charnier.Fn user2netname .
78e8636dfdSBill PaulThe second field is window on the validity of
79e8636dfdSBill Paulthe client credential, given in seconds.  A small
80e8636dfdSBill Paulwindow is more secure than a large one, but choosing
81e8636dfdSBill Paultoo small of a window will increase the frequency of
82e8636dfdSBill Paulresynchronizations because of clock drift. The third
83e8636dfdSBill Paulparameter
84125c8263SPhilippe Charnier.Fa addr
85e8636dfdSBill Paulis optional.  If it is
86125c8263SPhilippe Charnier.Dv NULL ,
87e8636dfdSBill Paulthen the authentication system will assume
88e8636dfdSBill Paulthat the local clock is always in sync with the server's
89e8636dfdSBill Paulclock, and will not attempt resynchronizations. If an address
90e8636dfdSBill Paulis supplied, however, then the system will use the address
91e8636dfdSBill Paulfor consulting the remote time service whenever
92e8636dfdSBill Paulresynchronization
93e8636dfdSBill Paulis required. This parameter is usually the
94e8636dfdSBill Pauladdress of the
95125c8263SPhilippe Charnier.Tn RPC
96e8636dfdSBill Paulserver itself. The final parameter
97125c8263SPhilippe Charnier.Fa ckey
98e8636dfdSBill Paulis also optional.  If it is
99125c8263SPhilippe Charnier.Dv NULL ,
100e8636dfdSBill Paulthen the authentication system will
101e8636dfdSBill Paulgenerate a random
102125c8263SPhilippe Charnier.Tn DES
103e8636dfdSBill Paulkey to be used for the encryption of credentials.
104e8636dfdSBill PaulIf it is supplied, however, then it will be used instead.
105125c8263SPhilippe Charnier.Pp
106125c8263SPhilippe Charnier.Fn Authdes_getucred ,
107e8636dfdSBill Paulthe second of the two
108125c8263SPhilippe Charnier.Tn DES
109e8636dfdSBill Paulauthentication routines,
110e8636dfdSBill Paulis used on the server side for converting a
111125c8263SPhilippe Charnier.Tn DES
112e8636dfdSBill Paulcredential, which is
113e8636dfdSBill Pauloperating system independent, into a
114125c8263SPhilippe Charnier.Ux
115e8636dfdSBill Paulcredential. This routine differs from utility routine
116125c8263SPhilippe Charnier.Fn netname2user
117e8636dfdSBill Paulin that
118125c8263SPhilippe Charnier.Fn authdes_getucred
119e8636dfdSBill Paulpulls its information from a cache, and does not have to do a
120e8636dfdSBill PaulYellow Pages lookup every time it is called to get its information.
121125c8263SPhilippe Charnier.Pp
122125c8263SPhilippe Charnier.Fn Getnetname
123125c8263SPhilippe Charnierinstalls the unique, operating-system independent netname of
124125c8263SPhilippe Charnierthe
125125c8263SPhilippe Charniercaller in the fixed-length array
126125c8263SPhilippe Charnier.Fa name .
127125c8263SPhilippe CharnierReturns
128125c8263SPhilippe Charnier.Dv TRUE
129e8636dfdSBill Paulif it succeeds and
130125c8263SPhilippe Charnier.Dv FALSE
131125c8263SPhilippe Charnierif it fails.
132125c8263SPhilippe Charnier.Pp
133125c8263SPhilippe Charnier.Fn Host2netname
134125c8263SPhilippe Charnierconverts from a domain-specific hostname to an
135125c8263SPhilippe Charnieroperating-system independent netname. Returns
136125c8263SPhilippe Charnier.Dv TRUE
137125c8263SPhilippe Charnierif it succeeds and
138125c8263SPhilippe Charnier.Dv FALSE
139e8636dfdSBill Paulif it fails. Inverse of
140125c8263SPhilippe Charnier.Fn netname2host .
141125c8263SPhilippe Charnier.Pp
142125c8263SPhilippe Charnier.Fn Key_decryptsession
143e8636dfdSBill Paulis an interface to the keyserver daemon, which is associated
144e8636dfdSBill Paulwith
145125c8263SPhilippe Charnier.Tn RPC Ns 's
146125c8263SPhilippe Charniersecure authentication system (
147125c8263SPhilippe Charnier.Tn DES
148e8636dfdSBill Paulauthentication).
149e8636dfdSBill PaulUser programs rarely need to call it, or its associated routines
150125c8263SPhilippe Charnier.Fn key_encryptsession ,
151125c8263SPhilippe Charnier.Fn key_gendes
152e8636dfdSBill Pauland
153125c8263SPhilippe Charnier.Fn key_setsecret .
154e8636dfdSBill PaulSystem commands such as
155125c8263SPhilippe Charnier.Xr login 1
156e8636dfdSBill Pauland the
157125c8263SPhilippe Charnier.Tn RPC
158e8636dfdSBill Paullibrary are the main clients of these four routines.
159125c8263SPhilippe Charnier.Pp
160125c8263SPhilippe Charnier.Fn Key_decryptsession
161125c8263SPhilippe Charniertakes a server netname and a
162125c8263SPhilippe Charnier.Tn DES
163125c8263SPhilippe Charnierkey, and decrypts the key by
164e8636dfdSBill Paulusing the the public key of the the server and the secret key
165e8636dfdSBill Paulassociated with the effective uid of the calling process.  It
166e8636dfdSBill Paulis the inverse of
167125c8263SPhilippe Charnier.Fn key_encryptsession .
168125c8263SPhilippe Charnier.Pp
169125c8263SPhilippe Charnier.Fn Key_encryptsession
170e8636dfdSBill Paulis a keyserver interface routine. It
171e8636dfdSBill Paultakes a server netname and a des key, and encrypts
172e8636dfdSBill Paulit using the public key of the the server and the secret key
173e8636dfdSBill Paulassociated with the effective uid of the calling process.  It
174e8636dfdSBill Paulis the inverse of
175125c8263SPhilippe Charnier.Fn key_decryptsession .
176125c8263SPhilippe Charnier.Pp
177125c8263SPhilippe Charnier.Fn Key_gendes
178e8636dfdSBill Paulis a keyserver interface routine. It
179e8636dfdSBill Paulis used to ask the keyserver for a secure conversation key.
180125c8263SPhilippe CharnierChoosing one
181125c8263SPhilippe Charnier.Qq random
182125c8263SPhilippe Charnieris usually not good enough,
183e8636dfdSBill Paulbecause
184e8636dfdSBill Paulthe common ways of choosing random numbers, such as using the
185e8636dfdSBill Paulcurrent time, are very easy to guess.
186125c8263SPhilippe Charnier.Pp
187125c8263SPhilippe Charnier.Fn Key_setsecret
188e8636dfdSBill Paulis a keyserver interface routine. It is used to set the key for
189e8636dfdSBill Paulthe effective
190125c8263SPhilippe Charnier.Fa uid
191e8636dfdSBill Paulof the calling process.
192125c8263SPhilippe Charnier.Pp
193125c8263SPhilippe Charnier.Fn Netname2host
194125c8263SPhilippe Charnierconverts from an operating-system independent netname to a
195e8636dfdSBill Pauldomain-specific hostname. Returns
196125c8263SPhilippe Charnier.Dv TRUE
197e8636dfdSBill Paulif it succeeds and
198125c8263SPhilippe Charnier.Dv FALSE
199e8636dfdSBill Paulif it fails.  Inverse of
200125c8263SPhilippe Charnier.Fn host2netname .
201125c8263SPhilippe Charnier.Pp
202125c8263SPhilippe Charnier.Fn Netname2user
203125c8263SPhilippe Charnierconverts from an operating-system independent netname to a
204125c8263SPhilippe Charnierdomain-specific user ID.
205e8636dfdSBill PaulReturns
206125c8263SPhilippe Charnier.Dv TRUE
207e8636dfdSBill Paulif it succeeds and
208125c8263SPhilippe Charnier.Dv FALSE
209e8636dfdSBill Paulif it fails. Inverse of
210125c8263SPhilippe Charnier.Fn user2netname .
211125c8263SPhilippe Charnier.Pp
212125c8263SPhilippe Charnier.Fn User2netname
213125c8263SPhilippe Charnierconverts from a domain-specific username to an operating-system
214e8636dfdSBill Paulindependent netname. Returns
215125c8263SPhilippe Charnier.Dv TRUE
216e8636dfdSBill Paulif it succeeds and
217125c8263SPhilippe Charnier.Dv FALSE
218e8636dfdSBill Paulif it fails. Inverse of
219125c8263SPhilippe Charnier.Fn netname2user .
220125c8263SPhilippe Charnier.Sh SEE ALSO
221125c8263SPhilippe Charnier.Xr rpc 3 ,
222125c8263SPhilippe Charnier.Xr xdr 3 ,
223125c8263SPhilippe Charnier.Xr keyserv 8
224125c8263SPhilippe Charnier.Pp
225e8636dfdSBill PaulThe following manuals:
226125c8263SPhilippe Charnier.Rs
227125c8263SPhilippe Charnier.%B Remote Procedure Calls: Protocol Specification
228125c8263SPhilippe Charnier.Re
229125c8263SPhilippe Charnier.Rs
230125c8263SPhilippe Charnier.%B Remote Procedure Call Programming Guide
231125c8263SPhilippe Charnier.Re
232125c8263SPhilippe Charnier.Rs
233125c8263SPhilippe Charnier.%B Rpcgen Programming Guide
234125c8263SPhilippe Charnier.Re
235125c8263SPhilippe Charnier.Rs
236125c8263SPhilippe Charnier.%B RPC: Remote Procedure Call Protocol Specification
237125c8263SPhilippe Charnier.%O RFC1050, Sun Microsystems Inc., USC-ISI
238125c8263SPhilippe Charnier.Re
239