1fbc400a6SNik Clayton.\" 2125c8263SPhilippe Charnier.Dd February 16, 1988 3125c8263SPhilippe Charnier.Dt RPC 3 488544700SRuslan Ermilov.Os 5125c8263SPhilippe Charnier.Sh NAME 6125c8263SPhilippe Charnier.Nm rpc_secure 7125c8263SPhilippe Charnier.Nd library routines for secure remote procedure calls 8125c8263SPhilippe Charnier.Sh SYNOPSIS 932eef9aeSRuslan Ermilov.In 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 22db7534cfSBruce Evans.Fn host2netname "char *name" "const char *host" "const 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 36db7534cfSBruce Evans.Fn user2netname "char *name" "const uid_t uid" "const char *domain" 37125c8263SPhilippe Charnier.Sh DESCRIPTION 38125c8263SPhilippe CharnierThese routines are part of the 39125c8263SPhilippe Charnier.Tn RPC 401a0a9345SRuslan Ermilovlibrary. 411a0a9345SRuslan ErmilovThey implement 42125c8263SPhilippe Charnier.Tn DES 431a0a9345SRuslan ErmilovAuthentication. 441a0a9345SRuslan ErmilovSee 45125c8263SPhilippe Charnier.Xr rpc 3 46125c8263SPhilippe Charnierfor further details about 47125c8263SPhilippe Charnier.Tn RPC . 48125c8263SPhilippe Charnier.Pp 49125c8263SPhilippe CharnierThe 50125c8263SPhilippe Charnier.Fn authdes_create 51e8636dfdSBill Paulis the first of two routines which interface to the 52125c8263SPhilippe Charnier.Tn RPC 53e8636dfdSBill Paulsecure authentication system, known as 54125c8263SPhilippe Charnier.Tn DES 55e8636dfdSBill Paulauthentication. 56e8636dfdSBill PaulThe second is 57125c8263SPhilippe Charnier.Fn authdes_getucred , 58125c8263SPhilippe Charnierbelow. 59125c8263SPhilippe Charnier.Pp 60125c8263SPhilippe CharnierNote: the keyserver daemon 61125c8263SPhilippe Charnier.Xr keyserv 8 62e8636dfdSBill Paulmust be running for the 63125c8263SPhilippe Charnier.Tn DES 64e8636dfdSBill Paulauthentication system to work. 65125c8263SPhilippe Charnier.Pp 661fae73b1SRuslan ErmilovThe 671fae73b1SRuslan Ermilov.Fn authdes_create 681fae73b1SRuslan Ermilovfunction, 69e8636dfdSBill Paulused on the client side, returns an authentication handle that 70e8636dfdSBill Paulwill enable the use of the secure authentication system. 712efeeba5SRuslan ErmilovThe first argument 72125c8263SPhilippe Charnier.Fa name 73e8636dfdSBill Paulis the network name, or 74125c8263SPhilippe Charnier.Fa netname , 75c6ff3a1bSSheldon Hearnof the owner of the server process. 76c6ff3a1bSSheldon HearnThis field usually 77e8636dfdSBill Paulrepresents a 78125c8263SPhilippe Charnier.Fa hostname 79e8636dfdSBill Paulderived from the utility routine 80125c8263SPhilippe Charnier.Fn host2netname , 81e8636dfdSBill Paulbut could also represent a user name using 82125c8263SPhilippe Charnier.Fn user2netname . 83e8636dfdSBill PaulThe second field is window on the validity of 841a0a9345SRuslan Ermilovthe client credential, given in seconds. 851a0a9345SRuslan ErmilovA small 86e8636dfdSBill Paulwindow is more secure than a large one, but choosing 87e8636dfdSBill Paultoo small of a window will increase the frequency of 88c6ff3a1bSSheldon Hearnresynchronizations because of clock drift. 89c6ff3a1bSSheldon HearnThe third 902efeeba5SRuslan Ermilovargument 91125c8263SPhilippe Charnier.Fa addr 921a0a9345SRuslan Ermilovis optional. 931a0a9345SRuslan ErmilovIf it is 94125c8263SPhilippe Charnier.Dv NULL , 95e8636dfdSBill Paulthen the authentication system will assume 96e8636dfdSBill Paulthat the local clock is always in sync with the server's 97c6ff3a1bSSheldon Hearnclock, and will not attempt resynchronizations. 98c6ff3a1bSSheldon HearnIf an address 99e8636dfdSBill Paulis supplied, however, then the system will use the address 100e8636dfdSBill Paulfor consulting the remote time service whenever 101e8636dfdSBill Paulresynchronization 102c6ff3a1bSSheldon Hearnis required. 1032efeeba5SRuslan ErmilovThis argument is usually the 104e8636dfdSBill Pauladdress of the 105125c8263SPhilippe Charnier.Tn RPC 106c6ff3a1bSSheldon Hearnserver itself. 1072efeeba5SRuslan ErmilovThe final argument 108125c8263SPhilippe Charnier.Fa ckey 1091a0a9345SRuslan Ermilovis also optional. 1101a0a9345SRuslan ErmilovIf it is 111125c8263SPhilippe Charnier.Dv NULL , 112e8636dfdSBill Paulthen the authentication system will 113e8636dfdSBill Paulgenerate a random 114125c8263SPhilippe Charnier.Tn DES 115e8636dfdSBill Paulkey to be used for the encryption of credentials. 116e8636dfdSBill PaulIf it is supplied, however, then it will be used instead. 117125c8263SPhilippe Charnier.Pp 1181fae73b1SRuslan ErmilovThe 1191fae73b1SRuslan Ermilov.Fn authdes_getucred 1201fae73b1SRuslan Ermilovfunction, 121e8636dfdSBill Paulthe second of the two 122125c8263SPhilippe Charnier.Tn DES 123e8636dfdSBill Paulauthentication routines, 124e8636dfdSBill Paulis used on the server side for converting a 125125c8263SPhilippe Charnier.Tn DES 126e8636dfdSBill Paulcredential, which is 127e8636dfdSBill Pauloperating system independent, into a 128125c8263SPhilippe Charnier.Ux 129c6ff3a1bSSheldon Hearncredential. 130c6ff3a1bSSheldon HearnThis routine differs from utility routine 131125c8263SPhilippe Charnier.Fn netname2user 132e8636dfdSBill Paulin that 133125c8263SPhilippe Charnier.Fn authdes_getucred 134e8636dfdSBill Paulpulls its information from a cache, and does not have to do a 135e8636dfdSBill PaulYellow Pages lookup every time it is called to get its information. 136125c8263SPhilippe Charnier.Pp 1371fae73b1SRuslan ErmilovThe 1381fae73b1SRuslan Ermilov.Fn getnetname 1391fae73b1SRuslan Ermilovfunction 140125c8263SPhilippe Charnierinstalls the unique, operating-system independent netname of 141125c8263SPhilippe Charnierthe 142125c8263SPhilippe Charniercaller in the fixed-length array 143125c8263SPhilippe Charnier.Fa name . 144125c8263SPhilippe CharnierReturns 145125c8263SPhilippe Charnier.Dv TRUE 146e8636dfdSBill Paulif it succeeds and 147125c8263SPhilippe Charnier.Dv FALSE 148125c8263SPhilippe Charnierif it fails. 149125c8263SPhilippe Charnier.Pp 1501fae73b1SRuslan ErmilovThe 1511fae73b1SRuslan Ermilov.Fn host2netname 1521fae73b1SRuslan Ermilovfunction 153125c8263SPhilippe Charnierconverts from a domain-specific hostname to an 154c6ff3a1bSSheldon Hearnoperating-system independent netname. 155c6ff3a1bSSheldon HearnReturns 156125c8263SPhilippe Charnier.Dv TRUE 157125c8263SPhilippe Charnierif it succeeds and 158125c8263SPhilippe Charnier.Dv FALSE 159c6ff3a1bSSheldon Hearnif it fails. 160c6ff3a1bSSheldon HearnInverse of 161125c8263SPhilippe Charnier.Fn netname2host . 162125c8263SPhilippe Charnier.Pp 1631fae73b1SRuslan ErmilovThe 1641fae73b1SRuslan Ermilov.Fn key_decryptsession 1651fae73b1SRuslan Ermilovfunction 166e8636dfdSBill Paulis an interface to the keyserver daemon, which is associated 167e8636dfdSBill Paulwith 168125c8263SPhilippe Charnier.Tn RPC Ns 's 16994ba280cSRuslan Ermilovsecure authentication system 17094ba280cSRuslan Ermilov.Tn ( DES 171e8636dfdSBill Paulauthentication). 172e8636dfdSBill PaulUser programs rarely need to call it, or its associated routines 173125c8263SPhilippe Charnier.Fn key_encryptsession , 174125c8263SPhilippe Charnier.Fn key_gendes 175e8636dfdSBill Pauland 176125c8263SPhilippe Charnier.Fn key_setsecret . 177e8636dfdSBill PaulSystem commands such as 178125c8263SPhilippe Charnier.Xr login 1 179e8636dfdSBill Pauland the 180125c8263SPhilippe Charnier.Tn RPC 181e8636dfdSBill Paullibrary are the main clients of these four routines. 182125c8263SPhilippe Charnier.Pp 1831fae73b1SRuslan ErmilovThe 1841fae73b1SRuslan Ermilov.Fn key_decryptsession 1851fae73b1SRuslan Ermilovfunction 186125c8263SPhilippe Charniertakes a server netname and a 187125c8263SPhilippe Charnier.Tn DES 188125c8263SPhilippe Charnierkey, and decrypts the key by 189a910f192SDima Dorfmanusing the public key of the server and the secret key 1901a0a9345SRuslan Ermilovassociated with the effective uid of the calling process. 1911a0a9345SRuslan ErmilovIt 192e8636dfdSBill Paulis the inverse of 193125c8263SPhilippe Charnier.Fn key_encryptsession . 194125c8263SPhilippe Charnier.Pp 1951fae73b1SRuslan ErmilovThe 1961fae73b1SRuslan Ermilov.Fn key_encryptsession 1971fae73b1SRuslan Ermilovfunction 198c6ff3a1bSSheldon Hearnis a keyserver interface routine. 199c6ff3a1bSSheldon HearnIt 200e8636dfdSBill Paultakes a server netname and a des key, and encrypts 2011d8ffb44SSheldon Hearnit using the public key of the server and the secret key 2021a0a9345SRuslan Ermilovassociated with the effective uid of the calling process. 2031a0a9345SRuslan ErmilovIt 204e8636dfdSBill Paulis the inverse of 205125c8263SPhilippe Charnier.Fn key_decryptsession . 206125c8263SPhilippe Charnier.Pp 2071fae73b1SRuslan ErmilovThe 2081fae73b1SRuslan Ermilov.Fn key_gendes 2091fae73b1SRuslan Ermilovfunction 210c6ff3a1bSSheldon Hearnis a keyserver interface routine. 211c6ff3a1bSSheldon HearnIt 212e8636dfdSBill Paulis used to ask the keyserver for a secure conversation key. 213125c8263SPhilippe CharnierChoosing one 214125c8263SPhilippe Charnier.Qq random 215125c8263SPhilippe Charnieris usually not good enough, 216e8636dfdSBill Paulbecause 217e8636dfdSBill Paulthe common ways of choosing random numbers, such as using the 218e8636dfdSBill Paulcurrent time, are very easy to guess. 219125c8263SPhilippe Charnier.Pp 2201fae73b1SRuslan ErmilovThe 2211fae73b1SRuslan Ermilov.Fn key_setsecret 2221fae73b1SRuslan Ermilovfunction 223c6ff3a1bSSheldon Hearnis a keyserver interface routine. 224c6ff3a1bSSheldon HearnIt is used to set the key for 225e8636dfdSBill Paulthe effective 226125c8263SPhilippe Charnier.Fa uid 227e8636dfdSBill Paulof the calling process. 228125c8263SPhilippe Charnier.Pp 2291fae73b1SRuslan ErmilovThe 2301fae73b1SRuslan Ermilov.Fn netname2host 2311fae73b1SRuslan Ermilovfunction 232125c8263SPhilippe Charnierconverts from an operating-system independent netname to a 233c6ff3a1bSSheldon Hearndomain-specific hostname. 234c6ff3a1bSSheldon HearnReturns 235125c8263SPhilippe Charnier.Dv TRUE 236e8636dfdSBill Paulif it succeeds and 237125c8263SPhilippe Charnier.Dv FALSE 2381a0a9345SRuslan Ermilovif it fails. 2391a0a9345SRuslan ErmilovInverse of 240125c8263SPhilippe Charnier.Fn host2netname . 241125c8263SPhilippe Charnier.Pp 2421fae73b1SRuslan ErmilovThe 2431fae73b1SRuslan Ermilov.Fn netname2user 2441fae73b1SRuslan Ermilovfunction 245125c8263SPhilippe Charnierconverts from an operating-system independent netname to a 246125c8263SPhilippe Charnierdomain-specific user ID. 247e8636dfdSBill PaulReturns 248125c8263SPhilippe Charnier.Dv TRUE 249e8636dfdSBill Paulif it succeeds and 250125c8263SPhilippe Charnier.Dv FALSE 251c6ff3a1bSSheldon Hearnif it fails. 252c6ff3a1bSSheldon HearnInverse of 253125c8263SPhilippe Charnier.Fn user2netname . 254125c8263SPhilippe Charnier.Pp 2551fae73b1SRuslan ErmilovThe 2561fae73b1SRuslan Ermilov.Fn user2netname 2571fae73b1SRuslan Ermilovfunction 258125c8263SPhilippe Charnierconverts from a domain-specific username to an operating-system 259c6ff3a1bSSheldon Hearnindependent netname. 260c6ff3a1bSSheldon HearnReturns 261125c8263SPhilippe Charnier.Dv TRUE 262e8636dfdSBill Paulif it succeeds and 263125c8263SPhilippe Charnier.Dv FALSE 264c6ff3a1bSSheldon Hearnif it fails. 265c6ff3a1bSSheldon HearnInverse of 266125c8263SPhilippe Charnier.Fn netname2user . 267125c8263SPhilippe Charnier.Sh SEE ALSO 268125c8263SPhilippe Charnier.Xr rpc 3 , 269125c8263SPhilippe Charnier.Xr xdr 3 , 270125c8263SPhilippe Charnier.Xr keyserv 8 271125c8263SPhilippe Charnier.Pp 272e8636dfdSBill PaulThe following manuals: 273125c8263SPhilippe Charnier.Rs 274125c8263SPhilippe Charnier.%B Remote Procedure Calls: Protocol Specification 275125c8263SPhilippe Charnier.Re 276125c8263SPhilippe Charnier.Rs 277125c8263SPhilippe Charnier.%B Remote Procedure Call Programming Guide 278125c8263SPhilippe Charnier.Re 279125c8263SPhilippe Charnier.Rs 280125c8263SPhilippe Charnier.%B Rpcgen Programming Guide 281125c8263SPhilippe Charnier.Re 282125c8263SPhilippe Charnier.Rs 283125c8263SPhilippe Charnier.%B RPC: Remote Procedure Call Protocol Specification 284125c8263SPhilippe Charnier.%O RFC1050, Sun Microsystems Inc., USC-ISI 285125c8263SPhilippe Charnier.Re 286