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 42125c8263SPhilippe Charnierlibrary. They implement 43125c8263SPhilippe Charnier.Tn DES 44e8636dfdSBill PaulAuthentication. See 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 84e8636dfdSBill Paulthe client credential, given in seconds. A small 85e8636dfdSBill Paulwindow is more secure than a large one, but choosing 86e8636dfdSBill Paultoo small of a window will increase the frequency of 87c6ff3a1bSSheldon Hearnresynchronizations because of clock drift. 88c6ff3a1bSSheldon HearnThe third 892efeeba5SRuslan Ermilovargument 90125c8263SPhilippe Charnier.Fa addr 91e8636dfdSBill Paulis optional. If it is 92125c8263SPhilippe Charnier.Dv NULL , 93e8636dfdSBill Paulthen the authentication system will assume 94e8636dfdSBill Paulthat the local clock is always in sync with the server's 95c6ff3a1bSSheldon Hearnclock, and will not attempt resynchronizations. 96c6ff3a1bSSheldon HearnIf an address 97e8636dfdSBill Paulis supplied, however, then the system will use the address 98e8636dfdSBill Paulfor consulting the remote time service whenever 99e8636dfdSBill Paulresynchronization 100c6ff3a1bSSheldon Hearnis required. 1012efeeba5SRuslan ErmilovThis argument is usually the 102e8636dfdSBill Pauladdress of the 103125c8263SPhilippe Charnier.Tn RPC 104c6ff3a1bSSheldon Hearnserver itself. 1052efeeba5SRuslan ErmilovThe final argument 106125c8263SPhilippe Charnier.Fa ckey 107e8636dfdSBill Paulis also optional. If it is 108125c8263SPhilippe Charnier.Dv NULL , 109e8636dfdSBill Paulthen the authentication system will 110e8636dfdSBill Paulgenerate a random 111125c8263SPhilippe Charnier.Tn DES 112e8636dfdSBill Paulkey to be used for the encryption of credentials. 113e8636dfdSBill PaulIf it is supplied, however, then it will be used instead. 114125c8263SPhilippe Charnier.Pp 1151fae73b1SRuslan ErmilovThe 1161fae73b1SRuslan Ermilov.Fn authdes_getucred 1171fae73b1SRuslan Ermilovfunction, 118e8636dfdSBill Paulthe second of the two 119125c8263SPhilippe Charnier.Tn DES 120e8636dfdSBill Paulauthentication routines, 121e8636dfdSBill Paulis used on the server side for converting a 122125c8263SPhilippe Charnier.Tn DES 123e8636dfdSBill Paulcredential, which is 124e8636dfdSBill Pauloperating system independent, into a 125125c8263SPhilippe Charnier.Ux 126c6ff3a1bSSheldon Hearncredential. 127c6ff3a1bSSheldon HearnThis routine differs from utility routine 128125c8263SPhilippe Charnier.Fn netname2user 129e8636dfdSBill Paulin that 130125c8263SPhilippe Charnier.Fn authdes_getucred 131e8636dfdSBill Paulpulls its information from a cache, and does not have to do a 132e8636dfdSBill PaulYellow Pages lookup every time it is called to get its information. 133125c8263SPhilippe Charnier.Pp 1341fae73b1SRuslan ErmilovThe 1351fae73b1SRuslan Ermilov.Fn getnetname 1361fae73b1SRuslan Ermilovfunction 137125c8263SPhilippe Charnierinstalls the unique, operating-system independent netname of 138125c8263SPhilippe Charnierthe 139125c8263SPhilippe Charniercaller in the fixed-length array 140125c8263SPhilippe Charnier.Fa name . 141125c8263SPhilippe CharnierReturns 142125c8263SPhilippe Charnier.Dv TRUE 143e8636dfdSBill Paulif it succeeds and 144125c8263SPhilippe Charnier.Dv FALSE 145125c8263SPhilippe Charnierif it fails. 146125c8263SPhilippe Charnier.Pp 1471fae73b1SRuslan ErmilovThe 1481fae73b1SRuslan Ermilov.Fn host2netname 1491fae73b1SRuslan Ermilovfunction 150125c8263SPhilippe Charnierconverts from a domain-specific hostname to an 151c6ff3a1bSSheldon Hearnoperating-system independent netname. 152c6ff3a1bSSheldon HearnReturns 153125c8263SPhilippe Charnier.Dv TRUE 154125c8263SPhilippe Charnierif it succeeds and 155125c8263SPhilippe Charnier.Dv FALSE 156c6ff3a1bSSheldon Hearnif it fails. 157c6ff3a1bSSheldon HearnInverse of 158125c8263SPhilippe Charnier.Fn netname2host . 159125c8263SPhilippe Charnier.Pp 1601fae73b1SRuslan ErmilovThe 1611fae73b1SRuslan Ermilov.Fn key_decryptsession 1621fae73b1SRuslan Ermilovfunction 163e8636dfdSBill Paulis an interface to the keyserver daemon, which is associated 164e8636dfdSBill Paulwith 165125c8263SPhilippe Charnier.Tn RPC Ns 's 16694ba280cSRuslan Ermilovsecure authentication system 16794ba280cSRuslan Ermilov.Tn ( DES 168e8636dfdSBill Paulauthentication). 169e8636dfdSBill PaulUser programs rarely need to call it, or its associated routines 170125c8263SPhilippe Charnier.Fn key_encryptsession , 171125c8263SPhilippe Charnier.Fn key_gendes 172e8636dfdSBill Pauland 173125c8263SPhilippe Charnier.Fn key_setsecret . 174e8636dfdSBill PaulSystem commands such as 175125c8263SPhilippe Charnier.Xr login 1 176e8636dfdSBill Pauland the 177125c8263SPhilippe Charnier.Tn RPC 178e8636dfdSBill Paullibrary are the main clients of these four routines. 179125c8263SPhilippe Charnier.Pp 1801fae73b1SRuslan ErmilovThe 1811fae73b1SRuslan Ermilov.Fn key_decryptsession 1821fae73b1SRuslan Ermilovfunction 183125c8263SPhilippe Charniertakes a server netname and a 184125c8263SPhilippe Charnier.Tn DES 185125c8263SPhilippe Charnierkey, and decrypts the key by 186a910f192SDima Dorfmanusing the public key of the server and the secret key 187e8636dfdSBill Paulassociated with the effective uid of the calling process. It 188e8636dfdSBill Paulis the inverse of 189125c8263SPhilippe Charnier.Fn key_encryptsession . 190125c8263SPhilippe Charnier.Pp 1911fae73b1SRuslan ErmilovThe 1921fae73b1SRuslan Ermilov.Fn key_encryptsession 1931fae73b1SRuslan Ermilovfunction 194c6ff3a1bSSheldon Hearnis a keyserver interface routine. 195c6ff3a1bSSheldon HearnIt 196e8636dfdSBill Paultakes a server netname and a des key, and encrypts 1971d8ffb44SSheldon Hearnit using the public key of the server and the secret key 198e8636dfdSBill Paulassociated with the effective uid of the calling process. It 199e8636dfdSBill Paulis the inverse of 200125c8263SPhilippe Charnier.Fn key_decryptsession . 201125c8263SPhilippe Charnier.Pp 2021fae73b1SRuslan ErmilovThe 2031fae73b1SRuslan Ermilov.Fn key_gendes 2041fae73b1SRuslan Ermilovfunction 205c6ff3a1bSSheldon Hearnis a keyserver interface routine. 206c6ff3a1bSSheldon HearnIt 207e8636dfdSBill Paulis used to ask the keyserver for a secure conversation key. 208125c8263SPhilippe CharnierChoosing one 209125c8263SPhilippe Charnier.Qq random 210125c8263SPhilippe Charnieris usually not good enough, 211e8636dfdSBill Paulbecause 212e8636dfdSBill Paulthe common ways of choosing random numbers, such as using the 213e8636dfdSBill Paulcurrent time, are very easy to guess. 214125c8263SPhilippe Charnier.Pp 2151fae73b1SRuslan ErmilovThe 2161fae73b1SRuslan Ermilov.Fn key_setsecret 2171fae73b1SRuslan Ermilovfunction 218c6ff3a1bSSheldon Hearnis a keyserver interface routine. 219c6ff3a1bSSheldon HearnIt is used to set the key for 220e8636dfdSBill Paulthe effective 221125c8263SPhilippe Charnier.Fa uid 222e8636dfdSBill Paulof the calling process. 223125c8263SPhilippe Charnier.Pp 2241fae73b1SRuslan ErmilovThe 2251fae73b1SRuslan Ermilov.Fn netname2host 2261fae73b1SRuslan Ermilovfunction 227125c8263SPhilippe Charnierconverts from an operating-system independent netname to a 228c6ff3a1bSSheldon Hearndomain-specific hostname. 229c6ff3a1bSSheldon HearnReturns 230125c8263SPhilippe Charnier.Dv TRUE 231e8636dfdSBill Paulif it succeeds and 232125c8263SPhilippe Charnier.Dv FALSE 233e8636dfdSBill Paulif it fails. Inverse of 234125c8263SPhilippe Charnier.Fn host2netname . 235125c8263SPhilippe Charnier.Pp 2361fae73b1SRuslan ErmilovThe 2371fae73b1SRuslan Ermilov.Fn netname2user 2381fae73b1SRuslan Ermilovfunction 239125c8263SPhilippe Charnierconverts from an operating-system independent netname to a 240125c8263SPhilippe Charnierdomain-specific user ID. 241e8636dfdSBill PaulReturns 242125c8263SPhilippe Charnier.Dv TRUE 243e8636dfdSBill Paulif it succeeds and 244125c8263SPhilippe Charnier.Dv FALSE 245c6ff3a1bSSheldon Hearnif it fails. 246c6ff3a1bSSheldon HearnInverse of 247125c8263SPhilippe Charnier.Fn user2netname . 248125c8263SPhilippe Charnier.Pp 2491fae73b1SRuslan ErmilovThe 2501fae73b1SRuslan Ermilov.Fn user2netname 2511fae73b1SRuslan Ermilovfunction 252125c8263SPhilippe Charnierconverts from a domain-specific username to an operating-system 253c6ff3a1bSSheldon Hearnindependent netname. 254c6ff3a1bSSheldon HearnReturns 255125c8263SPhilippe Charnier.Dv TRUE 256e8636dfdSBill Paulif it succeeds and 257125c8263SPhilippe Charnier.Dv FALSE 258c6ff3a1bSSheldon Hearnif it fails. 259c6ff3a1bSSheldon HearnInverse of 260125c8263SPhilippe Charnier.Fn netname2user . 261125c8263SPhilippe Charnier.Sh SEE ALSO 262125c8263SPhilippe Charnier.Xr rpc 3 , 263125c8263SPhilippe Charnier.Xr xdr 3 , 264125c8263SPhilippe Charnier.Xr keyserv 8 265125c8263SPhilippe Charnier.Pp 266e8636dfdSBill PaulThe following manuals: 267125c8263SPhilippe Charnier.Rs 268125c8263SPhilippe Charnier.%B Remote Procedure Calls: Protocol Specification 269125c8263SPhilippe Charnier.Re 270125c8263SPhilippe Charnier.Rs 271125c8263SPhilippe Charnier.%B Remote Procedure Call Programming Guide 272125c8263SPhilippe Charnier.Re 273125c8263SPhilippe Charnier.Rs 274125c8263SPhilippe Charnier.%B Rpcgen Programming Guide 275125c8263SPhilippe Charnier.Re 276125c8263SPhilippe Charnier.Rs 277125c8263SPhilippe Charnier.%B RPC: Remote Procedure Call Protocol Specification 278125c8263SPhilippe Charnier.%O RFC1050, Sun Microsystems Inc., USC-ISI 279125c8263SPhilippe Charnier.Re 280