1e8636dfdSBill Paul.\" @(#)rpc_secure.3n 2.1 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI 27f3dea24SPeter Wemm.\" $FreeBSD$ 3fbc400a6SNik Clayton.\" 4125c8263SPhilippe Charnier.Dd February 16, 1988 5125c8263SPhilippe Charnier.Dt RPC 3 688544700SRuslan Ermilov.Os 7125c8263SPhilippe Charnier.Sh NAME 8125c8263SPhilippe Charnier.Nm rpc_secure 9125c8263SPhilippe Charnier.Nd library routines for secure remote procedure calls 10125c8263SPhilippe Charnier.Sh SYNOPSIS 1132eef9aeSRuslan Ermilov.In rpc/rpc.h 12125c8263SPhilippe Charnier.Ft AUTH * 13125c8263SPhilippe Charnier.Fo authdes_create 14125c8263SPhilippe Charnier.Fa "char *name" 15125c8263SPhilippe Charnier.Fa "unsigned window" 16d142a33bSBruce Evans.Fa "struct sockaddr *addr" 17125c8263SPhilippe Charnier.Fa "des_block *ckey" 18125c8263SPhilippe Charnier.Fc 19d142a33bSBruce Evans.Ft int 20d142a33bSBruce Evans.Fn authdes_getucred "struct authdes_cred *adc" "uid_t *uid" "gid_t *gid" "int *grouplen" "gid_t *groups" 21d142a33bSBruce Evans.Ft int 22d142a33bSBruce Evans.Fn getnetname "char *name" 23d142a33bSBruce Evans.Ft int 24db7534cfSBruce Evans.Fn host2netname "char *name" "const char *host" "const char *domain" 25d142a33bSBruce Evans.Ft int 26d142a33bSBruce Evans.Fn key_decryptsession "const char *remotename" "des_block *deskey" 27d142a33bSBruce Evans.Ft int 28d142a33bSBruce Evans.Fn key_encryptsession "const char *remotename" "des_block *deskey" 29d142a33bSBruce Evans.Ft int 30125c8263SPhilippe Charnier.Fn key_gendes "des_block *deskey" 31d142a33bSBruce Evans.Ft int 32d142a33bSBruce Evans.Fn key_setsecret "const char *key" 33d142a33bSBruce Evans.Ft int 34125c8263SPhilippe Charnier.Fn netname2host "char *name" "char *host" "int hostlen" 35d142a33bSBruce Evans.Ft int 36d142a33bSBruce Evans.Fn netname2user "char *name" "uid_t *uidp" "gid_t *gidp" "int *gidlenp" "gid_t *gidlist" 37d142a33bSBruce Evans.Ft int 38db7534cfSBruce Evans.Fn user2netname "char *name" "const uid_t uid" "const char *domain" 39125c8263SPhilippe Charnier.Sh DESCRIPTION 40125c8263SPhilippe CharnierThese routines are part of the 41125c8263SPhilippe Charnier.Tn RPC 421a0a9345SRuslan Ermilovlibrary. 431a0a9345SRuslan ErmilovThey implement 44125c8263SPhilippe Charnier.Tn DES 451a0a9345SRuslan ErmilovAuthentication. 461a0a9345SRuslan ErmilovSee 47125c8263SPhilippe Charnier.Xr rpc 3 48125c8263SPhilippe Charnierfor further details about 49125c8263SPhilippe Charnier.Tn RPC . 50125c8263SPhilippe Charnier.Pp 51125c8263SPhilippe CharnierThe 52125c8263SPhilippe Charnier.Fn authdes_create 53e8636dfdSBill Paulis the first of two routines which interface to the 54125c8263SPhilippe Charnier.Tn RPC 55e8636dfdSBill Paulsecure authentication system, known as 56125c8263SPhilippe Charnier.Tn DES 57e8636dfdSBill Paulauthentication. 58e8636dfdSBill PaulThe second is 59125c8263SPhilippe Charnier.Fn authdes_getucred , 60125c8263SPhilippe Charnierbelow. 61125c8263SPhilippe Charnier.Pp 62125c8263SPhilippe CharnierNote: the keyserver daemon 63125c8263SPhilippe Charnier.Xr keyserv 8 64e8636dfdSBill Paulmust be running for the 65125c8263SPhilippe Charnier.Tn DES 66e8636dfdSBill Paulauthentication system to work. 67125c8263SPhilippe Charnier.Pp 681fae73b1SRuslan ErmilovThe 691fae73b1SRuslan Ermilov.Fn authdes_create 701fae73b1SRuslan Ermilovfunction, 71e8636dfdSBill Paulused on the client side, returns an authentication handle that 72e8636dfdSBill Paulwill enable the use of the secure authentication system. 732efeeba5SRuslan ErmilovThe first argument 74125c8263SPhilippe Charnier.Fa name 75e8636dfdSBill Paulis the network name, or 76125c8263SPhilippe Charnier.Fa netname , 77c6ff3a1bSSheldon Hearnof the owner of the server process. 78c6ff3a1bSSheldon HearnThis field usually 79e8636dfdSBill Paulrepresents a 80125c8263SPhilippe Charnier.Fa hostname 81e8636dfdSBill Paulderived from the utility routine 82125c8263SPhilippe Charnier.Fn host2netname , 83e8636dfdSBill Paulbut could also represent a user name using 84125c8263SPhilippe Charnier.Fn user2netname . 85e8636dfdSBill PaulThe second field is window on the validity of 861a0a9345SRuslan Ermilovthe client credential, given in seconds. 871a0a9345SRuslan ErmilovA small 88e8636dfdSBill Paulwindow is more secure than a large one, but choosing 89e8636dfdSBill Paultoo small of a window will increase the frequency of 90c6ff3a1bSSheldon Hearnresynchronizations because of clock drift. 91c6ff3a1bSSheldon HearnThe third 922efeeba5SRuslan Ermilovargument 93125c8263SPhilippe Charnier.Fa addr 941a0a9345SRuslan Ermilovis optional. 951a0a9345SRuslan ErmilovIf it is 96125c8263SPhilippe Charnier.Dv NULL , 97e8636dfdSBill Paulthen the authentication system will assume 98e8636dfdSBill Paulthat the local clock is always in sync with the server's 99c6ff3a1bSSheldon Hearnclock, and will not attempt resynchronizations. 100c6ff3a1bSSheldon HearnIf an address 101e8636dfdSBill Paulis supplied, however, then the system will use the address 102e8636dfdSBill Paulfor consulting the remote time service whenever 103e8636dfdSBill Paulresynchronization 104c6ff3a1bSSheldon Hearnis required. 1052efeeba5SRuslan ErmilovThis argument is usually the 106e8636dfdSBill Pauladdress of the 107125c8263SPhilippe Charnier.Tn RPC 108c6ff3a1bSSheldon Hearnserver itself. 1092efeeba5SRuslan ErmilovThe final argument 110125c8263SPhilippe Charnier.Fa ckey 1111a0a9345SRuslan Ermilovis also optional. 1121a0a9345SRuslan ErmilovIf it is 113125c8263SPhilippe Charnier.Dv NULL , 114e8636dfdSBill Paulthen the authentication system will 115e8636dfdSBill Paulgenerate a random 116125c8263SPhilippe Charnier.Tn DES 117e8636dfdSBill Paulkey to be used for the encryption of credentials. 118e8636dfdSBill PaulIf it is supplied, however, then it will be used instead. 119125c8263SPhilippe Charnier.Pp 1201fae73b1SRuslan ErmilovThe 1211fae73b1SRuslan Ermilov.Fn authdes_getucred 1221fae73b1SRuslan Ermilovfunction, 123e8636dfdSBill Paulthe second of the two 124125c8263SPhilippe Charnier.Tn DES 125e8636dfdSBill Paulauthentication routines, 126e8636dfdSBill Paulis used on the server side for converting a 127125c8263SPhilippe Charnier.Tn DES 128e8636dfdSBill Paulcredential, which is 129e8636dfdSBill Pauloperating system independent, into a 130125c8263SPhilippe Charnier.Ux 131c6ff3a1bSSheldon Hearncredential. 132c6ff3a1bSSheldon HearnThis routine differs from utility routine 133125c8263SPhilippe Charnier.Fn netname2user 134e8636dfdSBill Paulin that 135125c8263SPhilippe Charnier.Fn authdes_getucred 136e8636dfdSBill Paulpulls its information from a cache, and does not have to do a 137e8636dfdSBill PaulYellow Pages lookup every time it is called to get its information. 138125c8263SPhilippe Charnier.Pp 1391fae73b1SRuslan ErmilovThe 1401fae73b1SRuslan Ermilov.Fn getnetname 1411fae73b1SRuslan Ermilovfunction 142125c8263SPhilippe Charnierinstalls the unique, operating-system independent netname of 143125c8263SPhilippe Charnierthe 144125c8263SPhilippe Charniercaller in the fixed-length array 145125c8263SPhilippe Charnier.Fa name . 146125c8263SPhilippe CharnierReturns 147125c8263SPhilippe Charnier.Dv TRUE 148e8636dfdSBill Paulif it succeeds and 149125c8263SPhilippe Charnier.Dv FALSE 150125c8263SPhilippe Charnierif it fails. 151125c8263SPhilippe Charnier.Pp 1521fae73b1SRuslan ErmilovThe 1531fae73b1SRuslan Ermilov.Fn host2netname 1541fae73b1SRuslan Ermilovfunction 155125c8263SPhilippe Charnierconverts from a domain-specific hostname to an 156c6ff3a1bSSheldon Hearnoperating-system independent netname. 157c6ff3a1bSSheldon HearnReturns 158125c8263SPhilippe Charnier.Dv TRUE 159125c8263SPhilippe Charnierif it succeeds and 160125c8263SPhilippe Charnier.Dv FALSE 161c6ff3a1bSSheldon Hearnif it fails. 162c6ff3a1bSSheldon HearnInverse of 163125c8263SPhilippe Charnier.Fn netname2host . 164125c8263SPhilippe Charnier.Pp 1651fae73b1SRuslan ErmilovThe 1661fae73b1SRuslan Ermilov.Fn key_decryptsession 1671fae73b1SRuslan Ermilovfunction 168e8636dfdSBill Paulis an interface to the keyserver daemon, which is associated 169e8636dfdSBill Paulwith 170125c8263SPhilippe Charnier.Tn RPC Ns 's 17194ba280cSRuslan Ermilovsecure authentication system 17294ba280cSRuslan Ermilov.Tn ( DES 173e8636dfdSBill Paulauthentication). 174e8636dfdSBill PaulUser programs rarely need to call it, or its associated routines 175125c8263SPhilippe Charnier.Fn key_encryptsession , 176125c8263SPhilippe Charnier.Fn key_gendes 177e8636dfdSBill Pauland 178125c8263SPhilippe Charnier.Fn key_setsecret . 179e8636dfdSBill PaulSystem commands such as 180125c8263SPhilippe Charnier.Xr login 1 181e8636dfdSBill Pauland the 182125c8263SPhilippe Charnier.Tn RPC 183e8636dfdSBill Paullibrary are the main clients of these four routines. 184125c8263SPhilippe Charnier.Pp 1851fae73b1SRuslan ErmilovThe 1861fae73b1SRuslan Ermilov.Fn key_decryptsession 1871fae73b1SRuslan Ermilovfunction 188125c8263SPhilippe Charniertakes a server netname and a 189125c8263SPhilippe Charnier.Tn DES 190125c8263SPhilippe Charnierkey, and decrypts the key by 191a910f192SDima Dorfmanusing the public key of the server and the secret key 1921a0a9345SRuslan Ermilovassociated with the effective uid of the calling process. 1931a0a9345SRuslan ErmilovIt 194e8636dfdSBill Paulis the inverse of 195125c8263SPhilippe Charnier.Fn key_encryptsession . 196125c8263SPhilippe Charnier.Pp 1971fae73b1SRuslan ErmilovThe 1981fae73b1SRuslan Ermilov.Fn key_encryptsession 1991fae73b1SRuslan Ermilovfunction 200c6ff3a1bSSheldon Hearnis a keyserver interface routine. 201c6ff3a1bSSheldon HearnIt 202e8636dfdSBill Paultakes a server netname and a des key, and encrypts 2031d8ffb44SSheldon Hearnit using the public key of the server and the secret key 2041a0a9345SRuslan Ermilovassociated with the effective uid of the calling process. 2051a0a9345SRuslan ErmilovIt 206e8636dfdSBill Paulis the inverse of 207125c8263SPhilippe Charnier.Fn key_decryptsession . 208125c8263SPhilippe Charnier.Pp 2091fae73b1SRuslan ErmilovThe 2101fae73b1SRuslan Ermilov.Fn key_gendes 2111fae73b1SRuslan Ermilovfunction 212c6ff3a1bSSheldon Hearnis a keyserver interface routine. 213c6ff3a1bSSheldon HearnIt 214e8636dfdSBill Paulis used to ask the keyserver for a secure conversation key. 215125c8263SPhilippe CharnierChoosing one 216125c8263SPhilippe Charnier.Qq random 217125c8263SPhilippe Charnieris usually not good enough, 218e8636dfdSBill Paulbecause 219e8636dfdSBill Paulthe common ways of choosing random numbers, such as using the 220e8636dfdSBill Paulcurrent time, are very easy to guess. 221125c8263SPhilippe Charnier.Pp 2221fae73b1SRuslan ErmilovThe 2231fae73b1SRuslan Ermilov.Fn key_setsecret 2241fae73b1SRuslan Ermilovfunction 225c6ff3a1bSSheldon Hearnis a keyserver interface routine. 226c6ff3a1bSSheldon HearnIt is used to set the key for 227e8636dfdSBill Paulthe effective 228125c8263SPhilippe Charnier.Fa uid 229e8636dfdSBill Paulof the calling process. 230125c8263SPhilippe Charnier.Pp 2311fae73b1SRuslan ErmilovThe 2321fae73b1SRuslan Ermilov.Fn netname2host 2331fae73b1SRuslan Ermilovfunction 234125c8263SPhilippe Charnierconverts from an operating-system independent netname to a 235c6ff3a1bSSheldon Hearndomain-specific hostname. 236c6ff3a1bSSheldon HearnReturns 237125c8263SPhilippe Charnier.Dv TRUE 238e8636dfdSBill Paulif it succeeds and 239125c8263SPhilippe Charnier.Dv FALSE 2401a0a9345SRuslan Ermilovif it fails. 2411a0a9345SRuslan ErmilovInverse of 242125c8263SPhilippe Charnier.Fn host2netname . 243125c8263SPhilippe Charnier.Pp 2441fae73b1SRuslan ErmilovThe 2451fae73b1SRuslan Ermilov.Fn netname2user 2461fae73b1SRuslan Ermilovfunction 247125c8263SPhilippe Charnierconverts from an operating-system independent netname to a 248125c8263SPhilippe Charnierdomain-specific user ID. 249e8636dfdSBill PaulReturns 250125c8263SPhilippe Charnier.Dv TRUE 251e8636dfdSBill Paulif it succeeds and 252125c8263SPhilippe Charnier.Dv FALSE 253c6ff3a1bSSheldon Hearnif it fails. 254c6ff3a1bSSheldon HearnInverse of 255125c8263SPhilippe Charnier.Fn user2netname . 256125c8263SPhilippe Charnier.Pp 2571fae73b1SRuslan ErmilovThe 2581fae73b1SRuslan Ermilov.Fn user2netname 2591fae73b1SRuslan Ermilovfunction 260125c8263SPhilippe Charnierconverts from a domain-specific username to an operating-system 261c6ff3a1bSSheldon Hearnindependent netname. 262c6ff3a1bSSheldon HearnReturns 263125c8263SPhilippe Charnier.Dv TRUE 264e8636dfdSBill Paulif it succeeds and 265125c8263SPhilippe Charnier.Dv FALSE 266c6ff3a1bSSheldon Hearnif it fails. 267c6ff3a1bSSheldon HearnInverse of 268125c8263SPhilippe Charnier.Fn netname2user . 269125c8263SPhilippe Charnier.Sh SEE ALSO 270125c8263SPhilippe Charnier.Xr rpc 3 , 271125c8263SPhilippe Charnier.Xr xdr 3 , 272125c8263SPhilippe Charnier.Xr keyserv 8 273125c8263SPhilippe Charnier.Pp 274e8636dfdSBill PaulThe following manuals: 275125c8263SPhilippe Charnier.Rs 276125c8263SPhilippe Charnier.%B Remote Procedure Calls: Protocol Specification 277125c8263SPhilippe Charnier.Re 278125c8263SPhilippe Charnier.Rs 279125c8263SPhilippe Charnier.%B Remote Procedure Call Programming Guide 280125c8263SPhilippe Charnier.Re 281125c8263SPhilippe Charnier.Rs 282125c8263SPhilippe Charnier.%B Rpcgen Programming Guide 283125c8263SPhilippe Charnier.Re 284125c8263SPhilippe Charnier.Rs 285125c8263SPhilippe Charnier.%B RPC: Remote Procedure Call Protocol Specification 286125c8263SPhilippe Charnier.%O RFC1050, Sun Microsystems Inc., USC-ISI 287125c8263SPhilippe Charnier.Re 288