Document proxy/forwarded tickets.
[shishi.git] / doc / shishi.texi
blob56f078e78ef6ce857790889835b43751ca809b3b
1 \input texinfo                  @c -*- Texinfo -*-
2 @c Copyright (C) 2002, 2003 Simon Josefsson
3 @c
4 @c This file is part of the shishi
5 @c Permission is granted to copy, distribute and/or modify this document
6 @c under the terms of the GNU Free Documentation License, Version 1.1
7 @c or any later version published by the Free Software Foundation;
8 @c with the Invariant Sections being with no Invariant Sections, with the
9 @c no Front-Cover Texts, and with the no Back-Cover Texts.
10 @c A copy of the license is included in the section entitled ``GNU
11 @c Free Documentation License'' in the file 'fdl.texi'.
13 @setfilename shishi.info
14 @include version.texi
15 @settitle The Shishi Manual
17 @c Unify some of the indices.
18 @syncodeindex tp fn
19 @syncodeindex pg fn
21 @copying
22 This is @cite{The Shishi Manual}, last updated @value{UPDATED}, for
23 Version @value{VERSION} of Shishi.
25 Copyright @copyright{} 2002, 2003 Simon Josefsson.
27 @quotation
28 Permission is granted to copy, distribute and/or modify this document
29 under the terms of the GNU Free Documentation License, Version 1.1 or
30 any later version published by the Free Software Foundation; with no
31 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
32 and with the Back-Cover Texts as in (a) below.  A copy of the license
33 is included in the section entitled ``GNU Free Documentation
34 License.''
36 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and
37 modify this GNU Manual, like GNU software.  Copies published by the
38 Free Software Foundation raise funds for GNU development.''
39 @end quotation
40 @end copying
42 @dircategory Net Utilities
43 @direntry
44 * shishi: (shishi).             A Kerberos 5 implementation
45 @end direntry
47 @titlepage
48 @title The Shishi Manual
49 @subtitle for version @value{VERSION}, @value{UPDATED}
50 @author Simon Josefsson (@email{bug-shishi@@josefsson.org})
51 @page
52 @vskip 0pt plus 1filll
53 @insertcopying
54 @end titlepage
56 @contents
58 @ifnottex
59 @node Top
60 @top Shishi
61 @insertcopying
62 @end ifnottex
64 @menu
65 * Introduction::                How to use this manual.
66 * User Manual::                 Using Shishi as end-user.
67 * Administration Manual::       Administrating server aspects of Shishi.
68 * Reference Manual::            Detailed description of config files, etc.
69 * Programming Manual::          Calling Shishi from a programming language.
70 * Acknowledgements::            Whom to blame.
72 Appendices
74 * Copying This Manual::         How you can copy and share this manual.
75 * Copying::                     How you can copy and share the source.
77 Indices
79 * Concept Index::               Index of concepts and programs.
80 * Function and Data Index::     Index of functions, variables and data types.
81 @end menu
84 @c **********************************************************
85 @c ********************  Introduction  **********************
86 @c **********************************************************
87 @node Introduction
88 @chapter Introduction
90 Shishi implements the Kerberos 5 network security system.
92 @menu
93 * Getting Started::
94 * Features and Status::
95 * Overview::
96 * Cryptographic Overview::
97 * Supported Platforms::
98 * Downloading and Installing::
99 * Bug Reports::
100 * Contributing::
101 @end menu
103 @node Getting Started
104 @section Getting Started
106 This manual documents the Shishi application and library programming
107 interface.  All commands, functions and data types provided by Shishi
108 are explained.
110 The reader is assumed to possess basic familiarity with network
111 security and the Kerberos 5 security system.
113 This manual can be used in several ways.  If read from the beginning
114 to the end, it gives a good introduction into the library and how it
115 can be used in an application.  Forward references are included where
116 necessary.  Later on, the manual can be used as a reference manual to
117 get just the information needed about any particular interface of the
118 library.  Experienced programmers might want to start looking at the
119 examples at the end of the manual, and then only read up those parts
120 of the interface which are unclear.
122 @node Features and Status
123 @section Features and Status
125 Shishi might have a couple of advantages over other packages doing a
126 similar job.
128 @table @asis
129 @item It's Free Software
130 Anybody can use, modify, and redistribute it under the terms of the GNU
131 General Public License (@pxref{Copying}).
133 @item It's thread-safe
134 The library uses no global variables.
136 @item It's internationalized
137 It handles non-ASCII username and passwords and user visible strings
138 used in the library (error messages) can be translated into the users'
139 language.
141 @item It's portable
142 It should work on all Unix like operating systems, including Windows.
144 @end table
146 Shishi is far from feature complete, it is not even a full RFC 1510
147 implementation yet.  However, some basic functionality is implemented.
148 A few implemented feature are mentioned below.
150 @itemize @bullet
152 @item Initial authentication (AS) from raw key or password.
153 This step is typically used to acquire a ticket granting ticket and,
154 less commonly, a server ticket.
156 @item Subsequent authentication (TGS).
157 This step is typically used to acquire a server ticket, by
158 authenticating yourself using the ticket granting ticket.
160 @item Client-Server authentication (AP).
161 This step is used by clients and servers to prove to each other who
162 they are, using negotiated tickets.
164 @item Integrity protected communication (SAFE).
165 This step is used by clients and servers to exchange integrity
166 protected data with each other.  The key is typically agreed on using
167 the Client-Server authentication step.
169 @item Ticket cache, supporting multiple principals and realms.
170 As tickets have a life time of typically several hours, they are
171 managed in disk files.  There can be multiple ticket caches, and each
172 ticket cache can store tickets for multiple clients (users), servers,
173 encryption types, etc.  Functionality is provided for locating the
174 proper ticket for every use.
176 @item Most standard cryptographic primitives.
177 The believed most secure algorithms are supported
178 (@pxref{Cryptographic Overview}).
180 @item Telnet client and server.
181 This is used to remotely login to other machines, after authenticating
182 yourself with a ticket.
184 @item PAM module.
185 This is used to login locally on a machine.
187 @item KDC addresses located using DNS SRV RRs.
189 @item Modularized low-level crypto interface.
190 Currently Nettle and Libgcrypt are supported.  If you wish to add
191 support for another low-level cryptographic library, you only have to
192 implement a few APIs to DES, AES, MD5, SHA1, HMAC, etc, look at
193 @file{lib/nettle.c} or @file{lib/libgcrypt.c} as a starting pointer.
195 @end itemize
197 The following table summarize what the current objectives are (i.e.,
198 the todo list) and an estimate on how long it will take to implement
199 the feature.  If you like to start working on anything, please let me
200 know so work duplication can be avoided.
202 @itemize @bullet
204 @item Pre-authentication support (week).
206 @item Cross-realm support (week).
208 @item PKINIT (use libksba, weeks)
210 @item Finish GSSAPI support via GSSLib (weeks)
211 Shishi will not support GSSLib natively, but a separate project
212 ``GSSLib'' is under way to produce a generic GSS implementation, and
213 it will use Shishi to implement the Kerberos 5 mechanism.
215 @item Port to cyclone (cyclone need to mature first)
217 @item Modularize ASN.1 library so it can be replaced (days).
218 Almost done, all ASN.1 functionality is found in lib/asn1.c, although
219 the interface is rather libtasn1 centric.
221 @item KDC (initiated, weeks)
223 @item Set/Change password protocol (weeks?)
225 @item Port applications to use Shishi (indefinite)
227 @item Improve documentation
229 @item Improve internationalization
231 @item Add AP-REQ replay cache (week).
233 @item Study benefits by introducing a PA-TGS-REP.
234 This would provide mutual authentication of the KDC in a way that is
235 easier to analyze.  Currently the mutual authentication property is
236 only implicit from successful decryption of the KDC-REP and the 4 byte
237 nonce.
239 @end itemize
241 @node Overview
242 @section Overview
244 This section describes RFC 1510 from a protocol point of
245 view@footnote{The text is a lightly adapted version of the
246 introduction section from RFC 1510 by J. Kohl and C. Neuman, September
247 1993, unclear copyrights, but presumably owned by The Internet
248 Society.}.
250 Kerberos provides a means of verifying the identities of principals,
251 (e.g., a workstation user or a network server) on an open
252 (unprotected) network.  This is accomplished without relying on
253 authentication by the host operating system, without basing trust on
254 host addresses, without requiring physical security of all the hosts
255 on the network, and under the assumption that packets traveling along
256 the network can be read, modified, and inserted at will. (Note,
257 however, that many applications use Kerberos' functions only upon the
258 initiation of a stream-based network connection, and assume the
259 absence of any "hijackers" who might subvert such a connection.  Such
260 use implicitly trusts the host addresses involved.)  Kerberos performs
261 authentication under these conditions as a trusted third- party
262 authentication service by using conventional cryptography, i.e.,
263 shared secret key.  (shared secret key - Secret and private are often
264 used interchangeably in the literature.  In our usage, it takes two
265 (or more) to share a secret, thus a shared DES key is a secret key.
266 Something is only private when no one but its owner knows it.  Thus,
267 in public key cryptosystems, one has a public and a private key.)
269 The authentication process proceeds as follows: A client sends a
270 request to the authentication server (AS) requesting "credentials" for
271 a given server.  The AS responds with these credentials, encrypted in
272 the client's key.  The credentials consist of 1) a "ticket" for the
273 server and 2) a temporary encryption key (often called a "session
274 key").  The client transmits the ticket (which contains the client's
275 identity and a copy of the session key, all encrypted in the server's
276 key) to the server.  The session key (now shared by the client and
277 server) is used to authenticate the client, and may optionally be used
278 to authenticate the server.  It may also be used to encrypt further
279 communication between the two parties or to exchange a separate
280 sub-session key to be used to encrypt further communication.
282 The implementation consists of one or more authentication servers
283 running on physically secure hosts.  The authentication servers
284 maintain a database of principals (i.e., users and servers) and their
285 secret keys. Code libraries provide encryption and implement the
286 Kerberos protocol.  In order to add authentication to its
287 transactions, a typical network application adds one or two calls to
288 the Kerberos library, which results in the transmission of the
289 necessary messages to achieve authentication.
291 The Kerberos protocol consists of several sub-protocols (or
292 exchanges).  There are two methods by which a client can ask a
293 Kerberos server for credentials.  In the first approach, the client
294 sends a cleartext request for a ticket for the desired server to the
295 AS. The reply is sent encrypted in the client's secret key. Usually
296 this request is for a ticket-granting ticket (TGT) which can later be
297 used with the ticket-granting server (TGS).  In the second method, the
298 client sends a request to the TGS.  The client sends the TGT to the
299 TGS in the same manner as if it were contacting any other application
300 server which requires Kerberos credentials.  The reply is encrypted in
301 the session key from the TGT.
303 Once obtained, credentials may be used to verify the identity of the
304 principals in a transaction, to ensure the integrity of messages
305 exchanged between them, or to preserve privacy of the messages.  The
306 application is free to choose whatever protection may be necessary.
308 To verify the identities of the principals in a transaction, the
309 client transmits the ticket to the server.  Since the ticket is sent
310 "in the clear" (parts of it are encrypted, but this encryption doesn't
311 thwart replay) and might be intercepted and reused by an attacker,
312 additional information is sent to prove that the message was
313 originated by the principal to whom the ticket was issued.  This
314 information (called the authenticator) is encrypted in the session
315 key, and includes a timestamp.  The timestamp proves that the message
316 was recently generated and is not a replay.  Encrypting the
317 authenticator in the session key proves that it was generated by a
318 party possessing the session key.  Since no one except the requesting
319 principal and the server know the session key (it is never sent over
320 the network in the clear) this guarantees the identity of the client.
322 The integrity of the messages exchanged between principals can also be
323 guaranteed using the session key (passed in the ticket and contained
324 in the credentials).  This approach provides detection of both replay
325 attacks and message stream modification attacks.  It is accomplished
326 by generating and transmitting a collision-proof checksum (elsewhere
327 called a hash or digest function) of the client's message, keyed with
328 the session key.  Privacy and integrity of the messages exchanged
329 between principals can be secured by encrypting the data to be passed
330 using the session key passed in the ticket, and contained in the
331 credentials.
333 @node Cryptographic Overview
334 @section Cryptographic Overview
336 Shishi implements several of the standard cryptographic primitives.
337 Here are the names of the supported encryption suites, with some notes
338 on their status and there associated checksum suite.  They are ordered
339 by increased security as perceived by the author.
341 @cindex DES
342 @cindex 3DES
343 @cindex AES
345 @table @code
347 @item NULL
349 @code{NULL} is a dummy encryption suite for debugging.  Encryption and
350 decryption are identity functions.  No integrity protection.  It is
351 weak.  It is associated with the @code{NULL} checksum.
353 @item des-cbc-crc
355 @code{des-cbc-crc} is DES encryption and decryption with 56 bit keys
356 and 8 byte blocks in CBC mode. The keys can be derived from passwords
357 by an obscure application specific algorithm. Data is integrity
358 protected with an unkeyed but encrypted @code{CRC32}-like checksum.
359 It is weak. It is associated with the @code{rsa-md5-des} checksum.
361 @item des-cbc-md4
363 @code{des-cbc-md4} is DES encryption and decryption with 56 bit keys
364 and 8 byte blocks in CBC mode. The keys can be derived from passwords
365 by an obscure application specific algorithm. Data is integrity
366 protected with an unkeyed but encrypted MD4 hash.  It is weak. It is
367 associated with the @code{rsa-md4-des} checksum.
369 @item des-cbc-md5
371 @code{des-cbc-md5} is DES encryption and decryption with 56 bit keys
372 and 8 byte blocks in CBC mode.  The keys can be derived from passwords
373 by an obscure application specific algorithm. Data is integrity
374 protected with an unkeyed but encrypted MD5 hash.  It is weak.  It is
375 associated with the @code{rsa-md5-des} checksum.  This is the
376 strongest RFC 1510 interoperable mechanism.
378 @item des3-cbc-sha1-kd
380 @code{des3-cbc-sha1-kd} is DES encryption and decryption with three 56
381 bit keys (effective key size 112 bits) and 8 byte blocks in CBC
382 mode. The keys can be derived from passwords by a algorithm based on
383 the paper "A Better Key Schedule For DES-like Ciphers"
384 @footnote{@url{http://www.research.att.com/~smb/papers/ides.pdf}} by
385 Uri Blumenthal and Steven M. Bellovin (it is not clear if the
386 algorithm, and the way it is used, is used by any other protocols,
387 although it seems unlikely).  Data is integrity protected with a keyed
388 SHA1 hash in HMAC mode.  It has no security proof, but is assumed to
389 provide adequate security in the sense that knowledge on how to crack
390 it is not known to the public.  Note that the key derivation function
391 is not widely used outside of Kerberos, hence not widely studied.  It
392 is associated with the @code{hmac-sha1-des3-kd} checksum.
394 @item aes128-cts-hmac-sha1-96
395 @item aes256-cts-hmac-sha1-96.
397 @code{aes128-cts-hmac-sha1-96} and @code{aes256-cts-hmac-sha1-96} is
398 AES encryption and decryption with 128 bit and 256 bit key,
399 respectively, and 16 byte blocks in CBC mode with Cipher Text
400 Stealing.  Cipher Text Stealing means data length of encrypted data is
401 preserved (pure CBC add up to 7 pad characters).  The keys can be
402 derived from passwords with RSA Laboratories PKCS#5 Password Based Key
403 Derivation Function
404 2@footnote{@url{http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/}},
405 which is allegedly provably secure in a random oracle model.  Data is
406 integrity protected with a keyed SHA1 hash, in HMAC mode, truncated to
407 96 bits.  There is no security proof, but the schemes are assumed to
408 provide adequate security in the sense that knowledge on how to crack
409 them is not known to the public.  Note that AES has yet to receive the
410 test of time, and the CBC variation used is not widely standardized
411 (hence not widely studied).  It is associated with the
412 @code{hmac-sha1-96-aes128} and @code{hmac-sha1-96-aes256} checksums,
413 respectively.
415 @end table
417 The protocol do not include any way to negotiate which checksum
418 mechanisms to use, so in most cases the associated checksum will be
419 used.  However, checksum mechanisms can be used with other encryption
420 mechanisms, as long as they are compatible in terms of key format etc.
421 Here are the names of the supported checksum mechanisms, with some
422 notes on their status and the compatible encryption mechanisms. They
423 are ordered by increased security as perceived by the author.
425 @table @code
427 @item NULL
429 @code{NULL} is a dummy checksum suite for debugging.  It provides no
430 integrity.  It is weak.  It is compatible with the @code{NULL}
431 encryption mechanism.
433 @item rsa-md4
435 @code{rsa-md4} is a unkeyed MD4 hash computed over the message.  Since
436 it is unkeyed, it is in general a weak checksum, however applications
437 can, with care, use it non-weak ways (e.g., by including the hash in
438 other messages that are encrypted or checksummed).  It is compatible
439 with all encryption mechanisms.
441 @item rsa-md4-des
443 @code{rsa-md4-des} is a DES CBC encryption of one block of random data
444 and a unkeyed MD4 hash computed over the random data and the message
445 to integrity protect.  The key used is derived from the base protocol
446 key by XOR with a constant.  It is weak. It is compatible with the
447 @code{des-cbc-crc}, @code{des-cbc-md4}, @code{des-cbc-md5} encryption
448 mechanisms.
450 @item rsa-md5
452 @code{rsa-md5} is a unkeyed MD5 hash computed over the message.  Since
453 it is unkeyed, it is in general a weak checksum, however applications
454 can, with care, use it non-weak ways (e.g., by including the hash in
455 other messages that are encrypted or checksummed).  It is compatible
456 with all encryption mechanisms.
458 @item rsa-md5-des
460 @code{rsa-md5-des} is a DES CBC encryption of one block of random data
461 and a unkeyed MD5 hash computed over the random data and the message
462 to integrity protect.  The key used is derived from the base protocol
463 key by XOR with a constant.  It is weak.  It is compatible with the
464 @code{des-cbc-crc}, @code{des-cbc-md4}, @code{des-cbc-md5} encryption
465 mechanisms.
467 @item hmac-sha1-des3-kd
469 @code{hmac-sha1-des3-kd} is a keyed SHA1 hash in HMAC mode computed
470 over the message.  The key is derived from the base protocol by the
471 simplified key derivation function (similar to the password key
472 derivation functions of @code{des3-cbc-sha1-kd}).  It has no security
473 proof, but is assumed to provide good security, if the key derivation
474 function is good.  It is compatible with the @code{des3-cbc-sha1-kd}
475 encryption mechanism.
477 @item hmac-sha1-96-aes128
478 @item hmac-sha1-96-aes256
480 @code{hmac-sha1-96-aes*} are keyed SHA1 hashes in HMAC mode computed
481 over the message and then truncated to 96 bits.  The key is derived
482 from the base protocol by the simplified key derivation function
483 (similar to the password key derivation functions of
484 @code{des3-cbc-sha1-kd}).  It has no security proof, but is assumed to
485 provide good security, if the key derivation function is good.  It is
486 compatible with the @code{aes*-cts-hmac-sha1-96} encryption
487 mechanisms.
489 @end table
492 @node Supported Platforms
493 @section Supported Platforms
495 Shishi has at some point in time been tested on the following
496 platforms.  Online build reports for each platforms and Shishi version
497 is available at @url{http://josefsson.org/autobuild/}.
499 @enumerate
501 @item Debian GNU/Linux 3.0 (Woody)
502 @cindex Debian
504 GCC 2.95.4 and GNU Make. This is the main development platform.
505 @code{alphaev67-unknown-linux-gnu}, @code{alphaev6-unknown-linux-gnu},
506 @code{arm-unknown-linux-gnu}, @code{armv4l-unknown-linux-gnu},
507 @code{hppa-unknown-linux-gnu}, @code{hppa64-unknown-linux-gnu},
508 @code{i686-pc-linux-gnu}, @code{ia64-unknown-linux-gnu},
509 @code{m68k-unknown-linux-gnu}, @code{mips-unknown-linux-gnu},
510 @code{mipsel-unknown-linux-gnu}, @code{powerpc-unknown-linux-gnu},
511 @code{s390-ibm-linux-gnu}, @code{sparc-unknown-linux-gnu},
512 @code{sparc64-unknown-linux-gnu}.
514 @item Debian GNU/Linux 2.1
515 @cindex Debian
517 GCC 2.95.4 and GNU Make. @code{armv4l-unknown-linux-gnu}.
519 @item Tru64 UNIX
520 @cindex Tru64
522 Tru64 UNIX C compiler and Tru64 Make. @code{alphaev67-dec-osf5.1},
523 @code{alphaev68-dec-osf5.1}.
525 @item SuSE Linux 7.1
526 @cindex SuSE
528 GCC 2.96 and GNU Make. @code{alphaev6-unknown-linux-gnu},
529 @code{alphaev67-unknown-linux-gnu}.
531 @item SuSE Linux 7.2a
532 @cindex SuSE Linux
534 GCC 3.0 and GNU Make. @code{ia64-unknown-linux-gnu}.
536 @item SuSE Linux
537 @cindex SuSE Linux
539 GCC 3.2.2 and GNU Make.  @code{x86_64-unknown-linux-gnu} (AMD64
540 Opteron ``Melody'').
542 @item RedHat Linux 7.2
543 @cindex RedHat
545 GCC 2.96 and GNU Make. @code{alphaev6-unknown-linux-gnu},
546 @code{alphaev67-unknown-linux-gnu}, @code{ia64-unknown-linux-gnu}.
548 @item RedHat Linux 8.0
549 @cindex RedHat
551 GCC 3.2 and GNU Make. @code{i686-pc-linux-gnu}.
553 @item RedHat Advanced Server 2.1
554 @cindex RedHat Advanced Server
556 GCC 2.96 and GNU Make. @code{i686-pc-linux-gnu}.
558 @item Slackware Linux 8.0.01
559 @cindex RedHat
561 GCC 2.95.3 and GNU Make. @code{i686-pc-linux-gnu}.
563 @item Mandrake Linux 9.0
564 @cindex Mandrake
566 GCC 3.2 and GNU Make. @code{i686-pc-linux-gnu}.
568 @item IRIX 6.5
569 @cindex IRIX
571 MIPS C compiler, IRIX Make. @code{mips-sgi-irix6.5}.
573 @item AIX 4.3.2
574 @cindex AIX
576 IBM C for AIX compiler, AIX Make.  @code{rs6000-ibm-aix4.3.2.0}.
578 @c @item Microsoft Windows 2000 (Cygwin)
579 @c @cindex Windows
581 @c GCC 3.2, GNU make. @code{i686-pc-cygwin}.
583 @item HP-UX 11
584 @cindex HP-UX
586 HP-UX C compiler and HP Make. @code{ia64-hp-hpux11.22},
587 @code{hppa2.0w-hp-hpux11.11}.
589 @item SUN Solaris 2.8
590 @cindex Solaris
592 Sun WorkShop Compiler C 6.0 and SUN Make. @code{sparc-sun-solaris2.8}.
594 @item NetBSD 1.6
595 @cindex NetBSD
597 GCC 2.95.3 and GNU Make. @code{alpha-unknown-netbsd1.6},
598 @code{i386-unknown-netbsdelf1.6}.
600 @item OpenBSD 3.1 and 3.2
601 @cindex OpenBSD
603 GCC 2.95.3 and GNU Make. @code{alpha-unknown-openbsd3.1},
604 @code{i386-unknown-openbsd3.1}.
606 @item FreeBSD 4.7 and 4.8
607 @cindex FreeBSD
609 GCC 2.95.4 and GNU Make. @code{alpha-unknown-freebsd4.7},
610 @code{alpha-unknown-freebsd4.8}, @code{i386-unknown-freebsd4.7},
611 @code{i386-unknown-freebsd4.8}.
613 @end enumerate
615 If you use Shishi on, or port Shishi to, a new platform please report
616 it to the author (@pxref{Bug Reports}).
618 @node Downloading and Installing
619 @section Downloading and Installing
620 @cindex Installation
621 @cindex Download
623 The package can be downloaded from several places, including
624 @url{http://josefsson.org/shishi/releases/}.  The latest version is
625 stored in a file, e.g., @samp{shishi-0.0.42.tar.gz} where the
626 @samp{0.0.42} indicate the highest version number.
628 The package is then extracted, configured and built like many other
629 packages that use Autoconf.  For detailed information on configuring
630 and building it, refer to the @file{INSTALL} file that is part of the
631 distribution archive.
633 Here is an example terminal session that download, configure, build
634 and install the package.  You will need a few basic tools, such as
635 @samp{sh}, @samp{make} and @samp{cc}.
637 @example
638 $ wget -q http://josefsson.org/shishi/releases/shishi-0.0.4.tar.gz
639 $ tar xfz shishi-0.0.4.tar.gz
640 $ cd shishi-0.0.4/
641 $ ./configure
643 $ make
645 $ make install
647 @end example
649 After this you should be prepared to continue with the user,
650 administration or programming manual, depending on how you want to use
651 Shishi.
653 @node Bug Reports
654 @section Bug Reports
655 @cindex Reporting Bugs
657 If you think you have found a bug in Shishi, please investigate it and
658 report it.
660 @itemize @bullet
662 @item Please make sure that the bug is really in Shishi, and
663 preferably also check that it hasn't already been fixed in the latest
664 version.
666 @item You have to send us a test case that makes it possible for us to
667 reproduce the bug.
669 @item You also have to explain what is wrong; if you get a crash, or
670 if the results printed are not good and in that case, in what way.
671 Make sure that the bug report includes all information you would need
672 to fix this kind of bug for someone else.
674 @end itemize
676 Please make an effort to produce a self-contained report, with
677 something definite that can be tested or debugged.  Vague queries or
678 piecemeal messages are difficult to act on and don't help the
679 development effort.
681 If your bug report is good, we will do our best to help you to get a
682 corrected version of the software; if the bug report is poor, we won't
683 do anything about it (apart from asking you to send better bug
684 reports).
686 If you think something in this manual is unclear, or downright
687 incorrect, or if the language needs to be improved, please also send a
688 note.
690 Send your bug report to:
692 @center @samp{bug-shishi@@josefsson.org}
694 @node Contributing
695 @section Contributing
696 @cindex Contributing
697 @cindex Hacking
699 If you want to submit a patch for inclusion -- from solve a typo you
700 discovered, up to adding support for a new feature -- you should
701 submit it as a bug report (@pxref{Bug Reports}).  There are some
702 things that you can do to increase the chances for it to be included
703 in the official package.
705 Unless your patch is very small (say, under 10 lines) we require that
706 you assign the copyright of your work to the Free Software Foundation.
707 This is to protect the freedom of the project.  If you have not
708 already signed papers, we will send you the necessary information when
709 you submit your contribution.
711 For contributions that doesn't consist of actual programming code, the
712 only guidelines are common sense.  Use it.
714 For code contributions, a number of style guides will help you:
716 @itemize @bullet
718 @item Coding Style.
719 Follow the GNU Standards document (@pxref{top, GNU Coding Standards,,
720 standards}).
722 If you normally code using another coding standard, there is no
723 problem, but you should use @samp{indent} to reformat the code
724 (@pxref{top, GNU Indent,, indent}) before submitting your work.
726 @item Use the unified diff format @samp{diff -u}.
728 @item Return errors.
729 The only valid reason for ever aborting the execution of the program
730 is due to memory allocation errors, but for that you should call
731 @samp{xalloc_die} to allow the application to recover if it wants to.
733 @item Design with thread safety in mind.
734 Don't use global variables.  Don't even write to per-handle global
735 variables unless the documented behaviour of the function you write is
736 to write to the per-handle global variable.
738 @item Avoid using the C math library.
739 It causes problems for embedded implementations, and in most
740 situations it is very easy to avoid using it.
742 @item Document your functions.
743 Use comments before each function headers, that, if properly
744 formatted, are extracted into Texinfo manuals and GTK-DOC web pages.
746 @item Supply a ChangeLog and NEWS entries, where appropriate.
748 @end itemize
750 @c **********************************************************
751 @c ********************  User Manual  **********************
752 @c **********************************************************
753 @node User Manual
754 @chapter User Manual
755 @cindex End-user Shishi usage
757 Usually Shishi interacts with you to get some initial authentication
758 information like a password, and then contacts a server to receive a
759 so called ticket granting ticket.  From now on, you rarely interacts
760 with Shishi directly.  Applications that needs security services
761 instruct the Shishi library to use the ticket granting ticket to get
762 new tickets for various servers.  An example could be if you log on to
763 a host remotely via @samp{telnet}.  The host usually requires
764 authentication before permitting you in.  The @samp{telnet} client
765 uses the ticket granting ticket to get a ticket for the server, and
766 then use this ticket to authenticate you against the server (typically
767 the server is also authenticated to you).  You perform the initial
768 authentication by typing @command{shishi} at the prompt.  Sometimes it
769 is necessary to supply options telling Shishi what your principal name
770 (user name in the Kerberos realm) or realm is.  In the example, I
771 specify the client name @code{simon@@JOSEFSSON.ORG}.
773 @example
774 @cartouche
775 $ shishi simon@@JOSEFSSON.ORG
776 Enter password for `simon@@JOSEFSSON.ORG':
777 simon@@JOSEFSSON.ORG:
778 Authtime:       Fri Aug 15 04:44:49 2003
779 Endtime:        Fri Aug 15 05:01:29 2003
780 Server:         krbtgt/JOSEFSSON.ORG key des3-cbc-sha1-kd (16)
781 Ticket key:     des3-cbc-sha1-kd (16) protected by des3-cbc-sha1-kd (16)
782 Ticket flags:   INITIAL (512)
784 @end cartouche
785 @end example
787 As you can see, Shishi also prints a short description of the ticket
788 received.
790 A logical next step is to display all tickets you have received (by
791 the way, the tickets are usually stored as text in
792 @file{~/.shishi/tickets}).  This is achieved by typing @command{shishi
793 --list}.
795 @example
796 @cartouche
797 $ shishi --list
798 Tickets in `/home/jas/.shishi/tickets':
799                                                                                 
800 jas@@JOSEFSSON.ORG:
801 Authtime:       Fri Aug 15 04:49:46 2003
802 Endtime:        Fri Aug 15 05:06:26 2003
803 Server:         krbtgt/JOSEFSSON.ORG key des-cbc-md5 (3)
804 Ticket key:     des-cbc-md5 (3) protected by des-cbc-md5 (3)
805 Ticket flags:   INITIAL (512)
806                                                                                 
807 jas@@JOSEFSSON.ORG:
808 Authtime:       Fri Aug 15 04:49:46 2003
809 Starttime:      Fri Aug 15 04:49:49 2003
810 Endtime:        Fri Aug 15 05:06:26 2003
811 Server:         host/latte.josefsson.org key des-cbc-md5 (3)
812 Ticket key:     des-cbc-md5 (3) protected by des-cbc-md5 (3)
813                                                                                 
814 2 tickets found.
816 @end cartouche
817 @end example
819 As you can see, I had a ticket for the server
820 @samp{host/latte.josefsson.org} which was generated by
821 @samp{telnet}:ing to that host.
823 If, for some reason, you want to manually get a ticket for a specific
824 server, you can use the @command{shishi --server-name} command.
825 Normally, however, the application that uses Shishi will take care of
826 getting a ticket for the appropriate server, so you normally wouldn't
827 need this command.
829 @example
830 @cartouche
831 $ shishi --server-name=user/billg --encryption-type=des-cbc-md4
832 jas@@JOSEFSSON.ORG:
833 Authtime:       Fri Aug 15 04:49:46 2003
834 Starttime:      Fri Aug 15 04:54:33 2003
835 Endtime:        Fri Aug 15 05:06:26 2003
836 Server:         user/billg key des-cbc-md4 (2)
837 Ticket key:     des-cbc-md4 (2) protected by des-cbc-md5 (3)
839 @end cartouche
840 @end example
842 As you can see, I acquired a ticket for @samp{user/billg} with a
843 @samp{des-cbc-md4} (@pxref{Cryptographic Overview}) encryption key
844 specified with the @samp{--encryption-type} parameter.
846 To wrap up this introduction, lets see how you can remove tickets.
847 You may want to do this if you leave your terminal for lunch or
848 similar, and don't want someone to be able to copy the file and then
849 use your credentials.  Note that this only destroy the tickets
850 locally, it does not contact any server and tell it that these
851 credentials are no longer valid.  So if someone stole your ticket
852 file, you must contact your administrator and have them reset your
853 account, simply using this parameter is not sufficient.
855 @example
856 @cartouche
857 $ shishi --server-name=imap/latte.josefsson.org --destroy
858 1 ticket removed.
859 $ shishi --server-name=foobar --destroy
860 No tickets removed.
861 $ shishi --destroy
862 3 tickets removed.
864 @end cartouche
865 @end example
867 Since the @samp{--server-name} parameter takes a long to type, it is
868 possible to type the server name directly, after the client name.  The
869 following example demonstrate a AS-REQ followed by a TGS-REQ for a
870 specific server (assuming you did not have any tickets from the
871 start).
873 @example
874 @cartouche
875 $ src/shishi simon@@latte.josefsson.org imap/latte.josefsson.org
876 Enter password for `simon@@latte.josefsson.org':
877 simon@@latte.josefsson.org:
878 Acquired:       Wed Aug 27 17:21:06 2003
879 Expires:        Wed Aug 27 17:37:46 2003
880 Server:         imap/latte.josefsson.org key aes256-cts-hmac-sha1-96 (18)
881 Ticket key:     aes256-cts-hmac-sha1-96 (18) protected by aes256-cts-hmac-sha1-96 (18)
882 Ticket flags:   FORWARDED PROXIABLE (12)
884 @end cartouche
885 @end example
887 Refer to the reference manual for all available parameters
888 (@pxref{Parameters for shishi}).  The rest of this section contains
889 description of more specialized usage modes that can be ignored by
890 most users.
892 @section Proxiable and Proxy Tickets
894 At times it may be necessary for a principal to allow a service to
895 perform an operation on its behalf. The service must be able to take
896 on the identity of the client, but only for a particular purpose. A
897 principal can allow a service to take on the principal's identity for
898 a particular purpose by granting it a proxy.
900 The process of granting a proxy using the proxy and proxiable flags is
901 used to provide credentials for use with specific services. Though
902 conceptually also a proxy, users wishing to delegate their identity in
903 a form usable for all purpose MUST use the ticket forwarding mechanism
904 described in the next section to forward a ticket-granting ticket.
906 The PROXIABLE flag in a ticket is normally only interpreted by the
907 ticket-granting service. It can be ignored by application servers.
908 When set, this flag tells the ticket-granting server that it is OK to
909 issue a new ticket (but not a ticket-granting ticket) with a different
910 network address based on this ticket. This flag is set if requested by
911 the client on initial authentication. By default, the client will
912 request that it be set when requesting a ticket-granting ticket, and
913 reset when requesting any other ticket.
915 This flag allows a client to pass a proxy to a server to perform a
916 remote request on its behalf (e.g. a print service client can give the
917 print server a proxy to access the client's files on a particular file
918 server in order to satisfy a print request).
920 In order to complicate the use of stolen credentials, Kerberos tickets
921 are usually valid from only those network addresses specifically
922 included in the ticket[4]. When granting a proxy, the client MUST
923 specify the new network address from which the proxy is to be used, or
924 indicate that the proxy is to be issued for use from any address.
926 The PROXY flag is set in a ticket by the TGS when it issues a proxy
927 ticket.  Application servers MAY check this flag and at their option
928 they MAY require additional authentication from the agent presenting
929 the proxy in order to provide an audit trail.
931 Here is how you would acquire a PROXY ticket for the service
932 @samp{imap/latte.josefsson.org}:
934 @example
935 @cartouche
936 $ shishi jas@@JOSEFSSON.ORG imap/latte.josefsson.org --proxy
937 Enter password for `jas@@JOSEFSSON.ORG':
938 libshishi: warning: KDC bug: Reply encrypted using wrong key.
939 jas@@JOSEFSSON.ORG:
940 Authtime:       Mon Sep  8 20:02:35 2003
941 Starttime:      Mon Sep  8 20:02:36 2003
942 Endtime:        Tue Sep  9 04:02:35 2003
943 Server:         imap/latte.josefsson.org key des3-cbc-sha1-kd (16)
944 Ticket key:     des3-cbc-sha1-kd (16) protected by des3-cbc-sha1-kd (16)
945 Ticket flags:   PROXY (16)
947 @end cartouche
948 @end example
950 As you noticed, this asked for your password.  The reason is that
951 proxy tickets must be acquired using a proxiable ticket granting
952 ticket, which was not present.  If you often need to get proxy
953 tickets, you may acquire a proxiable ticket granting ticket from the
954 start:
956 @example
957 @cartouche
958 $ shishi --proxiable
959 Enter password for `jas@@JOSEFSSON.ORG':
960 jas@@JOSEFSSON.ORG:
961 Authtime:       Mon Sep  8 20:04:27 2003
962 Endtime:        Tue Sep  9 04:04:27 2003
963 Server:         krbtgt/JOSEFSSON.ORG key des3-cbc-sha1-kd (16)
964 Ticket key:     des3-cbc-sha1-kd (16) protected by des3-cbc-sha1-kd (16)
965 Ticket flags:   PROXIABLE INITIAL (520)
966 @end cartouche
967 @end example
969 Then you should be able to acquire proxy tickets based on that ticket
970 granting ticket, as follows:
972 @example
973 @cartouche
974 $ shishi jas@@JOSEFSSON.ORG imap/latte.josefsson.org --proxy
975 libshishi: warning: KDC bug: Reply encrypted using wrong key.
976 jas@@JOSEFSSON.ORG:
977 Authtime:       Mon Sep  8 20:04:27 2003
978 Starttime:      Mon Sep  8 20:04:32 2003
979 Endtime:        Tue Sep  9 04:04:27 2003
980 Server:         imap/latte.josefsson.org key des3-cbc-sha1-kd (16)
981 Ticket key:     des3-cbc-sha1-kd (16) protected by des3-cbc-sha1-kd (16)
982 Ticket flags:   PROXY (16)
984 @end cartouche
985 @end example
987 @section Forwardable and Forwarded Tickets
989 Authentication forwarding is an instance of a proxy where the service
990 that is granted is complete use of the client's identity. An example
991 where it might be used is when a user logs in to a remote system and
992 wants authentication to work from that system as if the login were
993 local.
995 The FORWARDABLE flag in a ticket is normally only interpreted by the
996 ticket-granting service. It can be ignored by application servers.
997 The FORWARDABLE flag has an interpretation similar to that of the
998 PROXIABLE flag, except ticket-granting tickets may also be issued with
999 different network addresses. This flag is reset by default, but users
1000 MAY request that it be set by setting the FORWARDABLE option in the AS
1001 request when they request their initial ticket-granting ticket.
1003 This flag allows for authentication forwarding without requiring the
1004 user to enter a password again. If the flag is not set, then
1005 authentication forwarding is not permitted, but the same result can
1006 still be achieved if the user engages in the AS exchange specifying
1007 the requested network addresses and supplies a password.
1009 The FORWARDED flag is set by the TGS when a client presents a ticket
1010 with the FORWARDABLE flag set and requests a forwarded ticket by
1011 specifying the FORWARDED KDC option and supplying a set of addresses
1012 for the new ticket. It is also set in all tickets issued based on
1013 tickets with the FORWARDED flag set. Application servers may choose to
1014 process FORWARDED tickets differently than non-FORWARDED tickets.
1016 If addressless tickets are forwarded from one system to another,
1017 clients SHOULD still use this option to obtain a new TGT in order to
1018 have different session keys on the different systems.
1020 Here is how you would acquire a FORWARDED ticket for the service
1021 @samp{host/latte.josefsson.org}:
1023 @example
1024 @cartouche
1025 $ shishi jas@@JOSEFSSON.ORG host/latte.josefsson.org --forwarded
1026 Enter password for `jas@@JOSEFSSON.ORG':
1027 libshishi: warning: KDC bug: Reply encrypted using wrong key.
1028 jas@@JOSEFSSON.ORG:
1029 Authtime:       Mon Sep  8 20:07:11 2003
1030 Starttime:      Mon Sep  8 20:07:12 2003
1031 Endtime:        Tue Sep  9 04:07:11 2003
1032 Server:         host/latte.josefsson.org key des3-cbc-sha1-kd (16)
1033 Ticket key:     des3-cbc-sha1-kd (16) protected by des3-cbc-sha1-kd (16)
1034 Ticket flags:   FORWARDED (4)
1036 @end cartouche
1037 @end example
1039 As you noticed, this asked for your password.  The reason is that
1040 forwarded tickets must be acquired using a forwardable ticket granting
1041 ticket, which was not present.  If you often need to get forwarded
1042 tickets, you may acquire a forwardable ticket granting ticket from the
1043 start:
1045 @example
1046 @cartouche
1047 $ shishi --forwardable
1048 Enter password for `jas@@JOSEFSSON.ORG':
1049 jas@@JOSEFSSON.ORG:
1050 Authtime:       Mon Sep  8 20:08:53 2003
1051 Endtime:        Tue Sep  9 04:08:53 2003
1052 Server:         krbtgt/JOSEFSSON.ORG key des3-cbc-sha1-kd (16)
1053 Ticket key:     des3-cbc-sha1-kd (16) protected by des3-cbc-sha1-kd (16)
1054 Ticket flags:   FORWARDABLE INITIAL (514)
1056 @end cartouche
1057 @end example
1059 Then you should be able to acquire forwarded tickets based on that
1060 ticket granting ticket, as follows:
1062 @example
1063 @cartouche
1064 $ shishi jas@@JOSEFSSON.ORG host/latte.josefsson.org --forwarded
1065 libshishi: warning: KDC bug: Reply encrypted using wrong key.
1066 jas@@JOSEFSSON.ORG:
1067 Authtime:       Mon Sep  8 20:08:53 2003
1068 Starttime:      Mon Sep  8 20:08:57 2003
1069 Endtime:        Tue Sep  9 04:08:53 2003
1070 Server:         host/latte.josefsson.org key des3-cbc-sha1-kd (16)
1071 Ticket key:     des3-cbc-sha1-kd (16) protected by des3-cbc-sha1-kd (16)
1072 Ticket flags:   FORWARDED (4)
1074 @end cartouche
1075 @end example
1078 @c **********************************************************
1079 @c ****************  Administration Manual  *****************
1080 @c **********************************************************
1081 @node Administration Manual
1082 @chapter Administration Manual
1084 This section describe how you get the KDC server up and running to
1085 answer queries from clients.
1087 First you must create a user database.  Currently this is rather
1088 simplistic, and the database only contains cryptographic keys.  Use
1089 the @samp{shishi --string-to-key} command to generate keys, and store
1090 them in the @file{shishid.keys} file.  The file path is
1091 @file{/usr/local/etc/shishid.keys} by default, although you can use
1092 @samp{shishid -k} to specify another location.
1094 Create a random key for the Kerberos Ticket Granting Service for your
1095 realm:
1097 @example
1098 @cartouche
1099 $ shishi --string-to-key --random \
1100 krbtgt/latte.josefsson.org@@latte.josefsson.org | \
1101 tee /usr/local/etc/shishid.keys
1102 -----BEGIN SHISHI KEY-----
1103 Keytype: 18 (aes256-cts-hmac-sha1-96)
1104 Principal: krbtgt/latte.josefsson.org
1105 Realm: latte.josefsson.org
1107 oconxMTf59B5bvTylY+KE4mchA/gtmYI2Qok+48tnSM=
1108 -----END SHISHI KEY-----
1110 @end cartouche
1111 @end example
1113 Create a key for a user from a specified password:
1115 @example
1116 @cartouche
1117 $ shishi --string-to-key=fnord \
1118 simon@@latte.josefsson.org | tee --append \
1119 /usr/local/etc/shishid.keys
1120 -----BEGIN SHISHI KEY-----
1121 Keytype: 18 (aes256-cts-hmac-sha1-96)
1122 Principal: simon
1123 Realm: latte.josefsson.org
1125 c1rqwvYwuDFrABvqWVq9bWUsQWg/xbErsIUmLN+3lYM=
1126 -----END SHISHI KEY-----
1128 @end cartouche
1129 @end example
1131 There is nothing special with a ticket granting key, you could have
1132 created it based on a password similar to the user key.  However,
1133 please keep in mind that passwords typically have little entropy.
1135 Finally, create a random key for a service:
1137 @example
1138 @cartouche
1139 $ shishi --string-to-key --random \
1140 imap/latte.josefsson.org@@latte.josefsson.org | \
1141 tee --append /usr/local/etc/shishid.keys
1142 -----BEGIN SHISHI KEY-----
1143 Keytype: 18 (aes256-cts-hmac-sha1-96)
1144 Principal: imap/latte.josefsson.org
1145 Realm: latte.josefsson.org
1147 ts2v0QHWyW9FyXbWtCvLPqdEc60qPq5Yvat3p82rp5c=
1148 -----END SHISHI KEY-----
1150 @end cartouche
1151 @end example
1153 You are now ready to start the KDC.  Refer to the reference manual for
1154 available parameters (@pxref{Parameters for shishid}).
1156 @example
1157 @cartouche
1158 $ shishid
1159 @end cartouche
1160 @end example
1162 Then you can use @samp{shishi} as usual to acquire tickets
1163 (@pxref{User Manual}).  The following example demonstrate a AS-REQ for
1164 @samp{krbtgt/latte.josefsson.org} followed by a TGS-REQ for
1165 @samp{imap/latte.josefsson.org}.
1167 @example
1168 @cartouche
1169 $ shishi simon@@latte.josefsson.org imap/latte.josefsson.org
1170 Enter password for `simon@@latte.josefsson.org':
1171 simon@@latte.josefsson.org:
1172 Acquired:       Wed Aug 27 17:16:37 2003
1173 Expires:        Wed Aug 27 17:33:17 2003
1174 Server:         imap/latte.josefsson.org key aes256-cts-hmac-sha1-96 (18)
1175 Ticket key:     aes256-cts-hmac-sha1-96 (18) protected by aes256-cts-hmac-sha1-96 (18)
1176 Ticket flags:   FORWARDED PROXIABLE (12)
1178 @end cartouche
1179 @end example
1181 @c **********************************************************
1182 @c ****************  Reference Manual  **********************
1183 @c **********************************************************
1184 @node Reference Manual
1185 @chapter Reference Manual
1187 This chapter describes in high detail all parameters, configuration
1188 file verbs, etc.
1190 @menu
1191 * Configuration file::          Meaning of tokens used in configuration file.
1192 * Parameters for shishi::       Command line parameters for 'shishi'.
1193 * Parameters for shishid::      Command line parameters for 'shishid'.
1194 @end menu
1196 @node Configuration file
1197 @section Configuration file
1199 The valid configuration file tokens are described here.  The user
1200 configuration file is typically located in
1201 @file{~/.shishi/shishi.conf} (compare @samp{shishi
1202 --configuration-file}) and the system configuration is typicall
1203 located in @file{/usr/local/etc/shishi.conf}.  All tokens are valid in
1204 both files, and have the same meaning.  However, as the system file is
1205 supposed to apply to all users on a system, it would not make sense to
1206 use some tokens in both files.  For example, the
1207 @samp{default-principal} is rarely useful in a system configuration
1208 file.
1210 @subsection @samp{default-realm}
1211 Specify the default realm, by default the hostname of the host is
1212 used.  E.g.,
1214 @example
1215 default-realm JOSEFSSON.ORG
1216 @end example
1218 @subsection @samp{default-principal}
1220 Specify the default principal, by default the login username is
1221 used. E.g.,
1223 @example
1224 default-principal jas
1225 @end example
1227 @subsection @samp{client-kdc-etypes}
1229 Specify which encryption types client asks server to respond in during
1230 AS/TGS exchanges. List valid encryption types, in preference order.
1231 Supported algorithms include aes256-cts-hmac-sha1-96,
1232 aes128-cts-hmac-sha1-96, des3-cbc-sha1-kd, des-cbc-md5, des-cbc-md4,
1233 des-cbc-crc and null.  This option also indicates which encryption
1234 types are accepted by the client when receiving the response.  Note
1235 that the preference order is not cryptographically protected, so a man
1236 in the middle can modify the order without being detected.  Thus, only
1237 specify encryption types you trust completely here. The default only
1238 includes aes256-cts-hmac-sha1-96, as suggested by RFC1510bis.  E.g.,
1240 @example
1241 client-kdc-etypes=aes256-cts-hmac-sha1-96 des3-cbc-sha1-kd des-cbc-md5
1242 @end example
1244 @subsection @samp{verbose}, @samp{verbose-asn1}, @samp{verbose-noice}, @samp{verbose-crypto}
1246 Enable verbose library messages.  E.g.,
1248 @example
1249 verbose
1250 verbose-noice
1251 @end example
1253 @subsection @samp{realm-kdc}
1255 Specify KDC addresses for realms.  Value is
1256 @samp{REALM,KDCADDRESS[/PROTOCOL][,KDCADDRESS[/PROTOCOL]...]}.
1258 KDCADDRESS is the hostname or IP address of KDC.
1260 Optional PROTOCOL is udp for UDP, tcp for TCP, and TLS for TLS
1261 connections.  By default UDP is tried first, and TCP used as a
1262 fallback if the KRB_ERR_RESPONSE_TOO_BIG error is received.
1264 If not specified, Shishi tries to locate the KDC using SRV RRs,
1265 which is recommended.  This option should normally only be
1266 used during experiments, or to access badly maintained realms.
1268 @example
1269 realm-kdc=JOSEFSSON.ORG,ristretto.josefsson.org
1270 @end example
1272 @subsection @samp{server-realm}
1274 Specify realm for servers. Value is
1275 @samp{REALM,SERVERREGEXP[,SERVERREGEXP...]}.
1277 SERVERREGEXP is a regular expression matching servers in the realm.
1278 The first match is used.  E.g.,
1280 @example
1281 server-realm=JOSEFSSON.ORG,.josefsson.org
1282 @end example
1284 Note: currently not used.
1286 @subsection @samp{kdc-timeout}, @samp{kdc-retries}
1288 How long shishi waits for a response from a KDC before continuing to
1289 next KDC for realm.  The default is 5 seconds.  E.g.,
1291 @example
1292 kdc-timeout=10
1293 @end example
1295 How many times shishi sends a request to a KDC before giving up.  The
1296 default is 3 times.  E.g.,
1298 @example
1299 kdc-retries=5
1300 @end example
1302 @subsection @samp{stringprocess}
1304 How username and passwords entered from the terminal, or taken from
1305 the command line, are processed.
1307 "none": no processing is used.
1309 "stringprep": convert from locale charset to UTF-8 and process using
1310               experimental RFC 1510 stringprep profile.
1312 It can also be a string indicating a character set supported by
1313 iconv via libstringprep, in which case data is converted from locale
1314 charset into the indicated character set. E.g., UTF-8, ISO-8859-1,
1315 KOI-8, EBCDIC-IS-FRISS are supported on GNU systems.  On some systems
1316 you can use "locale -m" to list available character sets.  By default,
1317 the "none" setting is used which is consistent with RFC 1510 that is
1318 silent on the issue.  In practice, however, converting to UTF-8
1319 improves interoperability.
1321 E.g.,
1323 @example
1324 stringprocess=UTF-8
1325 @end example
1327 @subsection @samp{ticket-life}
1328 Specify default ticket life time.
1330 The string can be in almost any common format.  It can contain month
1331 names, time zones, `am' and `pm', `yesterday', `ago', `next', etc.
1332 Refer to the "Date input formats" in the GNU CoreUtils package for
1333 entire story (@pxref{Date input formats, ,Date input formats,
1334 coreutils, GNU CoreUtils}).  As an extra feature, if the resulting
1335 string you specify has expired within the last 24 hours, an extra day
1336 is added to it.  This allows you to specify "17:00" to always mean the
1337 next 17:00, even if your system clock happens to be 17:30.
1339 The default is 8 hours.
1341 E.g.,
1343 @example
1344 #ticket-life=8 hours
1345 #ticket-life=1 day
1346 ticket-life=17:00
1347 @end example
1349 @subsection @samp{renew-life}
1351 Specify how long a renewable ticket should remain renewable.
1353 See ticket-life for the syntax.  The extra feature that handles
1354 negative values within the last 2 hours is not active here.
1356 The default is 7 days.
1358 E.g.,
1360 @example
1361 #renew-life=1 week
1362 #renew-life=friday 17:00
1363 renew-life=sunday
1364 @end example
1366 @node Parameters for shishi
1367 @section Parameters for shishi
1369 If no command is given, Shishi try to make sure you have a ticket
1370 granting ticket for the default realm, and then display it.
1372 Mandatory or optional arguments to long options are also mandatory or optional
1373 for any corresponding short options.
1375 @example
1376 Usage: shishi [OPTION...] [CLIENT [SERVER]] [OPTION...]
1377   or:  shishi [OPTION...] --list [CLIENT [SERVER]]
1378   or:  shishi [OPTION...] --destroy [CLIENT [SERVER]]
1379   or:  shishi [OPTION...] --string-to-key [CLIENT] [OPTION...]
1380   or:  shishi [OPTION...]
1381 Shishi -- A Kerberos 5 implementation
1383       --client-name=NAME     Client name. Default is login username.
1384   -d, --destroy              Destroy tickets in local cache, subject to
1385                              --client-name and --server-name limiting.
1386   -e, --endtime=STRING       Specify when ticket validity should expire.  The
1387                              time syntax may be relative (to the start time),
1388                              such as "20 hours", or absolute, such as
1389                              "2001-02-03 04:05:06 CET". The default is 8 hours
1390                              after the start time.
1391   -E, --encryption-type=ETYPE,[ETYPE...]
1392                              Encryption types to use.  ETYPE is either
1393                              registered name or integer.
1394       --force-as             Force AS mode. Default is to use TGS iff a TGT is
1395                              found.
1396       --force-tgs            Force TGS mode. Default is to use TGS iff a TGT is
1397                              found.
1398       --forwardable          Get a forwardable ticket, i.e., one that can be
1399                              used to get forwarded tickets.
1400       --forwarded            Get a forwarded ticket.
1401   -l, --list                 List tickets in local cache, subject to
1402                              --server-name limiting.
1403       --proxiable            Get a proxiable ticket, i.e., one that can be used
1404                              to get proxy tickets.
1405       --proxy                Get a proxy ticket.
1406       --realm=REALM          Realm of server. Default is DNS domain of local
1407                              host. For AS, this also indicates realm of client.
1408       --renew-till=STRING    Specify renewable life of ticket.  Implies
1409                              --renewable.  Accepts same time syntax as
1410                              --endtime.  If --renewable is specified, the
1411                              default is 1 week after the start time.
1412       --renewable            Get a renewable ticket.
1413   -R, --renew                Renew ticket.  Use --server-name to specify
1414                              ticket, default is the most recent renewable
1415                              ticket granting ticket for the default realm.
1416       --server=[FAMILY:]ADDRESS:SERVICE/TYPE
1417                              Send all requests to HOST instead of using normal
1418                              logic to locate KDC addresses (discouraged).
1419       --server-name=NAME     Server name. Default is "krbtgt/REALM" where REALM
1420                              is server realm (see --realm).
1421   -s, --starttime=STRING     Specify when ticket should start to be valid.
1422                              Accepts same time syntax as --endtime. The default
1423                              is to become valid immediately.
1424       --ticket-granter=NAME  Service name in ticket to use for authenticating
1425                              request. Only for TGS. Defaults to
1426                              "krbtgt/REALM@@REALM" where REALM is server realm
1427                              (see --realm).
1429  Options for low-level cryptography (CRYPTO-OPTIONS):
1430       --client-name=NAME     Username. Default is login name.
1431       --key-version=INTEGER  Version number of key. Default is 0.
1432       --parameter=STRING     String-to-key parameter. This data is specific for
1433                              each encryption algorithm and rarely needed.
1434       --random               Generate key from random data.
1435       --realm=REALM          Realm of principal. Defaults to DNS domain of
1436                              local host.
1437       --salt=SALT            Salt to use for --string-to-key. Defaults to
1438                              concatenation of realm and (unwrapped) client
1439                              name.
1440       --string-to-key[=[PASSWORD]]
1441                              Convert password into Kerberos key.  Note that
1442                              --client-name, --realm, and --salt influence the
1443                              generated key.
1445  Other options:
1446       --configuration-file=FILE   Read user configuration from file.  Default
1447                              is ~/.shishi/config.
1448   -c, --ticket-file=FILE     Read tickets from FILE. Default is
1449                              $HOME/.shishi/tickets.
1450   -o, --library-options=STRING   Parse STRING as a configuration file
1451                              statement.
1452   -q, --quiet, --silent      Don't produce any output.
1453       --system-configuration-file=FILE
1454                              Read system wide configuration from file.  Default
1455                              is /usr/local/etc/shishi.conf.
1456       --ticket-write-file=FILE   Write tickets to FILE.  Default is to write
1457                              them back to ticket file.
1458   -v, --verbose              Produce verbose output.  Use multiple times to
1459                              increase amount of verbose output.
1460   CLIENT                     Set client name and realm from NAME.  The
1461                              --client-name and --realm parameters can be used
1462                              to override part of NAME.
1463   SERVER                     Set server name and realm from NAME.  The
1464                              --server-name and --server-realm parameters can be
1465                              used to override part of SERVER.
1467   -?, --help                 Give this help list
1468       --usage                Give a short usage message
1469   -V, --version              Print program version
1470 @end example
1472 @node Parameters for shishid
1473 @section Parameters for shishid
1475 If no parameters are specified, @samp{shishid} listens on the defaults
1476 interfaces and answers incoming requests using the keys in the default
1477 key file.
1479 Mandatory or optional arguments to long options are also mandatory or optional
1480 for any corresponding short options.
1482 @example
1483   -c, --configuration-file=FILE   Read configuration from file.  Default is
1484                              /usr/local/etc/shishi.conf.
1485   -k, --key-file=FILE        Read keys from file.  Default is
1486                              /usr/local/etc/shishid.keys.
1487   -l, --listen=[FAMILY:]ADDRESS:SERVICE/TYPE,...
1488                              What to listen on. Family is "IPv4" or "IPv6", if
1489                              absent the family is decided by
1490                              gethostbyname(ADDRESS). An address of "*"
1491                              indicates all addresses on the local host. The
1492                              default is "IPv4:*:kerberos/udp,
1493                              IPv4:*:kerberos/tcp, IPv6:*:kerberos/udp,
1494                              IPv6:*:kerberos/tcp".
1495   -q, -s, --quiet, --silent  Don't produce any output.
1496   -u, --setuid=NAME          After binding socket, set user identity.
1497   -v, --verbose              Produce verbose output.
1498   -?, --help                 Give this help list
1499       --usage                Give a short usage message
1500   -V, --version              Print program version
1501 @end example
1503 @c **********************************************************
1504 @c ***************  Programming Manual  *********************
1505 @c **********************************************************
1506 @node Programming Manual
1507 @chapter Programming Manual
1508 @cindex Application Programming Interface (API)
1510 This chapter describes all the publicly available functions in the
1511 library.
1513 @menu
1514 * Preparation::                 What you should do before using the library.
1515 * Initialization Functions::    Creating library handle, configuration file.
1516 * Ticket Set Functions::        High-level ticket management functions.
1517 * AP-REQ and AP-REP Functions:: Client/Server authentication functions.
1518 * SAFE and PRIV Functions::     Client/Server session data functions.
1519 * Ticket Functions::            Medium-level ticket manipulation functions.
1520 * AS Functions::                Medium-level initial authentication functions.
1521 * TGS Functions::               Medium-level authentication functions.
1522 * Ticket (ASN.1) Functions::    Low-level Ticket functions.
1523 * AS/TGS Functions::            Low-level KDC functions; AS and TGS.
1524 * Authenticator Functions::     Low-level authenticator functions.
1525 * Cryptographic Functions::     Low-level cryptographic functions.
1526 * Utility Functions::           Utilities for use in the global context.
1527 * Error Handling::              Error codes and such.
1528 * Examples::                    Example code.
1529 * Generic Security Service::    If you want to use the GSS API instead.
1530 @end menu
1532 @node Preparation
1533 @section Preparation
1535 To use `Libshishi', you have to perform some changes to your sources
1536 and the build system.  The necessary changes are small and explained
1537 in the following sections.  At the end of this chapter, it is
1538 described how the library is initialized, and how the requirements of
1539 the library are verified.
1541 A faster way to find out how to adapt your application for use with
1542 `Libshishi' may be to look at the examples at the end of this manual
1543 (@pxref{Examples}).
1545 @menu
1546 * Header::
1547 * Initialization::
1548 * Version Check::
1549 * Building the source::
1550 * Autoconf tests::
1551 @end menu
1553 @node Header
1554 @subsection Header
1556 All interfaces (data types and functions) of the library are defined
1557 in the header file `shishi.h'.  You must include this in all programs
1558 using the library, either directly or through some other header file,
1559 like this:
1561 @example
1562 #include <shishi.h>
1563 @end example
1565 The name space of `Libshishi' is @code{shishi_*} for function names,
1566 @code{Shishi*} for data types and @code{SHISHI_*} for other symbols.  In
1567 addition the same name prefixes with one prepended underscore are
1568 reserved for internal use and should never be used by an application.
1570 @node Initialization
1571 @subsection Initialization
1573 `Libshishi' must be initialized before it can be used.  The library is
1574 initialized by calling @code{shishi_init} (@pxref{Initialization
1575 Functions}).  The resources allocated by the initialization process
1576 can be released if the application no longer has a need to call
1577 `Libshishi' functions, this is done by calling @code{shishi_done}.
1579 In order to take advantage of the internationalisation features in
1580 `Libshishi', such as translated error messages, the application must
1581 set the current locale using @code{setlocale} before initializing
1582 `Libshishi'.
1584 @node Version Check
1585 @subsection Version Check
1587 It is often desirable to check that the version of `Libshishi' used is
1588 indeed one which fits all requirements.  Even with binary
1589 compatibility new features may have been introduced but due to problem
1590 with the dynamic linker an old version is actually used.  So you may
1591 want to check that the version is okay right after program startup.
1593 @include shishi-api-version.texi
1595 The normal way to use the function is to put something similar to the
1596 following early in your @code{main}:
1598 @example
1599   if (!shishi_check_version (SHISHI_VERSION))
1600     @{
1601       printf ("shishi_check_version failed:\n"
1602               "Header file incompatible with shared library.\n");
1603       exit(1);
1604     @}
1605 @end example
1607 @node Building the source
1608 @subsection Building the source
1609 @cindex Compiling your application
1611 If you want to compile a source file including the `shishi.h' header
1612 file, you must make sure that the compiler can find it in the
1613 directory hierarchy.  This is accomplished by adding the path to the
1614 directory in which the header file is located to the compilers include
1615 file search path (via the @option{-I} option).
1617 However, the path to the include file is determined at the time the
1618 source is configured.  To solve this problem, `Libshishi' uses the
1619 external package @command{pkg-config} that knows the path to the
1620 include file and other configuration options.  The options that need
1621 to be added to the compiler invocation at compile time are output by
1622 the @option{--cflags} option to @command{pkg-config shishi}.  The
1623 following example shows how it can be used at the command line:
1625 @example
1626 gcc -c foo.c `pkg-config shishi --cflags`
1627 @end example
1629 Adding the output of @samp{pkg-config shishi --cflags} to the
1630 compilers command line will ensure that the compiler can find the
1631 `Libshishi' header file.
1633 A similar problem occurs when linking the program with the library.
1634 Again, the compiler has to find the library files.  For this to work,
1635 the path to the library files has to be added to the library search path
1636 (via the @option{-L} option).  For this, the option @option{--libs} to
1637 @command{pkg-config shishi} can be used.  For convenience, this option
1638 also outputs all other options that are required to link the program
1639 with the `Libshishi' libararies (in particular, the @samp{-lshishi}
1640 option).  The example shows how to link @file{foo.o} with the `Libshishi'
1641 library to a program @command{foo}.
1643 @example
1644 gcc -o foo foo.o `pkg-config shishi --libs`
1645 @end example
1647 Of course you can also combine both examples to a single command by
1648 specifying both options to @command{pkg-config}:
1650 @example
1651 gcc -o foo foo.c `pkg-config shishi --cflags --libs`
1652 @end example
1654 @node Autoconf tests
1655 @subsection Autoconf tests
1656 @cindex Autoconf tests
1657 @cindex Configure tests
1659 If you work on a project that uses Autoconf (@pxref{top, GNU
1660 Autoconf,, autoconf}) to help find installed libraries, the
1661 suggestions in the previous section are not the entire story.  There
1662 are a few methods to detect and incorporate Shishi into your Autoconf
1663 based package.  The preferred approach, is to use Libtool in your
1664 project, and use the normal Autoconf header file and library tests.
1666 @subsubsection Autoconf test via @samp{pkg-config}
1668 If your audience is a typical GNU/Linux desktop, you can often assume
1669 they have the @samp{pkg-config} tool installed, in which you can use
1670 its Autoconf M4 macro to find and set up your package for use with
1671 Shishi.  The following illustrate this scenario.
1673 @example
1674 AC_ARG_ENABLE(kerberos_v5,
1675         AC_HELP_STRING([--disable-kerberos_v5],
1676                        [don't use the KERBEROS_V5 mechanism]),
1677         kerberos_v5=$enableval)
1678 if test "$kerberos_v5" != "no" ; then
1679         PKG_CHECK_MODULES(SHISHI, shishi >= 0.0.0,
1680                         [kerberos_v5=yes],
1681                         [kerberos_v5=no])
1682         if test "$kerberos_v5" != "yes" ; then
1683                 kerberos_v5=no
1684                 AC_MSG_WARN([shishi not found, disabling Kerberos 5])
1685         else
1686                 kerberos_v5=yes
1687                 AC_DEFINE(USE_KERBEROS_V5, 1,
1688                           [Define to 1 if you want Kerberos 5.])
1689         fi
1691 AC_MSG_CHECKING([if Kerberos 5 should be used])
1692 AC_MSG_RESULT($kerberos_v5)
1693 @end example
1695 @subsubsection Standalone Autoconf test using Libtool
1697 If your package uses Libtool(@pxref{top, GNU Libtool,, libtool}), you
1698 can use the normal Autoconf tests to find the Shishi library and rely
1699 on the Libtool dependency tracking to include the proper dependency
1700 libraries (e.g., Libidn).  The following illustrate this scenario.
1702 @example
1703 AC_CHECK_HEADER(shishi.h,
1704         AC_CHECK_LIB(shishi, shishi_check_version,
1705                 [kerberos5=yes AC_SUBST(SHISHI_LIBS, -lshishi)],
1706                 kerberos5=no),
1707         kerberos5=no)
1708 AC_ARG_ENABLE(kerberos5,
1709         AC_HELP_STRING([--disable-kerberos5],
1710                        [disable Kerberos 5 unconditionally]),
1711         kerberos5=$enableval)
1712 if test "$kerberos5" != "no" ; then
1713         AC_DEFINE(USE_KERBEROS_V5, 1,
1714                   [Define to 1 if you want Kerberos 5.])
1715 else
1716         AC_MSG_WARN([Shishi not found, disabling Kerberos 5])
1718 AC_MSG_CHECKING([if Kerberos 5 should be used])
1719 AC_MSG_RESULT($kerberos5)
1720 @end example
1722 @subsubsection Standalone Autoconf test
1724 If your package does not use Libtool, as well as detecting the Shishi
1725 library as in the previous case, you must also detect whatever
1726 dependencies Shishi requires to work (e.g., libidn).  Since the
1727 dependencies are in a state of flux, we do not provide an example and
1728 we do not recommend this approach, unless you are experienced
1729 developer.
1731 @node Initialization Functions
1732 @section Initialization Functions
1734 @include shishi-api-init.texi
1737 @node Ticket Set Functions
1738 @section Ticket Set Functions
1740 A ``ticket set'' is, as the name implies, a collection of tickets.
1741 Functions are provided to read tickets from file into a ticket set, to
1742 query number of tickets in the set, to extract a given ticket from the
1743 set, to search the ticket set for tickets matching certain criterium,
1744 to write the ticket set to a file, etc.  High level functions for
1745 performing a initial authentication (@pxref{AS Functions}) or
1746 subsequent authentication (@pxref{TGS Functions}) and storing the new
1747 ticket in the ticket set are also provided.
1749 To manipulate each individual ticket, @xref{Ticket Functions}.  For
1750 low-level ASN.1 manipulation see @xref{Ticket (ASN.1) Functions}.
1752 @include shishi-api-tkts.texi
1755 @node AP-REQ and AP-REP Functions
1756 @section AP-REQ and AP-REP Functions
1758 The ``AP-REQ'' and ``AP-REP'' are ASN.1 structures used by application
1759 client and servers to prove to each other who they are.  The
1760 structures contain auxilliary information, together with an
1761 authenticator (@pxref{Authenticator Functions}) which is the real
1762 cryptographic proof.  The following illustrates the AP-REQ and AP-REP
1763 ASN.1 structures.
1765 @verbatim
1766 AP-REQ          ::= [APPLICATION 14] SEQUENCE {
1767         pvno            [0] INTEGER (5),
1768         msg-type        [1] INTEGER (14),
1769         ap-options      [2] APOptions,
1770         ticket          [3] Ticket,
1771         authenticator   [4] EncryptedData {Authenticator,
1772                                 { keyuse-pa-TGSReq-authenticator
1773                                   | keyuse-APReq-authenticator }}
1776 AP-REP          ::= [APPLICATION 15] SEQUENCE {
1777         pvno            [0] INTEGER (5),
1778         msg-type        [1] INTEGER (15),
1779         enc-part        [2] EncryptedData {EncAPRepPart,
1780                                 { keyuse-EncAPRepPart }}
1783 EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
1784         ctime           [0] KerberosTime,
1785         cusec           [1] Microseconds,
1786         subkey          [2] EncryptionKey OPTIONAL,
1787         seq-number      [3] UInt32 OPTIONAL
1789 @end verbatim
1791 @include shishi-api-ap.texi
1794 @node SAFE and PRIV Functions
1795 @section SAFE and PRIV Functions
1797 The ``KRB-SAFE'' is an ASN.1 structure used by application client and
1798 servers to exchange integrity protected data.  The integrity
1799 protection is keyed, usually with a key agreed on via the AP exchange
1800 (@pxref{AP-REQ and AP-REP Functions}).  The following illustrates the
1801 KRB-SAFE ASN.1 structure.
1803 @verbatim
1804    KRB-SAFE        ::= [APPLICATION 20] SEQUENCE {
1805            pvno            [0] INTEGER (5),
1806            msg-type        [1] INTEGER (20),
1807            safe-body       [2] KRB-SAFE-BODY,
1808            cksum           [3] Checksum
1809    }
1811    KRB-SAFE-BODY   ::= SEQUENCE {
1812            user-data       [0] OCTET STRING,
1813            timestamp       [1] KerberosTime OPTIONAL,
1814            usec            [2] Microseconds OPTIONAL,
1815            seq-number      [3] UInt32 OPTIONAL,
1816            s-address       [4] HostAddress,
1817            r-address       [5] HostAddress OPTIONAL
1818    }
1819 @end verbatim
1821 @include shishi-api-safe.texi
1823 The ``KRB-PRIV'' is an ASN.1 structure used by application client and
1824 servers to exchange confidential data.  The confidentiality is keyed,
1825 usually with a key agreed on via the AP exchange (@pxref{AP-REQ and
1826 AP-REP Functions}).  The following illustrates the KRB-PRIV ASN.1
1827 structure.
1829 @verbatim
1830    KRB-PRIV        ::= [APPLICATION 21] SEQUENCE {
1831            pvno            [0] INTEGER (5),
1832            msg-type        [1] INTEGER (21),
1833                            -- NOTE: there is no [2] tag
1834            enc-part        [3] EncryptedData -- EncKrbPrivPart
1835    }
1837    EncKrbPrivPart  ::= [APPLICATION 28] SEQUENCE {
1838            user-data       [0] OCTET STRING,
1839            timestamp       [1] KerberosTime OPTIONAL,
1840            usec            [2] Microseconds OPTIONAL,
1841            seq-number      [3] UInt32 OPTIONAL,
1842            s-address       [4] HostAddress -- sender's addr --,
1843            r-address       [5] HostAddress OPTIONAL -- recip's addr
1844    }
1845 @end verbatim
1847 @include shishi-api-priv.texi
1850 @node Ticket Functions
1851 @section Ticket Functions
1853 @include shishi-api-tkt.texi
1856 @node AS Functions
1857 @section AS Functions
1859 The Authentication Service (AS) is used to get an initial ticket using
1860 e.g. your password.  The following illustrates the AS-REQ and AS-REP
1861 ASN.1 structures.
1863 @verbatim
1864 -- Request --
1866 AS-REQ          ::= KDC-REQ {10}
1868 KDC-REQ {INTEGER:tagnum}        ::= [APPLICATION tagnum] SEQUENCE {
1869         pvno            [1] INTEGER (5) -- first tag is [1], not [0] --,
1870         msg-type        [2] INTEGER (tagnum),
1871         padata          [3] SEQUENCE OF PA-DATA OPTIONAL,
1872         req-body        [4] KDC-REQ-BODY
1875 KDC-REQ-BODY    ::= SEQUENCE {
1876         kdc-options             [0] KDCOptions,
1877         cname                   [1] PrincipalName OPTIONAL
1878                                     -- Used only in AS-REQ --,
1879         realm                   [2] Realm
1880                                     -- Server's realm
1881                                     -- Also client's in AS-REQ --,
1882         sname                   [3] PrincipalName OPTIONAL,
1883         from                    [4] KerberosTime OPTIONAL,
1884         till                    [5] KerberosTime,
1885         rtime                   [6] KerberosTime OPTIONAL,
1886         nonce                   [7] UInt32,
1887         etype                   [8] SEQUENCE OF Int32 -- EncryptionType
1888                                     -- in preference order --,
1889         addresses               [9] HostAddresses OPTIONAL,
1890         enc-authorization-data  [10] EncryptedData {
1891                                         AuthorizationData,
1892                                         { keyuse-TGSReqAuthData-sesskey
1893                                           | keyuse-TGSReqAuthData-subkey }
1894                                      } OPTIONAL,
1895         additional-tickets      [11] SEQUENCE OF Ticket OPTIONAL
1898 -- Reply --
1900 AS-REP          ::= KDC-REP {11, EncASRepPart, {keyuse-EncASRepPart}}
1902 KDC-REP {INTEGER:tagnum,
1903          TypeToEncrypt,
1904          UInt32:KeyUsages}      ::= [APPLICATION tagnum] SEQUENCE {
1905         pvno            [0] INTEGER (5),
1906         msg-type        [1] INTEGER (tagnum),
1907         padata          [2] SEQUENCE OF PA-DATA OPTIONAL,
1908         crealm          [3] Realm,
1909         cname           [4] PrincipalName,
1910         ticket          [5] Ticket,
1911         enc-part        [6] EncryptedData {TypeToEncrypt, KeyUsages}
1914 EncASRepPart    ::= [APPLICATION 25] EncKDCRepPart
1916 EncKDCRepPart   ::= SEQUENCE {
1917         key             [0] EncryptionKey,
1918         last-req        [1] LastReq,
1919         nonce           [2] UInt32,
1920         key-expiration  [3] KerberosTime OPTIONAL,
1921         flags           [4] TicketFlags,
1922         authtime        [5] KerberosTime,
1923         starttime       [6] KerberosTime OPTIONAL,
1924         endtime         [7] KerberosTime,
1925         renew-till      [8] KerberosTime OPTIONAL,
1926         srealm          [9] Realm,
1927         sname           [10] PrincipalName,
1928         caddr           [11] HostAddresses OPTIONAL
1930 @end verbatim
1932 @include shishi-api-as.texi
1935 @node TGS Functions
1936 @section TGS Functions
1938 The Ticket Granting Service (TGS) is used to get subsequent tickets,
1939 authenticated by other tickets (so called ticket granting tickets).
1940 The following illustrates the TGS-REQ and TGS-REP ASN.1 structures.
1942 @verbatim
1943 -- Request --
1945 TGS-REQ         ::= KDC-REQ {12}
1947 KDC-REQ {INTEGER:tagnum}        ::= [APPLICATION tagnum] SEQUENCE {
1948         pvno            [1] INTEGER (5) -- first tag is [1], not [0] --,
1949         msg-type        [2] INTEGER (tagnum),
1950         padata          [3] SEQUENCE OF PA-DATA OPTIONAL,
1951         req-body        [4] KDC-REQ-BODY
1954 KDC-REQ-BODY    ::= SEQUENCE {
1955         kdc-options             [0] KDCOptions,
1956         cname                   [1] PrincipalName OPTIONAL
1957                                     -- Used only in AS-REQ --,
1958         realm                   [2] Realm
1959                                     -- Server's realm
1960                                     -- Also client's in AS-REQ --,
1961         sname                   [3] PrincipalName OPTIONAL,
1962         from                    [4] KerberosTime OPTIONAL,
1963         till                    [5] KerberosTime,
1964         rtime                   [6] KerberosTime OPTIONAL,
1965         nonce                   [7] UInt32,
1966         etype                   [8] SEQUENCE OF Int32 -- EncryptionType
1967                                     -- in preference order --,
1968         addresses               [9] HostAddresses OPTIONAL,
1969         enc-authorization-data  [10] EncryptedData {
1970                                         AuthorizationData,
1971                                         { keyuse-TGSReqAuthData-sesskey
1972                                           | keyuse-TGSReqAuthData-subkey }
1973                                      } OPTIONAL,
1974         additional-tickets      [11] SEQUENCE OF Ticket OPTIONAL
1977 -- Reply --
1979 TGS-REP         ::= KDC-REP {13, EncTGSRepPart,
1980                         { keyuse-EncTGSRepPart-sesskey
1981                           | keyuse-EncTGSRepPart-subkey }}
1983 KDC-REP {INTEGER:tagnum,
1984          TypeToEncrypt,
1985          UInt32:KeyUsages}      ::= [APPLICATION tagnum] SEQUENCE {
1986         pvno            [0] INTEGER (5),
1987         msg-type        [1] INTEGER (tagnum),
1988         padata          [2] SEQUENCE OF PA-DATA OPTIONAL,
1989         crealm          [3] Realm,
1990         cname           [4] PrincipalName,
1991         ticket          [5] Ticket,
1992         enc-part        [6] EncryptedData {TypeToEncrypt, KeyUsages}
1995 EncTGSRepPart   ::= [APPLICATION 26] EncKDCRepPart
1997 EncKDCRepPart   ::= SEQUENCE {
1998         key             [0] EncryptionKey,
1999         last-req        [1] LastReq,
2000         nonce           [2] UInt32,
2001         key-expiration  [3] KerberosTime OPTIONAL,
2002         flags           [4] TicketFlags,
2003         authtime        [5] KerberosTime,
2004         starttime       [6] KerberosTime OPTIONAL,
2005         endtime         [7] KerberosTime,
2006         renew-till      [8] KerberosTime OPTIONAL,
2007         srealm          [9] Realm,
2008         sname           [10] PrincipalName,
2009         caddr           [11] HostAddresses OPTIONAL
2011 @end verbatim
2013 @include shishi-api-tgs.texi
2016 @node Ticket (ASN.1) Functions
2017 @section Ticket (ASN.1) Functions
2019 @include shishi-api-ticket.texi
2021 @node AS/TGS Functions
2022 @section AS/TGS Functions
2024 The Authentication Service (AS) is used to get an initial ticket using
2025 e.g. your password.  The Ticket Granting Service (TGS) is used to get
2026 subsequent tickets using other tickets.  Protocol wise the procedures
2027 are very similar, which is the reason they are described together.
2028 The following illustrates the AS-REQ, TGS-REQ and AS-REP, TGS-REP
2029 ASN.1 structures.  Most of the functions use the mnemonic ``KDC''
2030 instead of either AS or TGS, which means the function operates on both
2031 AS and TGS types.  Only where the distinction between AS and TGS is
2032 important are the AS and TGS names used.  Remember, these are
2033 low-level functions, and normal applications will likely be satisfied
2034 with the AS (@pxref{AS Functions}) and TGS (@pxref{TGS Functions})
2035 interfaces, or the even more high-level Ticket Set (@pxref{Ticket Set
2036 Functions}) interface.
2038 @verbatim
2039 -- Request --
2041 AS-REQ          ::= KDC-REQ {10}
2042 TGS-REQ         ::= KDC-REQ {12}
2044 KDC-REQ {INTEGER:tagnum}        ::= [APPLICATION tagnum] SEQUENCE {
2045         pvno            [1] INTEGER (5) -- first tag is [1], not [0] --,
2046         msg-type        [2] INTEGER (tagnum),
2047         padata          [3] SEQUENCE OF PA-DATA OPTIONAL,
2048         req-body        [4] KDC-REQ-BODY
2051 KDC-REQ-BODY    ::= SEQUENCE {
2052         kdc-options             [0] KDCOptions,
2053         cname                   [1] PrincipalName OPTIONAL
2054                                     -- Used only in AS-REQ --,
2055         realm                   [2] Realm
2056                                     -- Server's realm
2057                                     -- Also client's in AS-REQ --,
2058         sname                   [3] PrincipalName OPTIONAL,
2059         from                    [4] KerberosTime OPTIONAL,
2060         till                    [5] KerberosTime,
2061         rtime                   [6] KerberosTime OPTIONAL,
2062         nonce                   [7] UInt32,
2063         etype                   [8] SEQUENCE OF Int32 -- EncryptionType
2064                                     -- in preference order --,
2065         addresses               [9] HostAddresses OPTIONAL,
2066         enc-authorization-data  [10] EncryptedData {
2067                                         AuthorizationData,
2068                                         { keyuse-TGSReqAuthData-sesskey
2069                                           | keyuse-TGSReqAuthData-subkey }
2070                                      } OPTIONAL,
2071         additional-tickets      [11] SEQUENCE OF Ticket OPTIONAL
2074 -- Reply --
2076 AS-REP          ::= KDC-REP {11, EncASRepPart, {keyuse-EncASRepPart}}
2077 TGS-REP         ::= KDC-REP {13, EncTGSRepPart,
2078                         { keyuse-EncTGSRepPart-sesskey
2079                           | keyuse-EncTGSRepPart-subkey }}
2081 KDC-REP {INTEGER:tagnum,
2082          TypeToEncrypt,
2083          UInt32:KeyUsages}      ::= [APPLICATION tagnum] SEQUENCE {
2084         pvno            [0] INTEGER (5),
2085         msg-type        [1] INTEGER (tagnum),
2086         padata          [2] SEQUENCE OF PA-DATA OPTIONAL,
2087         crealm          [3] Realm,
2088         cname           [4] PrincipalName,
2089         ticket          [5] Ticket,
2090         enc-part        [6] EncryptedData {TypeToEncrypt, KeyUsages}
2093 EncASRepPart    ::= [APPLICATION 25] EncKDCRepPart
2094 EncTGSRepPart   ::= [APPLICATION 26] EncKDCRepPart
2096 EncKDCRepPart   ::= SEQUENCE {
2097         key             [0] EncryptionKey,
2098         last-req        [1] LastReq,
2099         nonce           [2] UInt32,
2100         key-expiration  [3] KerberosTime OPTIONAL,
2101         flags           [4] TicketFlags,
2102         authtime        [5] KerberosTime,
2103         starttime       [6] KerberosTime OPTIONAL,
2104         endtime         [7] KerberosTime,
2105         renew-till      [8] KerberosTime OPTIONAL,
2106         srealm          [9] Realm,
2107         sname           [10] PrincipalName,
2108         caddr           [11] HostAddresses OPTIONAL
2110 @end verbatim
2112 @include shishi-api-kdc.texi
2115 @node Authenticator Functions
2116 @section Authenticator Functions
2118 An ``Authenticator'' is a ASN.1 structure that work as a proof that an
2119 entity owns a ticket.  It is usually embedded in the AP-REQ structure
2120 (@pxref{AP-REQ and AP-REP Functions}), and you most likely want to use
2121 an AP-REQ instead of a Authenticator in normal applications.  The
2122 following illustrates the Authenticator ASN.1 structure.
2124 @verbatim
2125 Authenticator   ::= [APPLICATION 2] SEQUENCE  {
2126         authenticator-vno       [0] INTEGER (5),
2127         crealm                  [1] Realm,
2128         cname                   [2] PrincipalName,
2129         cksum                   [3] Checksum OPTIONAL,
2130         cusec                   [4] Microseconds,
2131         ctime                   [5] KerberosTime,
2132         subkey                  [6] EncryptionKey OPTIONAL,
2133         seq-number              [7] UInt32 OPTIONAL,
2134         authorization-data      [8] AuthorizationData OPTIONAL
2136 @end verbatim
2138 @include shishi-api-authenticator.texi
2141 @node Cryptographic Functions
2142 @section Cryptographic Functions
2144 Underneath the high-level functions described earlier, cryptographic
2145 operations are happening.  If you need to access these cryptographic
2146 primitives directly, this section describes the functions available.
2148 Most cryptographic operations need keying material, and cryptographic
2149 keys have been isolated into it's own data structure
2150 @code{Shishi_key}.  The following illustrates it's contents, but note
2151 that you cannot access it's elements directly but must use the
2152 accessor functions described below.
2154 @verbatim
2155 struct Shishi_key
2157   int type;    /* RFC 1510 encryption integer type */
2158   char *value; /* Cryptographic key data */
2159   int version; /* RFC 1510 ``kvno'' */
2161 @end verbatim
2163 All functions that operate on this data structure are described now.
2165 @include shishi-api-key.texi
2167 Applications that run uninteractively may need keying material.  In
2168 these cases, the keys are stored in a file, a file that is normally
2169 stored on the local host.  The file should be protected from
2170 unauthorized access.  The file is in ASCII format and contains keys as
2171 outputed by @code{shishi_key_print}.  All functions that handle these
2172 keys sets are described now.
2174 @include shishi-api-keys.texi
2176 The previous functions require that the filename is known.  For some
2177 applications, servers, it makes sense to provide a system default.
2178 These key sets used by server applications are known as ``hostkeys''.
2179 Here are the functions that operate on hostkeys (they are mostly
2180 wrappers around generic key sets).
2182 @include shishi-api-hostkeys.texi
2184 After creating the key structure, it can be used to encrypt and
2185 decrypt data, calculate checksum on data etc.  All available functions
2186 are described now.
2188 @include shishi-api-crypto.texi
2190 Also included in Shishi is an interface to the really low-level
2191 cryptographic primitives.  They map directly on the underlying
2192 cryptographic library used (e.g., Nettle) and is used internally by
2193 Shishi.
2195 @include shishi-api-nettle.texi
2198 @node Utility Functions
2199 @section Utility Functions
2201 @include shishi-api-utility.texi
2204 @node Error Handling
2205 @section Error Handling
2206 @cindex Error Handling
2208 Most functions in `Libshishi' are returning an error if they fail.
2209 For this reason, the application should always catch the error
2210 condition and take appropriate measures, for example by releasing the
2211 resources and passing the error up to the caller, or by displaying a
2212 descriptive message to the user and cancelling the operation.
2214 Some error values do not indicate a system error or an error in the
2215 operation, but the result of an operation that failed properly.
2217 @menu
2218 * Error Values::                A list of all error values used.
2219 * Error Functions::             Error handling related functions.
2220 @end menu
2222 @node Error Values
2223 @subsection Error Values
2225 Errors are returned as an @code{int}.  Except for the SHISHI_OK case,
2226 an application should always use the constants instead of their
2227 numeric value.  Applications are encouraged to use the constants even
2228 for SHISHI_OK as it improves readability.  Possible values are:
2230 @table @code
2231 @item SHISHI_OK
2232 This value indicates success.  The value of this error is guaranteed
2233 to always be @code{0} so you may use it in boolean constructs.
2235 @include shishi-api-error-labels.texi
2237 @end table
2239 @node Error Functions
2240 @subsection Error Functions
2242 @include shishi-api-error.texi
2244 @node Examples
2245 @section Examples
2246 @cindex Examples
2248 This section will be extended to contain walk-throughs of example code
2249 that demonstrate how `Shishi' is used to write your own applications
2250 that support Kerberos 5.  The rest of the current section consists of
2251 some crude hints for the example client/server applications that is
2252 part of Shishi, taken from an email but saved here for lack of a
2253 better place to put it.
2255 There are two programs: 'client' and 'server' in src/.
2257 The client output an AP-REQ, waits for an AP-REP, and then simply
2258 reads data from stdin.
2260 The server waits for an AP-REQ, parses it and prints an AP-REP, and
2261 then read data from stdin.
2263 Both programs accept a Kerberos server name as the first command line
2264 argument.  Your KDC must know this server, since the client tries to
2265 get a ticket for it (first it gets a ticket granting ticket for the
2266 default username), and you must write the key for the server into
2267 /usr/local/etc/shishi.keys on the Shishi format, e.g.:
2269 @example
2270 -----BEGIN SHISHI KEY-----
2271 Keytype: 16 (des3-cbc-sha1-kd)
2272 Principal: sample/latte.josefsson.org
2273 Realm: JOSEFSSON.ORG
2275 8W0VrQQBpxlACPQEqN91EHxbvFFo2ltt
2276 -----END SHISHI KEY-----
2277 @end example
2279 You must extract the proper encryption key from the KDC in some way.
2280 (This part will be easier when Shishi include a KDC, a basic one isn't
2281 far away, give me a week or to.)
2283 The intention is that the data read, after the authentication phase,
2284 should be protected using KRB_SAFE (see RFC) but I haven't added this
2285 yet.
2287 @node Generic Security Service
2288 @section Generic Security Service
2289 @cindex Generic Security Service
2290 @cindex GSS-API
2291 @cindex GSSLib
2293 As an alternative to the native Shishi programming API, it is possible
2294 to program Shishi through the Generic Security Services (GSS) API.
2295 The advantage of using GSS-API in your security application, instead
2296 of the native Shishi API, is that it will be easier to port your
2297 application between different Kerberos 5 implementations, and even
2298 beyond Kerberos 5 to different security systems, that support GSS-API.
2299 In the free software world, however, almost the only widely used
2300 security system that supports GSS-API is Kerberos 5, so the last
2301 advantage is somewhat academic.  But if you are porting applications
2302 using GSS-API for other Kerberos 5 implementations, or want a more
2303 mature and stable API than the native Shishi API, you may find using
2304 Shishi's GSS-API interface compelling.  Note that GSS-API only offer
2305 basic services, for more advanced uses you must use the native API.
2307 Since the GSS-API is not specific to Shishi, it is distributed
2308 independently from Shishi.  Further information on the GSS project can
2309 be found at @url{http://josefsson.org/gss/}.
2311 @c **********************************************************
2312 @c *******************  Acknowledgements  *******************
2313 @c **********************************************************
2314 @node Acknowledgements
2315 @chapter Acknowledgements
2317 Shishi uses Libtasn1 by Fabio Fiorina, Libnettle by Niels Möller,
2318 Libgcrypt and Libgpg-error by Werner Koch, Libidn by Simon Josefsson,
2319 cvs2cl by Karl Fogel, and gdoc by Michael Zucchi.
2321 Several GNU packages simplified development considerably, those
2322 packages include Autoconf, Automake, Libtool, Gnulib, Gettext, Indent,
2323 CVS, Texinfo, Help2man and Emacs.
2325 Several people reported bugs, sent patches or suggested improvements,
2326 see the file THANKS.
2328 This manual borrows text from the Kerberos 5 specification.
2330 @c **********************************************************
2331 @c *******************  Appendices  *************************
2332 @c **********************************************************
2334 @node Copying This Manual
2335 @appendix Copying This Manual
2337 @menu
2338 * GNU Free Documentation License::  License for copying this manual.
2339 @end menu
2341 @include fdl.texi
2343 @include gpl.texi
2345 @node Concept Index
2346 @unnumbered Concept Index
2348 @printindex cp
2350 @node Function and Data Index
2351 @unnumbered Function and Data Index
2353 @printindex fn
2355 @summarycontents
2356 @contents
2357 @bye