xref: /freebsd/crypto/krb5/src/appl/gss-sample/README (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert# Copyright 1993 by OpenVision Technologies, Inc.
2*7f2fe78bSCy Schubert#
3*7f2fe78bSCy Schubert# Permission to use, copy, modify, distribute, and sell this software
4*7f2fe78bSCy Schubert# and its documentation for any purpose is hereby granted without fee,
5*7f2fe78bSCy Schubert# provided that the above copyright notice appears in all copies and
6*7f2fe78bSCy Schubert# that both that copyright notice and this permission notice appear in
7*7f2fe78bSCy Schubert# supporting documentation, and that the name of OpenVision not be used
8*7f2fe78bSCy Schubert# in advertising or publicity pertaining to distribution of the software
9*7f2fe78bSCy Schubert# without specific, written prior permission. OpenVision makes no
10*7f2fe78bSCy Schubert# representations about the suitability of this software for any
11*7f2fe78bSCy Schubert# purpose.  It is provided "as is" without express or implied warranty.
12*7f2fe78bSCy Schubert#
13*7f2fe78bSCy Schubert# OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14*7f2fe78bSCy Schubert# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15*7f2fe78bSCy Schubert# EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16*7f2fe78bSCy Schubert# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
17*7f2fe78bSCy Schubert# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18*7f2fe78bSCy Schubert# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19*7f2fe78bSCy Schubert# PERFORMANCE OF THIS SOFTWARE.
20*7f2fe78bSCy Schubert
21*7f2fe78bSCy SchubertThis directory contains a sample GSS-API client and server
22*7f2fe78bSCy Schubertapplication.  In addition to serving as an example of GSS-API
23*7f2fe78bSCy Schubertprogramming, this application is also intended to be a tool for
24*7f2fe78bSCy Schuberttesting the performance of GSS-API implementations.
25*7f2fe78bSCy Schubert
26*7f2fe78bSCy SchubertEach time the client is invoked, it performs one or more exchanges
27*7f2fe78bSCy Schubertwith the server.  Each exchange with the server consists primarily of
28*7f2fe78bSCy Schubertthe following steps:
29*7f2fe78bSCy Schubert
30*7f2fe78bSCy Schubert	1. A TCP/IP connection is established.
31*7f2fe78bSCy Schubert
32*7f2fe78bSCy Schubert	2. (optional, on by default) The client and server establish a
33*7f2fe78bSCy Schubert	   GSS-API context, and the server prints the identify of the
34*7f2fe78bSCy Schubert	   client.
35*7f2fe78bSCy Schubert
36*7f2fe78bSCy Schubert      /	3. The client sends a message to the server.  The message may
37*7f2fe78bSCy Schubert     /     be plaintext, cryptographically "signed" but not encrypted,
38*7f2fe78bSCy Schubert     |     or encrypted (default).
39*7f2fe78bSCy Schubert     |
40*7f2fe78bSCy Schubert0 or |  4. The server decrypts the message (if necessary), verifies
41*7f2fe78bSCy Schubertmore |     its signature (if there is one) and prints it.
42*7f2fe78bSCy Schuberttimes|
43*7f2fe78bSCy Schubert     |  5. The server sends either a signature block (the default) or an
44*7f2fe78bSCy Schubert     |     empty token back to the client to acknowledge the message.
45*7f2fe78bSCy Schubert     \
46*7f2fe78bSCy Schubert      \ 6. If the server sent a signature block, the client verifies
47*7f2fe78bSCy Schubert           it and prints a message indicating that it was verified.
48*7f2fe78bSCy Schubert
49*7f2fe78bSCy Schubert	7. The client sends an empty block to the server to tell it
50*7f2fe78bSCy Schubert	   that the exchange is finished.
51*7f2fe78bSCy Schubert
52*7f2fe78bSCy Schubert	8. The client and server close the TCP/IP connection and
53*7f2fe78bSCy Schubert	   destroy the GSS-API context.
54*7f2fe78bSCy Schubert
55*7f2fe78bSCy SchubertThe client also supports the -v1 flag which uses an older exchange
56*7f2fe78bSCy Schubertformat compatible with previous releases of Kerberos and with samples
57*7f2fe78bSCy Schubertshipped in the Microsoft SDK.
58*7f2fe78bSCy Schubert
59*7f2fe78bSCy SchubertThe server's command line usage is
60*7f2fe78bSCy Schubert
61*7f2fe78bSCy Schubert	gss-server [-port port] [-verbose] [-once] [-inetd] [-export]
62*7f2fe78bSCy Schubert		[-logfile file] service_name
63*7f2fe78bSCy Schubert
64*7f2fe78bSCy Schubertwhere service_name is a GSS-API service name of the form
65*7f2fe78bSCy Schubert"service@host" (or just "service", in which case the local host name
66*7f2fe78bSCy Schubertis used).  The command-line options have the following meanings:
67*7f2fe78bSCy Schubert
68*7f2fe78bSCy Schubert-port	The TCP port on which to accept connections.  Default is 4444.
69*7f2fe78bSCy Schubert
70*7f2fe78bSCy Schubert-once	Tells the server to exit after a single exchange, rather than
71*7f2fe78bSCy Schubert	persisting.
72*7f2fe78bSCy Schubert
73*7f2fe78bSCy Schubert-inetd	Tells the server that it is running out of inetd, so it should
74*7f2fe78bSCy Schubert	interact with the client on stdin rather than binding to a
75*7f2fe78bSCy Schubert	network port.  Implies "-once".
76*7f2fe78bSCy Schubert
77*7f2fe78bSCy Schubert-export	Tells the server to test the gss_export_sec_context function
78*7f2fe78bSCy Schubert	after establishing a context with a client.
79*7f2fe78bSCy Schubert
80*7f2fe78bSCy Schubert-logfile
81*7f2fe78bSCy Schubert	The file to which the server should append its output, rather
82*7f2fe78bSCy Schubert	than sending it to stdout.
83*7f2fe78bSCy Schubert
84*7f2fe78bSCy SchubertThe client's command line usage is
85*7f2fe78bSCy Schubert
86*7f2fe78bSCy Schubert	gss-client [-port port] [-mech mechanism] [-d] [-f] [-q]
87*7f2fe78bSCy Schubert        [-seq] [-noreplay] [-nomutual] [-dce]
88*7f2fe78bSCy Schubert        [-ccount count] [-mcount count] [-na] [-nw] [-nx] [-nm]
89*7f2fe78bSCy Schubert		host service_name msg
90*7f2fe78bSCy Schubert
91*7f2fe78bSCy Schubertwhere host is the host running the server, service_name is the service
92*7f2fe78bSCy Schubertname that the server will establish connections as (if you don't
93*7f2fe78bSCy Schubertspecify the host name in the service name when running gss-server, and
94*7f2fe78bSCy Schubertit's running on a different machine from gss-client, make sure to
95*7f2fe78bSCy Schubertspecify the server's host name in the service name you specify to
96*7f2fe78bSCy Schubertgss-client!) and msg is the message.  The command-line options have
97*7f2fe78bSCy Schubertthe following meanings:
98*7f2fe78bSCy Schubert
99*7f2fe78bSCy Schubert-port	The TCP port to which to connect.  Default is 4444.
100*7f2fe78bSCy Schubert
101*7f2fe78bSCy Schubert-mech	The OID of the GSS-API mechanism to use.
102*7f2fe78bSCy Schubert
103*7f2fe78bSCy Schubert-d	Tells the client to delegate credentials to the server.  For
104*7f2fe78bSCy Schubert	the Kerberos GSS-API mechanism, this means that a forwardable
105*7f2fe78bSCy Schubert	TGT will be sent to the server, which will put it in its
106*7f2fe78bSCy Schubert	credential cache (you must have acquired your tickets with
107*7f2fe78bSCy Schubert	"kinit -f" for this to work).
108*7f2fe78bSCy Schubert
109*7f2fe78bSCy Schubert-seq Tells the client to enforce ordered message delivery via
110*7f2fe78bSCy Schubert    sequencing.
111*7f2fe78bSCy Schubert
112*7f2fe78bSCy Schubert-noreplay Tells the client to disable the use of replay
113*7f2fe78bSCy Schubert    detection.
114*7f2fe78bSCy Schubert
115*7f2fe78bSCy Schubert-dce	Tells the client to request DCE-style authentication.
116*7f2fe78bSCy Schubert
117*7f2fe78bSCy Schubert-nomutual Tells the client to disable the use of mutual authentication.
118*7f2fe78bSCy Schubert
119*7f2fe78bSCy Schubert-f	Tells the client that the "msg" argument is actually the name
120*7f2fe78bSCy Schubert	of a file whose contents should be used as the message.
121*7f2fe78bSCy Schubert
122*7f2fe78bSCy Schubert-q	Tells the client to be quiet, i.e., to only print error
123*7f2fe78bSCy Schubert	messages.
124*7f2fe78bSCy Schubert
125*7f2fe78bSCy Schubert-ccount	Specifies how many sessions the client should initiate with
126*7f2fe78bSCy Schubert	the server (the "connection count").
127*7f2fe78bSCy Schubert
128*7f2fe78bSCy Schubert-mcount	Specifies how many times the message should be sent to the
129*7f2fe78bSCy Schubert	server in each session (the "message count").
130*7f2fe78bSCy Schubert
131*7f2fe78bSCy Schubert-na	Tells the client not to do any authentication with the
132*7f2fe78bSCy Schubert	server.  Implies "-nw", "-nx" and "-nm".
133*7f2fe78bSCy Schubert
134*7f2fe78bSCy Schubert-nw	Tells the client not to "wrap" messages.  Implies "-nx".
135*7f2fe78bSCy Schubert
136*7f2fe78bSCy Schubert-nx	Tells the client not to encrypt messages.
137*7f2fe78bSCy Schubert
138*7f2fe78bSCy Schubert-nm	Tells the client not to ask the server to send back a
139*7f2fe78bSCy Schubert	cryptographic checksum ("MIC").
140*7f2fe78bSCy Schubert
141*7f2fe78bSCy SchubertTo run the server on a host, you need to make sure that the principal
142*7f2fe78bSCy Schubertcorresponding to service_name is in the default keytab on the server
143*7f2fe78bSCy Schuberthost, and that the gss-server process can read the keytab.  For
144*7f2fe78bSCy Schubertexample, the service name "host@server" corresponds to the Kerberos
145*7f2fe78bSCy Schubertprincipal "host/server.domain.com@REALM".
146*7f2fe78bSCy Schubert
147*7f2fe78bSCy SchubertThis sample application uses the following GSS-API functions:
148*7f2fe78bSCy Schubert
149*7f2fe78bSCy Schubert	gss_accept_sec_context		gss_inquire_names_for_mech
150*7f2fe78bSCy Schubert	gss_acquire_cred		gss_oid_to_str
151*7f2fe78bSCy Schubert	gss_delete_sec_context		gss_release_buffer
152*7f2fe78bSCy Schubert	gss_display_name		gss_release_cred
153*7f2fe78bSCy Schubert	gss_display_status		gss_release_name
154*7f2fe78bSCy Schubert	gss_export_sec_context		gss_release_oid
155*7f2fe78bSCy Schubert	gss_get_mic			gss_release_oid_set
156*7f2fe78bSCy Schubert	gss_import_name			gss_str_to_oid
157*7f2fe78bSCy Schubert	gss_import_sec_context		gss_unwrap
158*7f2fe78bSCy Schubert	gss_init_sec_context		gss_verify_mic
159*7f2fe78bSCy Schubert	gss_inquire_context		gss_wrap
160*7f2fe78bSCy Schubert
161*7f2fe78bSCy SchubertThis application was originally written by Barry Jaspan of OpenVision
162*7f2fe78bSCy SchubertTechnologies, Inc.  It was updated significantly by Jonathan Kamens of
163*7f2fe78bSCy SchubertOpenVision Technologies, Inc.
164*7f2fe78bSCy Schubert
165*7f2fe78bSCy Schubert$Id$
166