xref: /freebsd/lib/libc/rpc/rpc_secure.3 (revision fbc400a67a4e6979c5d99fe59d904cf08992a98f)
1e8636dfdSBill Paul.\" @(#)rpc_secure.3n	2.1 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
2fbc400a6SNik Clayton.\" $Id: rpc_secure.3,v 1.3 1998/01/16 13:33:09 bde Exp $
3fbc400a6SNik Clayton.\"
4125c8263SPhilippe Charnier.Dd February 16, 1988
5125c8263SPhilippe Charnier.Dt RPC 3
6125c8263SPhilippe Charnier.Sh NAME
7125c8263SPhilippe Charnier.Nm rpc_secure
8125c8263SPhilippe Charnier.Nd library routines for secure remote procedure calls
9125c8263SPhilippe Charnier.Sh SYNOPSIS
10125c8263SPhilippe Charnier.Fd #include <rpc/rpc.h>
11125c8263SPhilippe Charnier.Ft AUTH *
12125c8263SPhilippe Charnier.Fo authdes_create
13125c8263SPhilippe Charnier.Fa "char *name"
14125c8263SPhilippe Charnier.Fa "unsigned window"
15d142a33bSBruce Evans.Fa "struct sockaddr *addr"
16125c8263SPhilippe Charnier.Fa "des_block *ckey"
17125c8263SPhilippe Charnier.Fc
18d142a33bSBruce Evans.Ft int
19d142a33bSBruce Evans.Fn authdes_getucred "struct authdes_cred *adc" "uid_t *uid" "gid_t *gid" "int *grouplen" "gid_t *groups"
20d142a33bSBruce Evans.Ft int
21d142a33bSBruce Evans.Fn getnetname "char *name"
22d142a33bSBruce Evans.Ft int
23125c8263SPhilippe Charnier.Fn host2netname "char *name" "char *host" "char *domain"
24d142a33bSBruce Evans.Ft int
25d142a33bSBruce Evans.Fn key_decryptsession "const char *remotename" "des_block *deskey"
26d142a33bSBruce Evans.Ft int
27d142a33bSBruce Evans.Fn key_encryptsession "const char *remotename" "des_block *deskey"
28d142a33bSBruce Evans.Ft int
29125c8263SPhilippe Charnier.Fn key_gendes "des_block *deskey"
30d142a33bSBruce Evans.Ft int
31d142a33bSBruce Evans.Fn key_setsecret "const char *key"
32d142a33bSBruce Evans.Ft int
33125c8263SPhilippe Charnier.Fn netname2host "char *name" "char *host" "int hostlen"
34d142a33bSBruce Evans.Ft int
35d142a33bSBruce Evans.Fn netname2user "char *name" "uid_t *uidp" "gid_t *gidp" "int *gidlenp" "gid_t *gidlist"
36d142a33bSBruce Evans.Ft int
37d142a33bSBruce Evans.Fn user2netname "char *name" "uid_t uid" "char *domain"
38125c8263SPhilippe Charnier.Sh DESCRIPTION
39125c8263SPhilippe CharnierThese routines are part of the
40125c8263SPhilippe Charnier.Tn RPC
41125c8263SPhilippe Charnierlibrary.  They implement
42125c8263SPhilippe Charnier.Tn DES
43e8636dfdSBill PaulAuthentication.  See
44125c8263SPhilippe Charnier.Xr rpc 3
45125c8263SPhilippe Charnierfor further details about
46125c8263SPhilippe Charnier.Tn RPC .
47125c8263SPhilippe Charnier.Pp
48125c8263SPhilippe CharnierThe
49125c8263SPhilippe Charnier.Fn authdes_create
50e8636dfdSBill Paulis the first of two routines which interface to the
51125c8263SPhilippe Charnier.Tn RPC
52e8636dfdSBill Paulsecure authentication system, known as
53125c8263SPhilippe Charnier.Tn DES
54e8636dfdSBill Paulauthentication.
55e8636dfdSBill PaulThe second is
56125c8263SPhilippe Charnier.Fn authdes_getucred ,
57125c8263SPhilippe Charnierbelow.
58125c8263SPhilippe Charnier.Pp
59125c8263SPhilippe CharnierNote: the keyserver daemon
60125c8263SPhilippe Charnier.Xr keyserv 8
61e8636dfdSBill Paulmust be running for the
62125c8263SPhilippe Charnier.Tn DES
63e8636dfdSBill Paulauthentication system to work.
64125c8263SPhilippe Charnier.Pp
65125c8263SPhilippe Charnier.Fn Authdes_create ,
66e8636dfdSBill Paulused on the client side, returns an authentication handle that
67e8636dfdSBill Paulwill enable the use of the secure authentication system.
68e8636dfdSBill PaulThe first parameter
69125c8263SPhilippe Charnier.Fa name
70e8636dfdSBill Paulis the network name, or
71125c8263SPhilippe Charnier.Fa netname ,
72e8636dfdSBill Paulof the owner of the server process. This field usually
73e8636dfdSBill Paulrepresents a
74125c8263SPhilippe Charnier.Fa hostname
75e8636dfdSBill Paulderived from the utility routine
76125c8263SPhilippe Charnier.Fn host2netname ,
77e8636dfdSBill Paulbut could also represent a user name using
78125c8263SPhilippe Charnier.Fn user2netname .
79e8636dfdSBill PaulThe second field is window on the validity of
80e8636dfdSBill Paulthe client credential, given in seconds.  A small
81e8636dfdSBill Paulwindow is more secure than a large one, but choosing
82e8636dfdSBill Paultoo small of a window will increase the frequency of
83e8636dfdSBill Paulresynchronizations because of clock drift. The third
84e8636dfdSBill Paulparameter
85125c8263SPhilippe Charnier.Fa addr
86e8636dfdSBill Paulis optional.  If it is
87125c8263SPhilippe Charnier.Dv NULL ,
88e8636dfdSBill Paulthen the authentication system will assume
89e8636dfdSBill Paulthat the local clock is always in sync with the server's
90e8636dfdSBill Paulclock, and will not attempt resynchronizations. If an address
91e8636dfdSBill Paulis supplied, however, then the system will use the address
92e8636dfdSBill Paulfor consulting the remote time service whenever
93e8636dfdSBill Paulresynchronization
94e8636dfdSBill Paulis required. This parameter is usually the
95e8636dfdSBill Pauladdress of the
96125c8263SPhilippe Charnier.Tn RPC
97e8636dfdSBill Paulserver itself. The final parameter
98125c8263SPhilippe Charnier.Fa ckey
99e8636dfdSBill Paulis also optional.  If it is
100125c8263SPhilippe Charnier.Dv NULL ,
101e8636dfdSBill Paulthen the authentication system will
102e8636dfdSBill Paulgenerate a random
103125c8263SPhilippe Charnier.Tn DES
104e8636dfdSBill Paulkey to be used for the encryption of credentials.
105e8636dfdSBill PaulIf it is supplied, however, then it will be used instead.
106125c8263SPhilippe Charnier.Pp
107125c8263SPhilippe Charnier.Fn Authdes_getucred ,
108e8636dfdSBill Paulthe second of the two
109125c8263SPhilippe Charnier.Tn DES
110e8636dfdSBill Paulauthentication routines,
111e8636dfdSBill Paulis used on the server side for converting a
112125c8263SPhilippe Charnier.Tn DES
113e8636dfdSBill Paulcredential, which is
114e8636dfdSBill Pauloperating system independent, into a
115125c8263SPhilippe Charnier.Ux
116e8636dfdSBill Paulcredential. This routine differs from utility routine
117125c8263SPhilippe Charnier.Fn netname2user
118e8636dfdSBill Paulin that
119125c8263SPhilippe Charnier.Fn authdes_getucred
120e8636dfdSBill Paulpulls its information from a cache, and does not have to do a
121e8636dfdSBill PaulYellow Pages lookup every time it is called to get its information.
122125c8263SPhilippe Charnier.Pp
123125c8263SPhilippe Charnier.Fn Getnetname
124125c8263SPhilippe Charnierinstalls the unique, operating-system independent netname of
125125c8263SPhilippe Charnierthe
126125c8263SPhilippe Charniercaller in the fixed-length array
127125c8263SPhilippe Charnier.Fa name .
128125c8263SPhilippe CharnierReturns
129125c8263SPhilippe Charnier.Dv TRUE
130e8636dfdSBill Paulif it succeeds and
131125c8263SPhilippe Charnier.Dv FALSE
132125c8263SPhilippe Charnierif it fails.
133125c8263SPhilippe Charnier.Pp
134125c8263SPhilippe Charnier.Fn Host2netname
135125c8263SPhilippe Charnierconverts from a domain-specific hostname to an
136125c8263SPhilippe Charnieroperating-system independent netname. Returns
137125c8263SPhilippe Charnier.Dv TRUE
138125c8263SPhilippe Charnierif it succeeds and
139125c8263SPhilippe Charnier.Dv FALSE
140e8636dfdSBill Paulif it fails. Inverse of
141125c8263SPhilippe Charnier.Fn netname2host .
142125c8263SPhilippe Charnier.Pp
143125c8263SPhilippe Charnier.Fn Key_decryptsession
144e8636dfdSBill Paulis an interface to the keyserver daemon, which is associated
145e8636dfdSBill Paulwith
146125c8263SPhilippe Charnier.Tn RPC Ns 's
147125c8263SPhilippe Charniersecure authentication system (
148125c8263SPhilippe Charnier.Tn DES
149e8636dfdSBill Paulauthentication).
150e8636dfdSBill PaulUser programs rarely need to call it, or its associated routines
151125c8263SPhilippe Charnier.Fn key_encryptsession ,
152125c8263SPhilippe Charnier.Fn key_gendes
153e8636dfdSBill Pauland
154125c8263SPhilippe Charnier.Fn key_setsecret .
155e8636dfdSBill PaulSystem commands such as
156125c8263SPhilippe Charnier.Xr login 1
157e8636dfdSBill Pauland the
158125c8263SPhilippe Charnier.Tn RPC
159e8636dfdSBill Paullibrary are the main clients of these four routines.
160125c8263SPhilippe Charnier.Pp
161125c8263SPhilippe Charnier.Fn Key_decryptsession
162125c8263SPhilippe Charniertakes a server netname and a
163125c8263SPhilippe Charnier.Tn DES
164125c8263SPhilippe Charnierkey, and decrypts the key by
165e8636dfdSBill Paulusing the the public key of the the server and the secret key
166e8636dfdSBill Paulassociated with the effective uid of the calling process.  It
167e8636dfdSBill Paulis the inverse of
168125c8263SPhilippe Charnier.Fn key_encryptsession .
169125c8263SPhilippe Charnier.Pp
170125c8263SPhilippe Charnier.Fn Key_encryptsession
171e8636dfdSBill Paulis a keyserver interface routine. It
172e8636dfdSBill Paultakes a server netname and a des key, and encrypts
173e8636dfdSBill Paulit using the public key of the the server and the secret key
174e8636dfdSBill Paulassociated with the effective uid of the calling process.  It
175e8636dfdSBill Paulis the inverse of
176125c8263SPhilippe Charnier.Fn key_decryptsession .
177125c8263SPhilippe Charnier.Pp
178125c8263SPhilippe Charnier.Fn Key_gendes
179e8636dfdSBill Paulis a keyserver interface routine. It
180e8636dfdSBill Paulis used to ask the keyserver for a secure conversation key.
181125c8263SPhilippe CharnierChoosing one
182125c8263SPhilippe Charnier.Qq random
183125c8263SPhilippe Charnieris usually not good enough,
184e8636dfdSBill Paulbecause
185e8636dfdSBill Paulthe common ways of choosing random numbers, such as using the
186e8636dfdSBill Paulcurrent time, are very easy to guess.
187125c8263SPhilippe Charnier.Pp
188125c8263SPhilippe Charnier.Fn Key_setsecret
189e8636dfdSBill Paulis a keyserver interface routine. It is used to set the key for
190e8636dfdSBill Paulthe effective
191125c8263SPhilippe Charnier.Fa uid
192e8636dfdSBill Paulof the calling process.
193125c8263SPhilippe Charnier.Pp
194125c8263SPhilippe Charnier.Fn Netname2host
195125c8263SPhilippe Charnierconverts from an operating-system independent netname to a
196e8636dfdSBill Pauldomain-specific hostname. Returns
197125c8263SPhilippe Charnier.Dv TRUE
198e8636dfdSBill Paulif it succeeds and
199125c8263SPhilippe Charnier.Dv FALSE
200e8636dfdSBill Paulif it fails.  Inverse of
201125c8263SPhilippe Charnier.Fn host2netname .
202125c8263SPhilippe Charnier.Pp
203125c8263SPhilippe Charnier.Fn Netname2user
204125c8263SPhilippe Charnierconverts from an operating-system independent netname to a
205125c8263SPhilippe Charnierdomain-specific user ID.
206e8636dfdSBill PaulReturns
207125c8263SPhilippe Charnier.Dv TRUE
208e8636dfdSBill Paulif it succeeds and
209125c8263SPhilippe Charnier.Dv FALSE
210e8636dfdSBill Paulif it fails. Inverse of
211125c8263SPhilippe Charnier.Fn user2netname .
212125c8263SPhilippe Charnier.Pp
213125c8263SPhilippe Charnier.Fn User2netname
214125c8263SPhilippe Charnierconverts from a domain-specific username to an operating-system
215e8636dfdSBill Paulindependent netname. Returns
216125c8263SPhilippe Charnier.Dv TRUE
217e8636dfdSBill Paulif it succeeds and
218125c8263SPhilippe Charnier.Dv FALSE
219e8636dfdSBill Paulif it fails. Inverse of
220125c8263SPhilippe Charnier.Fn netname2user .
221125c8263SPhilippe Charnier.Sh SEE ALSO
222125c8263SPhilippe Charnier.Xr rpc 3 ,
223125c8263SPhilippe Charnier.Xr xdr 3 ,
224125c8263SPhilippe Charnier.Xr keyserv 8
225125c8263SPhilippe Charnier.Pp
226e8636dfdSBill PaulThe following manuals:
227125c8263SPhilippe Charnier.Rs
228125c8263SPhilippe Charnier.%B Remote Procedure Calls: Protocol Specification
229125c8263SPhilippe Charnier.Re
230125c8263SPhilippe Charnier.Rs
231125c8263SPhilippe Charnier.%B Remote Procedure Call Programming Guide
232125c8263SPhilippe Charnier.Re
233125c8263SPhilippe Charnier.Rs
234125c8263SPhilippe Charnier.%B Rpcgen Programming Guide
235125c8263SPhilippe Charnier.Re
236125c8263SPhilippe Charnier.Rs
237125c8263SPhilippe Charnier.%B RPC: Remote Procedure Call Protocol Specification
238125c8263SPhilippe Charnier.%O RFC1050, Sun Microsystems Inc., USC-ISI
239125c8263SPhilippe Charnier.Re
240