xref: /dflybsd-src/lib/libc/rpc/rpc_secure.3 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino.\" @(#)rpc_secure.3n	2.1 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
286d7f5d3SJohn Marino.\" $FreeBSD: src/lib/libc/rpc/rpc_secure.3,v 1.6.2.5 2001/12/14 18:33:57 ru Exp $
386d7f5d3SJohn Marino.\" $DragonFly: src/lib/libc/rpc/rpc_secure.3,v 1.4 2007/11/23 23:16:36 swildner Exp $
486d7f5d3SJohn Marino.\"
586d7f5d3SJohn Marino.Dd February 16, 1988
686d7f5d3SJohn Marino.Dt RPC 3
786d7f5d3SJohn Marino.Os
886d7f5d3SJohn Marino.Sh NAME
986d7f5d3SJohn Marino.Nm rpc_secure
1086d7f5d3SJohn Marino.Nd library routines for secure remote procedure calls
1186d7f5d3SJohn Marino.Sh LIBRARY
1286d7f5d3SJohn Marino.Lb libc
1386d7f5d3SJohn Marino.Sh SYNOPSIS
1486d7f5d3SJohn Marino.In rpc/rpc.h
1586d7f5d3SJohn Marino.Ft AUTH *
1686d7f5d3SJohn Marino.Fo authdes_create
1786d7f5d3SJohn Marino.Fa "char *name"
1886d7f5d3SJohn Marino.Fa "unsigned window"
1986d7f5d3SJohn Marino.Fa "struct sockaddr *addr"
2086d7f5d3SJohn Marino.Fa "des_block *ckey"
2186d7f5d3SJohn Marino.Fc
2286d7f5d3SJohn Marino.Ft int
2386d7f5d3SJohn Marino.Fn authdes_getucred "struct authdes_cred *adc" "uid_t *uid" "gid_t *gid" "int *grouplen" "gid_t *groups"
2486d7f5d3SJohn Marino.Ft int
2586d7f5d3SJohn Marino.Fn getnetname "char *name"
2686d7f5d3SJohn Marino.Ft int
2786d7f5d3SJohn Marino.Fn host2netname "char *name" "const char *host" "const char *domain"
2886d7f5d3SJohn Marino.Ft int
2986d7f5d3SJohn Marino.Fn key_decryptsession "const char *remotename" "des_block *deskey"
3086d7f5d3SJohn Marino.Ft int
3186d7f5d3SJohn Marino.Fn key_encryptsession "const char *remotename" "des_block *deskey"
3286d7f5d3SJohn Marino.Ft int
3386d7f5d3SJohn Marino.Fn key_gendes "des_block *deskey"
3486d7f5d3SJohn Marino.Ft int
3586d7f5d3SJohn Marino.Fn key_setsecret "const char *key"
3686d7f5d3SJohn Marino.Ft int
3786d7f5d3SJohn Marino.Fn netname2host "char *name" "char *host" "int hostlen"
3886d7f5d3SJohn Marino.Ft int
3986d7f5d3SJohn Marino.Fn netname2user "char *name" "uid_t *uidp" "gid_t *gidp" "int *gidlenp" "gid_t *gidlist"
4086d7f5d3SJohn Marino.Ft int
4186d7f5d3SJohn Marino.Fn user2netname "char *name" "const uid_t uid" "const char *domain"
4286d7f5d3SJohn Marino.Sh DESCRIPTION
4386d7f5d3SJohn MarinoThese routines are part of the
4486d7f5d3SJohn Marino.Tn RPC
4586d7f5d3SJohn Marinolibrary.  They implement
4686d7f5d3SJohn Marino.Tn DES
4786d7f5d3SJohn MarinoAuthentication.  See
4886d7f5d3SJohn Marino.Xr rpc 3
4986d7f5d3SJohn Marinofor further details about
5086d7f5d3SJohn Marino.Tn RPC .
5186d7f5d3SJohn Marino.Pp
5286d7f5d3SJohn MarinoThe
5386d7f5d3SJohn Marino.Fn authdes_create
5486d7f5d3SJohn Marinois the first of two routines which interface to the
5586d7f5d3SJohn Marino.Tn RPC
5686d7f5d3SJohn Marinosecure authentication system, known as
5786d7f5d3SJohn Marino.Tn DES
5886d7f5d3SJohn Marinoauthentication.
5986d7f5d3SJohn MarinoThe second is
6086d7f5d3SJohn Marino.Fn authdes_getucred ,
6186d7f5d3SJohn Marinobelow.
6286d7f5d3SJohn Marino.Pp
6386d7f5d3SJohn MarinoNote: the keyserver daemon
6486d7f5d3SJohn Marino.Xr keyserv 8
6586d7f5d3SJohn Marinomust be running for the
6686d7f5d3SJohn Marino.Tn DES
6786d7f5d3SJohn Marinoauthentication system to work.
6886d7f5d3SJohn Marino.Pp
6986d7f5d3SJohn Marino.Fn Authdes_create ,
7086d7f5d3SJohn Marinoused on the client side, returns an authentication handle that
7186d7f5d3SJohn Marinowill enable the use of the secure authentication system.
7286d7f5d3SJohn MarinoThe first parameter
7386d7f5d3SJohn Marino.Fa name
7486d7f5d3SJohn Marinois the network name, or
7586d7f5d3SJohn Marino.Fa netname ,
7686d7f5d3SJohn Marinoof the owner of the server process.
7786d7f5d3SJohn MarinoThis field usually
7886d7f5d3SJohn Marinorepresents a
7986d7f5d3SJohn Marino.Fa hostname
8086d7f5d3SJohn Marinoderived from the utility routine
8186d7f5d3SJohn Marino.Fn host2netname ,
8286d7f5d3SJohn Marinobut could also represent a user name using
8386d7f5d3SJohn Marino.Fn user2netname .
8486d7f5d3SJohn MarinoThe second field is window on the validity of
8586d7f5d3SJohn Marinothe client credential, given in seconds.  A small
8686d7f5d3SJohn Marinowindow is more secure than a large one, but choosing
8786d7f5d3SJohn Marinotoo small of a window will increase the frequency of
8886d7f5d3SJohn Marinoresynchronizations because of clock drift.
8986d7f5d3SJohn MarinoThe third
9086d7f5d3SJohn Marinoparameter
9186d7f5d3SJohn Marino.Fa addr
9286d7f5d3SJohn Marinois optional.  If it is
9386d7f5d3SJohn Marino.Dv NULL ,
9486d7f5d3SJohn Marinothen the authentication system will assume
9586d7f5d3SJohn Marinothat the local clock is always in sync with the server's
9686d7f5d3SJohn Marinoclock, and will not attempt resynchronizations.
9786d7f5d3SJohn MarinoIf an address
9886d7f5d3SJohn Marinois supplied, however, then the system will use the address
9986d7f5d3SJohn Marinofor consulting the remote time service whenever
10086d7f5d3SJohn Marinoresynchronization
10186d7f5d3SJohn Marinois required.
10286d7f5d3SJohn MarinoThis parameter is usually the
10386d7f5d3SJohn Marinoaddress of the
10486d7f5d3SJohn Marino.Tn RPC
10586d7f5d3SJohn Marinoserver itself.
10686d7f5d3SJohn MarinoThe final parameter
10786d7f5d3SJohn Marino.Fa ckey
10886d7f5d3SJohn Marinois also optional.  If it is
10986d7f5d3SJohn Marino.Dv NULL ,
11086d7f5d3SJohn Marinothen the authentication system will
11186d7f5d3SJohn Marinogenerate a random
11286d7f5d3SJohn Marino.Tn DES
11386d7f5d3SJohn Marinokey to be used for the encryption of credentials.
11486d7f5d3SJohn MarinoIf it is supplied, however, then it will be used instead.
11586d7f5d3SJohn Marino.Pp
11686d7f5d3SJohn Marino.Fn Authdes_getucred ,
11786d7f5d3SJohn Marinothe second of the two
11886d7f5d3SJohn Marino.Tn DES
11986d7f5d3SJohn Marinoauthentication routines,
12086d7f5d3SJohn Marinois used on the server side for converting a
12186d7f5d3SJohn Marino.Tn DES
12286d7f5d3SJohn Marinocredential, which is
12386d7f5d3SJohn Marinooperating system independent, into a
12486d7f5d3SJohn Marino.Ux
12586d7f5d3SJohn Marinocredential.
12686d7f5d3SJohn MarinoThis routine differs from utility routine
12786d7f5d3SJohn Marino.Fn netname2user
12886d7f5d3SJohn Marinoin that
12986d7f5d3SJohn Marino.Fn authdes_getucred
13086d7f5d3SJohn Marinopulls its information from a cache, and does not have to do a
13186d7f5d3SJohn MarinoYellow Pages lookup every time it is called to get its information.
13286d7f5d3SJohn Marino.Pp
13386d7f5d3SJohn Marino.Fn Getnetname
13486d7f5d3SJohn Marinoinstalls the unique, operating-system independent netname of
13586d7f5d3SJohn Marinothe
13686d7f5d3SJohn Marinocaller in the fixed-length array
13786d7f5d3SJohn Marino.Fa name .
13886d7f5d3SJohn MarinoReturns
13986d7f5d3SJohn Marino.Dv TRUE
14086d7f5d3SJohn Marinoif it succeeds and
14186d7f5d3SJohn Marino.Dv FALSE
14286d7f5d3SJohn Marinoif it fails.
14386d7f5d3SJohn Marino.Pp
14486d7f5d3SJohn Marino.Fn Host2netname
14586d7f5d3SJohn Marinoconverts from a domain-specific hostname to an
14686d7f5d3SJohn Marinooperating-system independent netname.
14786d7f5d3SJohn MarinoReturns
14886d7f5d3SJohn Marino.Dv TRUE
14986d7f5d3SJohn Marinoif it succeeds and
15086d7f5d3SJohn Marino.Dv FALSE
15186d7f5d3SJohn Marinoif it fails.
15286d7f5d3SJohn MarinoInverse of
15386d7f5d3SJohn Marino.Fn netname2host .
15486d7f5d3SJohn Marino.Pp
15586d7f5d3SJohn Marino.Fn Key_decryptsession
15686d7f5d3SJohn Marinois an interface to the keyserver daemon, which is associated
15786d7f5d3SJohn Marinowith
15886d7f5d3SJohn Marino.Tn RPC Ns 's
15986d7f5d3SJohn Marinosecure authentication system
16086d7f5d3SJohn Marino.Tn ( DES
16186d7f5d3SJohn Marinoauthentication).
16286d7f5d3SJohn MarinoUser programs rarely need to call it, or its associated routines
16386d7f5d3SJohn Marino.Fn key_encryptsession ,
16486d7f5d3SJohn Marino.Fn key_gendes
16586d7f5d3SJohn Marinoand
16686d7f5d3SJohn Marino.Fn key_setsecret .
16786d7f5d3SJohn MarinoSystem commands such as
16886d7f5d3SJohn Marino.Xr login 1
16986d7f5d3SJohn Marinoand the
17086d7f5d3SJohn Marino.Tn RPC
17186d7f5d3SJohn Marinolibrary are the main clients of these four routines.
17286d7f5d3SJohn Marino.Pp
17386d7f5d3SJohn Marino.Fn Key_decryptsession
17486d7f5d3SJohn Marinotakes a server netname and a
17586d7f5d3SJohn Marino.Tn DES
17686d7f5d3SJohn Marinokey, and decrypts the key by
17786d7f5d3SJohn Marinousing the public key of the server and the secret key
17886d7f5d3SJohn Marinoassociated with the effective uid of the calling process.  It
17986d7f5d3SJohn Marinois the inverse of
18086d7f5d3SJohn Marino.Fn key_encryptsession .
18186d7f5d3SJohn Marino.Pp
18286d7f5d3SJohn Marino.Fn Key_encryptsession
18386d7f5d3SJohn Marinois a keyserver interface routine.
18486d7f5d3SJohn MarinoIt
18586d7f5d3SJohn Marinotakes a server netname and a des key, and encrypts
18686d7f5d3SJohn Marinoit using the public key of the server and the secret key
18786d7f5d3SJohn Marinoassociated with the effective uid of the calling process.  It
18886d7f5d3SJohn Marinois the inverse of
18986d7f5d3SJohn Marino.Fn key_decryptsession .
19086d7f5d3SJohn Marino.Pp
19186d7f5d3SJohn Marino.Fn Key_gendes
19286d7f5d3SJohn Marinois a keyserver interface routine.
19386d7f5d3SJohn MarinoIt
19486d7f5d3SJohn Marinois used to ask the keyserver for a secure conversation key.
19586d7f5d3SJohn MarinoChoosing one
19686d7f5d3SJohn Marino.Qq random
19786d7f5d3SJohn Marinois usually not good enough,
19886d7f5d3SJohn Marinobecause
19986d7f5d3SJohn Marinothe common ways of choosing random numbers, such as using the
20086d7f5d3SJohn Marinocurrent time, are very easy to guess.
20186d7f5d3SJohn Marino.Pp
20286d7f5d3SJohn Marino.Fn Key_setsecret
20386d7f5d3SJohn Marinois a keyserver interface routine.
20486d7f5d3SJohn MarinoIt is used to set the key for
20586d7f5d3SJohn Marinothe effective
20686d7f5d3SJohn Marino.Fa uid
20786d7f5d3SJohn Marinoof the calling process.
20886d7f5d3SJohn Marino.Pp
20986d7f5d3SJohn Marino.Fn Netname2host
21086d7f5d3SJohn Marinoconverts from an operating-system independent netname to a
21186d7f5d3SJohn Marinodomain-specific hostname.
21286d7f5d3SJohn MarinoReturns
21386d7f5d3SJohn Marino.Dv TRUE
21486d7f5d3SJohn Marinoif it succeeds and
21586d7f5d3SJohn Marino.Dv FALSE
21686d7f5d3SJohn Marinoif it fails.  Inverse of
21786d7f5d3SJohn Marino.Fn host2netname .
21886d7f5d3SJohn Marino.Pp
21986d7f5d3SJohn Marino.Fn Netname2user
22086d7f5d3SJohn Marinoconverts from an operating-system independent netname to a
22186d7f5d3SJohn Marinodomain-specific user ID.
22286d7f5d3SJohn MarinoReturns
22386d7f5d3SJohn Marino.Dv TRUE
22486d7f5d3SJohn Marinoif it succeeds and
22586d7f5d3SJohn Marino.Dv FALSE
22686d7f5d3SJohn Marinoif it fails.
22786d7f5d3SJohn MarinoInverse of
22886d7f5d3SJohn Marino.Fn user2netname .
22986d7f5d3SJohn Marino.Pp
23086d7f5d3SJohn Marino.Fn User2netname
23186d7f5d3SJohn Marinoconverts from a domain-specific username to an operating-system
23286d7f5d3SJohn Marinoindependent netname.
23386d7f5d3SJohn MarinoReturns
23486d7f5d3SJohn Marino.Dv TRUE
23586d7f5d3SJohn Marinoif it succeeds and
23686d7f5d3SJohn Marino.Dv FALSE
23786d7f5d3SJohn Marinoif it fails.
23886d7f5d3SJohn MarinoInverse of
23986d7f5d3SJohn Marino.Fn netname2user .
24086d7f5d3SJohn Marino.Sh SEE ALSO
24186d7f5d3SJohn Marino.Xr rpc 3 ,
24286d7f5d3SJohn Marino.Xr xdr 3 ,
24386d7f5d3SJohn Marino.Xr keyserv 8
24486d7f5d3SJohn Marino.Pp
24586d7f5d3SJohn MarinoThe following manuals:
24686d7f5d3SJohn Marino.Rs
24786d7f5d3SJohn Marino.%B Remote Procedure Calls: Protocol Specification
24886d7f5d3SJohn Marino.Re
24986d7f5d3SJohn Marino.Rs
25086d7f5d3SJohn Marino.%B Remote Procedure Call Programming Guide
25186d7f5d3SJohn Marino.Re
25286d7f5d3SJohn Marino.Rs
25386d7f5d3SJohn Marino.%B Rpcgen Programming Guide
25486d7f5d3SJohn Marino.Re
25586d7f5d3SJohn Marino.Rs
25686d7f5d3SJohn Marino.%B RPC: Remote Procedure Call Protocol Specification
25786d7f5d3SJohn Marino.%O RFC 1050, Sun Microsystems Inc., USC-ISI
25886d7f5d3SJohn Marino.Re
259