1 \input texinfo @c -*- Texinfo -*-
2 @c Copyright (C) 2002, 2003 Simon Josefsson
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
15 @settitle The Shishi Manual
17 @c Unify some of the indices.
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.
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
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.''
42 @dircategory Net Utilities
44 * shishi: (shishi). A Kerberos 5 implementation
48 @title The Shishi Manual
49 @subtitle for version @value{VERSION}, @value{UPDATED}
50 @author Simon Josefsson (@email{bug-shishi@@josefsson.org})
52 @vskip 0pt plus 1filll
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.
74 * Copying This Manual:: How you can copy and share this manual.
75 * Copying:: How you can copy and share the source.
79 * Concept Index:: Index of concepts and programs.
80 * Function and Data Index:: Index of functions, variables and data types.
84 @c **********************************************************
85 @c ******************** Introduction **********************
86 @c **********************************************************
90 Shishi implements the Kerberos 5 network security system.
94 * Features and Status::
96 * Cryptographic Overview::
97 * Supported Platforms::
98 * Downloading and Installing::
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
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
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'
142 It should work on all Unix like operating systems, including Windows.
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.
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.
185 This is used to login locally on a machine.
187 @item KDC addresses located using DNS SRV RRs.
191 The following table summarize what the current objectives are (i.e.,
192 the todo list) and an estimate on how long it will take to implement
193 the feature. If you like to start working on anything, please let me
194 know so work duplication can be avoided.
198 @item Pre-authentication support (week).
200 @item Cross-realm support (week).
202 @item PKINIT (use libksba, weeks)
204 @item Finish GSSAPI support via GSSLib (weeks)
205 Shishi will not support GSSLib natively, but a separate project
206 ``GSSLib'' is under way to produce a generic GSS implementation, and
207 it will use Shishi to implement the Kerberos 5 mechanism.
209 @item Port to cyclone (cyclone need to mature first)
211 @item Modularize ASN.1 library so it can be replaced (days).
212 Almost done, all ASN.1 functionality is found in lib/asn1.c, although
213 the interface is rather libtasn1 centric.
215 @item Modularize Crypto library so it can be replaced (days).
216 Nettle and libgcrypt are currently supported, but not via an abstract
217 interface. All crypto operations has been isolated into
220 @item KDC (initiated, weeks)
222 @item Set/Change password protocol (weeks?)
224 @item Port applications to use Shishi (indefinite)
226 @item Improve documentation
228 @item Improve internationalization
230 @item Add AP-REQ replay cache (week).
232 @item Study benefits by introducing a PA-TGS-REP.
233 This would provide mutual authentication of the KDC in a way that is
234 easier to analyze. Currently the mutual authentication property is
235 only implicit from successful decryption of the KDC-REP and the 4 byte
243 This section describes RFC 1510 from a protocol point of
244 view@footnote{The text is a lightly adapted version of the
245 introduction section from RFC 1510 by J. Kohl and C. Neuman, September
246 1993, unclear copyrights, but presumably owned by The Internet
249 Kerberos provides a means of verifying the identities of principals,
250 (e.g., a workstation user or a network server) on an open
251 (unprotected) network. This is accomplished without relying on
252 authentication by the host operating system, without basing trust on
253 host addresses, without requiring physical security of all the hosts
254 on the network, and under the assumption that packets traveling along
255 the network can be read, modified, and inserted at will. (Note,
256 however, that many applications use Kerberos' functions only upon the
257 initiation of a stream-based network connection, and assume the
258 absence of any "hijackers" who might subvert such a connection. Such
259 use implicitly trusts the host addresses involved.) Kerberos performs
260 authentication under these conditions as a trusted third- party
261 authentication service by using conventional cryptography, i.e.,
262 shared secret key. (shared secret key - Secret and private are often
263 used interchangeably in the literature. In our usage, it takes two
264 (or more) to share a secret, thus a shared DES key is a secret key.
265 Something is only private when no one but its owner knows it. Thus,
266 in public key cryptosystems, one has a public and a private key.)
268 The authentication process proceeds as follows: A client sends a
269 request to the authentication server (AS) requesting "credentials" for
270 a given server. The AS responds with these credentials, encrypted in
271 the client's key. The credentials consist of 1) a "ticket" for the
272 server and 2) a temporary encryption key (often called a "session
273 key"). The client transmits the ticket (which contains the client's
274 identity and a copy of the session key, all encrypted in the server's
275 key) to the server. The session key (now shared by the client and
276 server) is used to authenticate the client, and may optionally be used
277 to authenticate the server. It may also be used to encrypt further
278 communication between the two parties or to exchange a separate
279 sub-session key to be used to encrypt further communication.
281 The implementation consists of one or more authentication servers
282 running on physically secure hosts. The authentication servers
283 maintain a database of principals (i.e., users and servers) and their
284 secret keys. Code libraries provide encryption and implement the
285 Kerberos protocol. In order to add authentication to its
286 transactions, a typical network application adds one or two calls to
287 the Kerberos library, which results in the transmission of the
288 necessary messages to achieve authentication.
290 The Kerberos protocol consists of several sub-protocols (or
291 exchanges). There are two methods by which a client can ask a
292 Kerberos server for credentials. In the first approach, the client
293 sends a cleartext request for a ticket for the desired server to the
294 AS. The reply is sent encrypted in the client's secret key. Usually
295 this request is for a ticket-granting ticket (TGT) which can later be
296 used with the ticket-granting server (TGS). In the second method, the
297 client sends a request to the TGS. The client sends the TGT to the
298 TGS in the same manner as if it were contacting any other application
299 server which requires Kerberos credentials. The reply is encrypted in
300 the session key from the TGT.
302 Once obtained, credentials may be used to verify the identity of the
303 principals in a transaction, to ensure the integrity of messages
304 exchanged between them, or to preserve privacy of the messages. The
305 application is free to choose whatever protection may be necessary.
307 To verify the identities of the principals in a transaction, the
308 client transmits the ticket to the server. Since the ticket is sent
309 "in the clear" (parts of it are encrypted, but this encryption doesn't
310 thwart replay) and might be intercepted and reused by an attacker,
311 additional information is sent to prove that the message was
312 originated by the principal to whom the ticket was issued. This
313 information (called the authenticator) is encrypted in the session
314 key, and includes a timestamp. The timestamp proves that the message
315 was recently generated and is not a replay. Encrypting the
316 authenticator in the session key proves that it was generated by a
317 party possessing the session key. Since no one except the requesting
318 principal and the server know the session key (it is never sent over
319 the network in the clear) this guarantees the identity of the client.
321 The integrity of the messages exchanged between principals can also be
322 guaranteed using the session key (passed in the ticket and contained
323 in the credentials). This approach provides detection of both replay
324 attacks and message stream modification attacks. It is accomplished
325 by generating and transmitting a collision-proof checksum (elsewhere
326 called a hash or digest function) of the client's message, keyed with
327 the session key. Privacy and integrity of the messages exchanged
328 between principals can be secured by encrypting the data to be passed
329 using the session key passed in the ticket, and contained in the
332 @node Cryptographic Overview
333 @section Cryptographic Overview
335 Shishi implements several of the standard cryptographic primitives.
336 Here are the names of the supported encryption suites, with some notes
337 on their status and there associated checksum suite. They are ordered
338 by increased security as perceived by the author.
348 @code{NULL} is a dummy encryption suite for debugging. Encryption and
349 decryption are identity functions. No integrity protection. It is
350 weak. It is associated with the @code{NULL} checksum.
354 @code{des-cbc-crc} is DES encryption and decryption with 56 bit keys
355 and 8 byte blocks in CBC mode. The keys can be derived from passwords
356 by an obscure application specific algorithm. Data is integrity
357 protected with an unkeyed but encrypted @code{CRC32}-like checksum.
358 It is weak. It is associated with the @code{rsa-md5-des} checksum.
362 @code{des-cbc-md4} is DES encryption and decryption with 56 bit keys
363 and 8 byte blocks in CBC mode. The keys can be derived from passwords
364 by an obscure application specific algorithm. Data is integrity
365 protected with an unkeyed but encrypted MD4 hash. It is weak. It is
366 associated with the @code{rsa-md4-des} checksum.
370 @code{des-cbc-md5} is DES encryption and decryption with 56 bit keys
371 and 8 byte blocks in CBC mode. The keys can be derived from passwords
372 by an obscure application specific algorithm. Data is integrity
373 protected with an unkeyed but encrypted MD5 hash. It is weak. It is
374 associated with the @code{rsa-md5-des} checksum. This is the
375 strongest RFC 1510 interoperable mechanism.
377 @item des3-cbc-sha1-kd
379 @code{des3-cbc-sha1-kd} is DES encryption and decryption with three 56
380 bit keys (effective key size 112 bits) and 8 byte blocks in CBC
381 mode. The keys can be derived from passwords by a algorithm based on
382 the paper "A Better Key Schedule For DES-like Ciphers"
383 @footnote{@url{http://www.research.att.com/~smb/papers/ides.pdf}} by
384 Uri Blumenthal and Steven M. Bellovin (it is not clear if the
385 algorithm, and the way it is used, is used by any other protocols,
386 although it seems unlikely). Data is integrity protected with a keyed
387 SHA1 hash in HMAC mode. It has no security proof, but is assumed to
388 provide adequate security in the sense that knowledge on how to crack
389 it is not known to the public. Note that the key derivation function
390 is not widely used outside of Kerberos, hence not widely studied. It
391 is associated with the @code{hmac-sha1-des3-kd} checksum.
393 @item aes128-cts-hmac-sha1-96
394 @item aes256-cts-hmac-sha1-96.
396 @code{aes128-cts-hmac-sha1-96} and @code{aes256-cts-hmac-sha1-96} is
397 AES encryption and decryption with 128 bit and 256 bit key,
398 respectively, and 16 byte blocks in CBC mode with Cipher Text
399 Stealing. Cipher Text Stealing means data length of encrypted data is
400 preserved (pure CBC add up to 7 pad characters). The keys can be
401 derived from passwords with RSA Laboratories PKCS#5 Password Based Key
403 2@footnote{@url{http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/}},
404 which is allegedly provably secure in a random oracle model. Data is
405 integrity protected with a keyed SHA1 hash, in HMAC mode, truncated to
406 96 bits. There is no security proof, but the schemes are assumed to
407 provide adequate security in the sense that knowledge on how to crack
408 them is not known to the public. Note that AES has yet to receive the
409 test of time, and the CBC variation used is not widely standardized
410 (hence not widely studied). It is associated with the
411 @code{hmac-sha1-96-aes128} and @code{hmac-sha1-96-aes256} checksums,
416 The protocol do not include any way to negotiate which checksum
417 mechanisms to use, so in most cases the associated checksum will be
418 used. However, checksum mechanisms can be used with other encryption
419 mechanisms, as long as they are compatible in terms of key format etc.
420 Here are the names of the supported checksum mechanisms, with some
421 notes on their status and the compatible encryption mechanisms. They
422 are ordered by increased security as perceived by the author.
428 @code{NULL} is a dummy checksum suite for debugging. It provides no
429 integrity. It is weak. It is compatible with the @code{NULL}
430 encryption mechanism.
434 @code{rsa-md4} is a unkeyed MD4 hash computed over the message. Since
435 it is unkeyed, it is in general a weak checksum, however applications
436 can, with care, use it non-weak ways (e.g., by including the hash in
437 other messages that are encrypted or checksummed). It is compatible
438 with all encryption mechanisms.
442 @code{rsa-md4-des} is a DES CBC encryption of one block of random data
443 and a unkeyed MD4 hash computed over the random data and the message
444 to integrity protect. The key used is derived from the base protocol
445 key by XOR with a constant. It is weak. It is compatible with the
446 @code{des-cbc-crc}, @code{des-cbc-md4}, @code{des-cbc-md5} encryption
451 @code{rsa-md5} is a unkeyed MD5 hash computed over the message. Since
452 it is unkeyed, it is in general a weak checksum, however applications
453 can, with care, use it non-weak ways (e.g., by including the hash in
454 other messages that are encrypted or checksummed). It is compatible
455 with all encryption mechanisms.
459 @code{rsa-md5-des} is a DES CBC encryption of one block of random data
460 and a unkeyed MD5 hash computed over the random data and the message
461 to integrity protect. The key used is derived from the base protocol
462 key by XOR with a constant. It is weak. It is compatible with the
463 @code{des-cbc-crc}, @code{des-cbc-md4}, @code{des-cbc-md5} encryption
466 @item hmac-sha1-des3-kd
468 @code{hmac-sha1-des3-kd} is a keyed SHA1 hash in HMAC mode computed
469 over the message. The key is derived from the base protocol by the
470 simplified key derivation function (similar to the password key
471 derivation functions of @code{des3-cbc-sha1-kd}). It has no security
472 proof, but is assumed to provide good security, if the key derivation
473 function is good. It is compatible with the @code{des3-cbc-sha1-kd}
474 encryption mechanism.
476 @item hmac-sha1-96-aes128
477 @item hmac-sha1-96-aes256
479 @code{hmac-sha1-96-aes*} are keyed SHA1 hashes in HMAC mode computed
480 over the message and then truncated to 96 bits. The key is derived
481 from the base protocol by the simplified key derivation function
482 (similar to the password key derivation functions of
483 @code{des3-cbc-sha1-kd}). It has no security proof, but is assumed to
484 provide good security, if the key derivation function is good. It is
485 compatible with the @code{aes*-cts-hmac-sha1-96} encryption
491 @node Supported Platforms
492 @section Supported Platforms
494 Shishi has at some point in time been tested on the following
495 platforms. Online build reports for each platforms and Shishi version
496 is available at @url{http://josefsson.org/autobuild/}.
500 @item Debian GNU/Linux 3.0 (Woody)
503 GCC 2.95.4 and GNU Make. This is the main development platform.
504 @code{alphaev67-unknown-linux-gnu}, @code{alphaev6-unknown-linux-gnu},
505 @code{arm-unknown-linux-gnu}, @code{armv4l-unknown-linux-gnu},
506 @code{hppa-unknown-linux-gnu}, @code{hppa64-unknown-linux-gnu},
507 @code{i686-pc-linux-gnu}, @code{ia64-unknown-linux-gnu},
508 @code{m68k-unknown-linux-gnu}, @code{mips-unknown-linux-gnu},
509 @code{mipsel-unknown-linux-gnu}, @code{powerpc-unknown-linux-gnu},
510 @code{s390-ibm-linux-gnu}, @code{sparc-unknown-linux-gnu},
511 @code{sparc64-unknown-linux-gnu}.
513 @item Debian GNU/Linux 2.1
516 GCC 2.95.4 and GNU Make. @code{armv4l-unknown-linux-gnu}.
521 Tru64 UNIX C compiler and Tru64 Make. @code{alphaev67-dec-osf5.1},
522 @code{alphaev68-dec-osf5.1}.
527 GCC 2.96 and GNU Make. @code{alphaev6-unknown-linux-gnu},
528 @code{alphaev67-unknown-linux-gnu}.
530 @item SuSE Linux 7.2a
533 GCC 3.0 and GNU Make. @code{ia64-unknown-linux-gnu}.
538 GCC 3.2.2 and GNU Make. @code{x86_64-unknown-linux-gnu} (AMD64
541 @item RedHat Linux 7.2
544 GCC 2.96 and GNU Make. @code{alphaev6-unknown-linux-gnu},
545 @code{alphaev67-unknown-linux-gnu}, @code{ia64-unknown-linux-gnu}.
547 @item RedHat Linux 8.0
550 GCC 3.2 and GNU Make. @code{i686-pc-linux-gnu}.
552 @item RedHat Advanced Server 2.1
553 @cindex RedHat Advanced Server
555 GCC 2.96 and GNU Make. @code{i686-pc-linux-gnu}.
557 @item Slackware Linux 8.0.01
560 GCC 2.95.3 and GNU Make. @code{i686-pc-linux-gnu}.
562 @item Mandrake Linux 9.0
565 GCC 3.2 and GNU Make. @code{i686-pc-linux-gnu}.
570 MIPS C compiler, IRIX Make. @code{mips-sgi-irix6.5}.
575 IBM C for AIX compiler, AIX Make. @code{rs6000-ibm-aix4.3.2.0}.
577 @c @item Microsoft Windows 2000 (Cygwin)
580 @c GCC 3.2, GNU make. @code{i686-pc-cygwin}.
585 HP-UX C compiler and HP Make. @code{ia64-hp-hpux11.22},
586 @code{hppa2.0w-hp-hpux11.11}.
588 @item SUN Solaris 2.8
591 Sun WorkShop Compiler C 6.0 and SUN Make. @code{sparc-sun-solaris2.8}.
596 GCC 2.95.3 and GNU Make. @code{alpha-unknown-netbsd1.6},
597 @code{i386-unknown-netbsdelf1.6}.
599 @item OpenBSD 3.1 and 3.2
602 GCC 2.95.3 and GNU Make. @code{alpha-unknown-openbsd3.1},
603 @code{i386-unknown-openbsd3.1}.
605 @item FreeBSD 4.7 and 4.8
608 GCC 2.95.4 and GNU Make. @code{alpha-unknown-freebsd4.7},
609 @code{alpha-unknown-freebsd4.8}, @code{i386-unknown-freebsd4.7},
610 @code{i386-unknown-freebsd4.8}.
614 If you use Shishi on, or port Shishi to, a new platform please report
615 it to the author (@pxref{Bug Reports}).
617 @node Downloading and Installing
618 @section Downloading and Installing
622 The package can be downloaded from several places, including
623 @url{http://josefsson.org/shishi/releases/}. The latest version is
624 stored in a file, e.g., @samp{shishi-0.0.42.tar.gz} where the
625 @samp{0.0.42} indicate the highest version number.
627 The package is then extracted, configured and built like many other
628 packages that use Autoconf. For detailed information on configuring
629 and building it, refer to the @file{INSTALL} file that is part of the
630 distribution archive.
632 Here is an example terminal session that download, configure, build
633 and install the package. You will need a few basic tools, such as
634 @samp{sh}, @samp{make} and @samp{cc}.
637 $ wget -q http://josefsson.org/shishi/releases/shishi-0.0.4.tar.gz
638 $ tar xfz shishi-0.0.4.tar.gz
648 After this you should be prepared to continue with the user,
649 administration or programming manual, depending on how you want to use
654 @cindex Reporting Bugs
656 If you think you have found a bug in Shishi, please investigate it and
661 @item Please make sure that the bug is really in Shishi, and
662 preferably also check that it hasn't already been fixed in the latest
665 @item You have to send us a test case that makes it possible for us to
668 @item You also have to explain what is wrong; if you get a crash, or
669 if the results printed are not good and in that case, in what way.
670 Make sure that the bug report includes all information you would need
671 to fix this kind of bug for someone else.
675 Please make an effort to produce a self-contained report, with
676 something definite that can be tested or debugged. Vague queries or
677 piecemeal messages are difficult to act on and don't help the
680 If your bug report is good, we will do our best to help you to get a
681 corrected version of the software; if the bug report is poor, we won't
682 do anything about it (apart from asking you to send better bug
685 If you think something in this manual is unclear, or downright
686 incorrect, or if the language needs to be improved, please also send a
689 Send your bug report to:
691 @center @samp{bug-shishi@@josefsson.org}
694 @section Contributing
698 If you want to submit a patch for inclusion -- from solve a typo you
699 discovered, up to adding support for a new feature -- you should
700 submit it as a bug report (@pxref{Bug Reports}). There are some
701 things that you can do to increase the chances for it to be included
702 in the official package.
704 Unless your patch is very small (say, under 10 lines) we require that
705 you assign the copyright of your work to the Free Software Foundation.
706 This is to protect the freedom of the project. If you have not
707 already signed papers, we will send you the necessary information when
708 you submit your contribution.
710 For contributions that doesn't consist of actual programming code, the
711 only guidelines are common sense. Use it.
713 For code contributions, a number of style guides will help you:
718 Follow the GNU Standards document (@pxref{top, GNU Coding Standards,,
721 If you normally code using another coding standard, there is no
722 problem, but you should use @samp{indent} to reformat the code
723 (@pxref{top, GNU Indent,, indent}) before submitting your work.
725 @item Use the unified diff format @samp{diff -u}.
728 The only valid reason for ever aborting the execution of the program
729 is due to memory allocation errors, but for that you should call
730 @samp{xalloc_die} to allow the application to recover if it wants to.
732 @item Design with thread safety in mind.
733 Don't use global variables. Don't even write to per-handle global
734 variables unless the documented behaviour of the function you write is
735 to write to the per-handle global variable.
737 @item Avoid using the C math library.
738 It causes problems for embedded implementations, and in most
739 situations it is very easy to avoid using it.
741 @item Document your functions.
742 Use comments before each function headers, that, if properly
743 formatted, are extracted into Texinfo manuals and GTK-DOC web pages.
745 @item Supply a ChangeLog and NEWS entries, where appropriate.
749 @c **********************************************************
750 @c ******************** User Manual **********************
751 @c **********************************************************
754 @cindex End-user Shishi usage
756 Usually Shishi interacts with you to get some initial authentication
757 information like a password, and then contacts a server to receive a
758 so called ticket granting ticket. From now on, you rarely interacts
759 with Shishi directly. Applications that needs security services
760 instruct the Shishi library to use the ticket granting ticket to get
761 new tickets for various servers. An example could be if you log on to
762 a host remotely via @samp{telnet}. The host usually requires
763 authentication before permitting you in. The @samp{telnet} client
764 uses the ticket granting ticket to get a ticket for the server, and
765 then use this ticket to authenticate you against the server (typically
766 the server is also authenticated to you). You perform the initial
767 authentication by typing @command{shishi} at the prompt. Sometimes it
768 is necessary to supply options telling Shishi what your principal name
769 (user name in the Kerberos realm) or realm is. In the example, I
770 specify the client name @code{simon@@JOSEFSSON.ORG}.
774 $ shishi simon@@JOSEFSSON.ORG
775 Enter password for `simon@@JOSEFSSON.ORG':
776 simon@@JOSEFSSON.ORG:
777 Authtime: Fri Aug 15 04:44:49 2003
778 Endtime: Fri Aug 15 05:01:29 2003
779 Server: krbtgt/JOSEFSSON.ORG key des3-cbc-sha1-kd (16)
780 Ticket key: des3-cbc-sha1-kd (16) protected by des3-cbc-sha1-kd (16)
781 Ticket flags: INITIAL (512)
786 As you can see, Shishi also prints a short description of the ticket
789 A logical next step is to display all tickets you have received (by
790 the way, the tickets are usually stored as text in
791 @file{~/.shishi/tickets}). This is achieved by typing @command{shishi
797 Tickets in `/home/jas/.shishi/tickets':
800 Authtime: Fri Aug 15 04:49:46 2003
801 Endtime: Fri Aug 15 05:06:26 2003
802 Server: krbtgt/JOSEFSSON.ORG key des-cbc-md5 (3)
803 Ticket key: des-cbc-md5 (3) protected by des-cbc-md5 (3)
804 Ticket flags: INITIAL (512)
807 Authtime: Fri Aug 15 04:49:46 2003
808 Starttime: Fri Aug 15 04:49:49 2003
809 Endtime: Fri Aug 15 05:06:26 2003
810 Server: host/latte.josefsson.org key des-cbc-md5 (3)
811 Ticket key: des-cbc-md5 (3) protected by des-cbc-md5 (3)
818 As you can see, I had a ticket for the server
819 @samp{host/latte.josefsson.org} which was generated by
820 @samp{telnet}:ing to that host.
822 If, for some reason, you want to manually get a ticket for a specific
823 server, you can use the @command{shishi --server-name} command.
824 Normally, however, the application that uses Shishi will take care of
825 getting a ticket for the appropriate server, so you normally wouldn't
830 $ shishi --server-name=user/billg --encryption-type=des-cbc-md4
832 Authtime: Fri Aug 15 04:49:46 2003
833 Starttime: Fri Aug 15 04:54:33 2003
834 Endtime: Fri Aug 15 05:06:26 2003
835 Server: user/billg key des-cbc-md4 (2)
836 Ticket key: des-cbc-md4 (2) protected by des-cbc-md5 (3)
841 As you can see, I acquired a ticket for @samp{user/billg} with a
842 @samp{des-cbc-md4} (@pxref{Cryptographic Overview}) encryption key
843 specified with the @samp{--encryption-type} parameter.
845 To wrap up this introduction, lets see how you can remove tickets.
846 You may want to do this if you leave your terminal for lunch or
847 similar, and don't want someone to be able to copy the file and then
848 use your credentials. Note that this only destroy the tickets
849 locally, it does not contact any server and tell it that these
850 credentials are no longer valid. So if someone stole your ticket
851 file, you must contact your administrator and have them reset your
852 account, simply using this parameter is not sufficient.
856 $ shishi --server-name=imap/latte.josefsson.org --destroy
858 $ shishi --server-name=foobar --destroy
866 Since the @samp{--server-name} parameter takes a long to type, it is
867 possible to type the server name directly, after the client name. The
868 following example demonstrate a AS-REQ followed by a TGS-REQ for a
869 specific server (assuming you did not have any tickets from the
874 $ src/shishi simon@@latte.josefsson.org imap/latte.josefsson.org
875 Enter password for `simon@@latte.josefsson.org':
876 simon@@latte.josefsson.org:
877 Acquired: Wed Aug 27 17:21:06 2003
878 Expires: Wed Aug 27 17:37:46 2003
879 Server: imap/latte.josefsson.org key aes256-cts-hmac-sha1-96 (18)
880 Ticket key: aes256-cts-hmac-sha1-96 (18) protected by aes256-cts-hmac-sha1-96 (18)
881 Ticket flags: FORWARDED PROXIABLE (12)
886 Refer to the reference manual for all available parameters
887 (@pxref{Parameters for shishi}).
889 @c **********************************************************
890 @c **************** Administration Manual *****************
891 @c **********************************************************
892 @node Administration Manual
893 @chapter Administration Manual
895 This section describe how you get the KDC server up and running to
896 answer queries from clients.
898 First you must create a user database. Currently this is rather
899 simplistic, and the database only contains cryptographic keys. Use
900 the @samp{shishi --string-to-key} command to generate keys, and store
901 them in the @file{shishid.keys} file. The file path is
902 @file{/usr/local/etc/shishid.keys} by default, although you can use
903 @samp{shishid -k} to specify another location.
905 Create a random key for the Kerberos Ticket Granting Service for your
910 $ shishi --string-to-key --random \
911 krbtgt/latte.josefsson.org@@latte.josefsson.org | \
912 tee /usr/local/etc/shishid.keys
913 -----BEGIN SHISHI KEY-----
914 Keytype: 18 (aes256-cts-hmac-sha1-96)
915 Principal: krbtgt/latte.josefsson.org
916 Realm: latte.josefsson.org
918 oconxMTf59B5bvTylY+KE4mchA/gtmYI2Qok+48tnSM=
919 -----END SHISHI KEY-----
924 Create a key for a user from a specified password:
928 $ shishi --string-to-key=fnord \
929 simon@@latte.josefsson.org | tee --append \
930 /usr/local/etc/shishid.keys
931 -----BEGIN SHISHI KEY-----
932 Keytype: 18 (aes256-cts-hmac-sha1-96)
934 Realm: latte.josefsson.org
936 c1rqwvYwuDFrABvqWVq9bWUsQWg/xbErsIUmLN+3lYM=
937 -----END SHISHI KEY-----
942 There is nothing special with a ticket granting key, you could have
943 created it based on a password similar to the user key. However,
944 please keep in mind that passwords typically have little entropy.
946 Finally, create a random key for a service:
950 $ shishi --string-to-key --random \
951 imap/latte.josefsson.org@@latte.josefsson.org | \
952 tee --append /usr/local/etc/shishid.keys
953 -----BEGIN SHISHI KEY-----
954 Keytype: 18 (aes256-cts-hmac-sha1-96)
955 Principal: imap/latte.josefsson.org
956 Realm: latte.josefsson.org
958 ts2v0QHWyW9FyXbWtCvLPqdEc60qPq5Yvat3p82rp5c=
959 -----END SHISHI KEY-----
964 You are now ready to start the KDC. Refer to the reference manual for
965 available parameters (@pxref{Parameters for shishid}).
973 Then you can use @samp{shishi} as usual to acquire tickets
974 (@pxref{User Manual}). The following example demonstrate a AS-REQ for
975 @samp{krbtgt/latte.josefsson.org} followed by a TGS-REQ for
976 @samp{imap/latte.josefsson.org}.
980 $ shishi simon@@latte.josefsson.org imap/latte.josefsson.org
981 Enter password for `simon@@latte.josefsson.org':
982 simon@@latte.josefsson.org:
983 Acquired: Wed Aug 27 17:16:37 2003
984 Expires: Wed Aug 27 17:33:17 2003
985 Server: imap/latte.josefsson.org key aes256-cts-hmac-sha1-96 (18)
986 Ticket key: aes256-cts-hmac-sha1-96 (18) protected by aes256-cts-hmac-sha1-96 (18)
987 Ticket flags: FORWARDED PROXIABLE (12)
992 @c **********************************************************
993 @c **************** Reference Manual **********************
994 @c **********************************************************
995 @node Reference Manual
996 @chapter Reference Manual
998 This chapter describes in high detail all parameters, configuration
1002 * Configuration file:: Meaning of tokens used in configuration file.
1003 * Parameters for shishi:: Command line parameters for 'shishi'.
1004 * Parameters for shishid:: Command line parameters for 'shishid'.
1007 @node Configuration file
1008 @section Configuration file
1010 The valid configuration file tokens are described here. The user
1011 configuration file is typically located in
1012 @file{~/.shishi/shishi.conf} (compare @samp{shishi
1013 --configuration-file}) and the system configuration is typicall
1014 located in @file{/usr/local/etc/shishi.conf}. All tokens are valid in
1015 both files, and have the same meaning. However, as the system file is
1016 supposed to apply to all users on a system, it would not make sense to
1017 use some tokens in both files. For example, the
1018 @samp{default-principal} is rarely useful in a system configuration
1021 @subsection @samp{default-realm}
1022 Specify the default realm, by default the hostname of the host is
1026 default-realm JOSEFSSON.ORG
1029 @subsection @samp{default-principal}
1031 Specify the default principal, by default the login username is
1035 default-principal jas
1038 @subsection @samp{client-kdc-etypes}
1040 Specify which encryption types client asks server to respond in during
1041 AS/TGS exchanges. List valid encryption types, in preference order.
1042 Supported algorithms include aes256-cts-hmac-sha1-96,
1043 aes128-cts-hmac-sha1-96, des3-cbc-sha1-kd, des-cbc-md5, des-cbc-md4,
1044 des-cbc-crc and null. This option also indicates which encryption
1045 types are accepted by the client when receiving the response. Note
1046 that the preference order is not cryptographically protected, so a man
1047 in the middle can modify the order without being detected. Thus, only
1048 specify encryption types you trust completely here. The default only
1049 includes aes256-cts-hmac-sha1-96, as suggested by RFC1510bis. E.g.,
1052 client-kdc-etypes=aes256-cts-hmac-sha1-96 des3-cbc-sha1-kd des-cbc-md5
1055 @subsection @samp{verbose}, @samp{verbose-asn1}, @samp{verbose-noice}, @samp{verbose-crypto}
1057 Enable verbose library messages. E.g.,
1064 @subsection @samp{realm-kdc}
1066 Specify KDC addresses for realms. Value is
1067 @samp{REALM,KDCADDRESS[/PROTOCOL][,KDCADDRESS[/PROTOCOL]...]}.
1069 KDCADDRESS is the hostname or IP address of KDC.
1071 Optional PROTOCOL is udp for UDP, tcp for TCP, and TLS for TLS
1072 connections. By default UDP is tried first, and TCP used as a
1073 fallback if the KRB_ERR_RESPONSE_TOO_BIG error is received.
1075 If not specified, Shishi tries to locate the KDC using SRV RRs,
1076 which is recommended. This option should normally only be
1077 used during experiments, or to access badly maintained realms.
1080 realm-kdc=JOSEFSSON.ORG,ristretto.josefsson.org
1083 @subsection @samp{server-realm}
1085 Specify realm for servers. Value is
1086 @samp{REALM,SERVERREGEXP[,SERVERREGEXP...]}.
1088 SERVERREGEXP is a regular expression matching servers in the realm.
1089 The first match is used. E.g.,
1092 server-realm=JOSEFSSON.ORG,.josefsson.org
1095 Note: currently not used.
1097 @subsection @samp{kdc-timeout}, @samp{kdc-retries}
1099 How long shishi waits for a response from a KDC before continuing to
1100 next KDC for realm. The default is 5 seconds. E.g.,
1106 How many times shishi sends a request to a KDC before giving up. The
1107 default is 3 times. E.g.,
1113 @subsection @samp{stringprocess}
1115 How username and passwords entered from the terminal, or taken from
1116 the command line, are processed.
1118 "none": no processing is used.
1120 "stringprep": convert from locale charset to UTF-8 and process using
1121 experimental RFC 1510 stringprep profile.
1123 It can also be a string indicating a character set supported by
1124 iconv() via libstringprep, in which case data is converted from locale
1125 charset into the indicated character set. E.g., UTF-8, ISO-8859-1,
1126 KOI-8, EBCDIC-IS-FRISS are supported on GNU systems. On some systems
1127 you can use "locale -m" to list available character sets. By default,
1128 the "none" setting is used which is consistent with RFC 1510 that is
1129 silent on the issue. In practice, however, converting to UTF-8
1130 improves interoperability.
1138 @subsection @samp{ticket-life}
1139 Specify default ticket life time.
1141 The string can be in almost any common format. It can contain month
1142 names, time zones, `am' and `pm', `yesterday', `ago', `next', etc.
1143 Refer to the "Date input formats" in the GNU CoreUtils package for
1144 entire story (@pxref{Date input formats, ,Date input formats,
1145 coreutils, GNU CoreUtils}). As an extra feature, if the resulting
1146 string you specify has expired within the last 24 hours, an extra day
1147 is added to it. This allows you to specify "17:00" to always mean the
1148 next 17:00, even if your system clock happens to be 17:30.
1150 The default is 8 hours.
1155 #ticket-life=8 hours
1160 @subsection @samp{renew-life}
1162 Specify how long a renewable ticket should remain renewable.
1164 See ticket-life for the syntax. The extra feature that handles
1165 negative values within the last 2 hours is not active here.
1167 The default is 7 days.
1173 #renew-life=friday 17:00
1177 @node Parameters for shishi
1178 @section Parameters for shishi
1180 If no command is given, Shishi try to make sure you have a ticket
1181 granting ticket for the default realm, and then display it.
1183 Mandatory or optional arguments to long options are also mandatory or optional
1184 for any corresponding short options.
1187 Usage: lt-shishi [OPTION...] [CLIENT [SERVER]] [OPTION...]
1188 or: lt-shishi [OPTION...] --list [CLIENT [SERVER]]
1189 or: lt-shishi [OPTION...] --destroy [CLIENT [SERVER]]
1190 or: lt-shishi [OPTION...] --string-to-key
1191 or: lt-shishi [OPTION...]
1193 --client-name=NAME Client name. Default is login username. Only for
1195 -d, --destroy Destroy tickets in local cache, subject to
1196 --server-name limiting.
1197 -e, --endtime=STRING Specify when ticket validity should expire. The
1198 time syntax may be relative (to the start time),
1199 such as "20 hours", or absolute, such as
1200 "2001-02-03 04:05:06 CET". The default is 8 hours
1201 after the start time.
1202 -E, --encryption-type=ETYPE,[ETYPE...]
1203 Encryption types to use. ETYPE is either
1204 registered name or integer.
1205 --force-as Force AS mode. Default is to use TGS iff a TGT is
1207 --force-tgs Force TGS mode. Default is to use TGS iff a TGT is
1209 --key-value=KEY Cipher key to decrypt response (discouraged).
1210 -l, --list List tickets in local cache, subject to
1211 --server-name limiting.
1212 --realm=REALM Realm of server. Default is DNS domain of local
1213 host. For AS, this also indicates realm of
1215 --renew-till=STRING Specify renewable life of ticket. Implies
1216 --renewable. Accepts same time syntax as
1217 --endtime. If --renewable is specified, the
1218 default is 1 week after the start time.
1219 --renewable Get a renewable ticket.
1220 -R, --renew Renew ticket. Use --server-name to specify
1221 ticket, default is the most recent renewable
1222 ticket granting ticket for the default realm.
1223 --server=[FAMILY:]ADDRESS:SERVICE/TYPE
1224 Send all requests to HOST instead of using normal
1225 logic to locate KDC addresses (discouraged).
1226 --server-name=NAME Server name. Default is "krbtgt/REALM" where REALM
1227 is server realm (see --realm).
1228 -s, --starttime=STRING Specify when ticket should start to be valid.
1229 Accepts same time syntax as --endtime. The default
1230 is to become valid immediately.
1231 --ticket-granter=NAME Service name in ticket to use for authenticating
1232 request. Only for TGS. Defaults to
1233 "krbtgt/REALM@@REALM" where REALM is server realm
1236 Options for low-level cryptography (CRYPTO-OPTIONS):
1237 --client-name=NAME Username. Default is login name.
1238 --key-value=KEY Base64 encoded key value.
1239 --key-version=INTEGER Version number of key.
1240 --parameter=STRING String-to-key parameter to use when --password is
1241 specified. This data is specific for each
1242 encryption algorithm and rarely needed.
1243 --password=PASSWORD Password used to generate key (discouraged).
1244 --random Generate key from random data.
1245 --realm=REALM Realm of principal. Defaults to DNS domain of
1247 --salt=SALT Salt to use for --string-to-key. Defaults to
1248 concatenation of realm and (unwrapped) client
1250 --string-to-key[=[PASSWORD]]
1251 Convert password into Kerberos key. Note that
1252 --client-name, --realm, and --salt influence the
1254 --write-key-file=FILE Append cipher key to FILE
1257 --configuration-file=FILE Read user configuration from file. Default
1258 is ~/.shishi/config.
1259 -c, --ticket-file=FILE Read tickets from FILE. Default is
1260 $HOME/.shishi/tickets.
1261 -o, --library-options=STRING Parse STRING as a configuration file
1263 -q, --quiet, --silent Don't produce any output.
1264 --system-configuration-file=FILE
1265 Read system wide configuration from file. Default
1266 is /usr/local/etc/shishi.conf.
1267 --ticket-write-file=FILE Write tickets to FILE. Default is to write
1268 them back to ticket file.
1269 -v, --verbose Produce verbose output.
1270 --verbose-library Produce verbose output in the library.
1271 CLIENT Set client name and realm from NAME. The
1272 --client-name and --realm parameters can be used
1273 to override part of NAME.
1274 SERVER Set server name and realm from NAME. The
1275 --server-name and --server-realm parameters can be
1276 used to override part of SERVER.
1278 -?, --help Give this help list
1279 --usage Give a short usage message
1280 -V, --version Print program version
1283 @node Parameters for shishid
1284 @section Parameters for shishid
1286 If no parameters are specified, @samp{shishid} listens on the defaults
1287 interfaces and answers incoming requests using the keys in the default
1290 Mandatory or optional arguments to long options are also mandatory or optional
1291 for any corresponding short options.
1294 -c, --configuration-file=FILE Read configuration from file. Default is
1295 /usr/local/etc/shishi.conf.
1296 -k, --key-file=FILE Read keys from file. Default is
1297 /usr/local/etc/shishid.keys.
1298 -l, --listen=[FAMILY:]ADDRESS:SERVICE/TYPE,...
1299 What to listen on. Family is "IPv4" or "IPv6", if
1300 absent the family is decided by
1301 gethostbyname(ADDRESS). An address of "*"
1302 indicates all addresses on the local host. The
1303 default is "IPv4:*:kerberos/udp,
1304 IPv4:*:kerberos/tcp, IPv6:*:kerberos/udp,
1305 IPv6:*:kerberos/tcp".
1306 -q, -s, --quiet, --silent Don't produce any output.
1307 -u, --setuid=NAME After binding socket, set user identity.
1308 -v, --verbose Produce verbose output.
1309 -?, --help Give this help list
1310 --usage Give a short usage message
1311 -V, --version Print program version
1314 @c **********************************************************
1315 @c *************** Programming Manual *********************
1316 @c **********************************************************
1317 @node Programming Manual
1318 @chapter Programming Manual
1319 @cindex Application Programming Interface (API)
1321 This chapter describes all the publicly available functions in the
1325 * Preparation:: What you should do before using the library.
1326 * Initialization Functions:: Creating library handle, configuration file.
1327 * Ticket Set Functions:: High-level ticket management functions.
1328 * AP-REQ and AP-REP Functions:: Client/Server authentication functions.
1329 * SAFE and PRIV Functions:: Client/Server session data functions.
1330 * Ticket Functions:: Medium-level ticket manipulation functions.
1331 * AS Functions:: Medium-level initial authentication functions.
1332 * TGS Functions:: Medium-level authentication functions.
1333 * Ticket (ASN.1) Functions:: Low-level Ticket functions.
1334 * AS/TGS Functions:: Low-level KDC functions; AS and TGS.
1335 * Authenticator Functions:: Low-level authenticator functions.
1336 * Cryptographic Functions:: Low-level cryptographic functions.
1337 * Utility Functions:: Utilities for use in the global context.
1338 * Error Handling:: Error codes and such.
1339 * Examples:: Example code.
1340 * Generic Security Service:: If you want to use the GSS API instead.
1344 @section Preparation
1346 To use `Libshishi', you have to perform some changes to your sources
1347 and the build system. The necessary changes are small and explained
1348 in the following sections. At the end of this chapter, it is
1349 described how the library is initialized, and how the requirements of
1350 the library are verified.
1352 A faster way to find out how to adapt your application for use with
1353 `Libshishi' may be to look at the examples at the end of this manual
1360 * Building the source::
1367 All interfaces (data types and functions) of the library are defined
1368 in the header file `shishi.h'. You must include this in all programs
1369 using the library, either directly or through some other header file,
1376 The name space of `Libshishi' is @code{shishi_*} for function names,
1377 @code{Shishi*} for data types and @code{SHISHI_*} for other symbols. In
1378 addition the same name prefixes with one prepended underscore are
1379 reserved for internal use and should never be used by an application.
1381 @node Initialization
1382 @subsection Initialization
1384 `Libshishi' must be initialized before it can be used. The library is
1385 initialized by calling @code{shishi_init()} (@pxref{Initialization
1386 Functions}). The resources allocated by the initialization process
1387 can be released if the application no longer has a need to call
1388 `Libshishi' functions, this is done by calling @code{shishi_done()}.
1390 In order to take advantage of the internationalisation features in
1391 `Libshishi', such as translated error messages, the application must
1392 set the current locale using @code{setlocale()} before initializing
1396 @subsection Version Check
1398 It is often desirable to check that the version of `Libshishi' used is
1399 indeed one which fits all requirements. Even with binary
1400 compatibility new features may have been introduced but due to problem
1401 with the dynamic linker an old version is actually used. So you may
1402 want to check that the version is okay right after program startup.
1404 @include shishi-api-version.texi
1406 The normal way to use the function is to put something similar to the
1407 following early in your @code{main()}:
1410 if (!shishi_check_version (SHISHI_VERSION))
1412 printf ("shishi_check_version() failed:\n"
1413 "Header file incompatible with shared library.\n");
1418 @node Building the source
1419 @subsection Building the source
1420 @cindex Compiling your application
1422 If you want to compile a source file including the `shishi.h' header
1423 file, you must make sure that the compiler can find it in the
1424 directory hierarchy. This is accomplished by adding the path to the
1425 directory in which the header file is located to the compilers include
1426 file search path (via the @option{-I} option).
1428 However, the path to the include file is determined at the time the
1429 source is configured. To solve this problem, `Libshishi' uses the
1430 external package @command{pkg-config} that knows the path to the
1431 include file and other configuration options. The options that need
1432 to be added to the compiler invocation at compile time are output by
1433 the @option{--cflags} option to @command{pkg-config shishi}. The
1434 following example shows how it can be used at the command line:
1437 gcc -c foo.c `pkg-config shishi --cflags`
1440 Adding the output of @samp{pkg-config shishi --cflags} to the
1441 compilers command line will ensure that the compiler can find the
1442 `Libshishi' header file.
1444 A similar problem occurs when linking the program with the library.
1445 Again, the compiler has to find the library files. For this to work,
1446 the path to the library files has to be added to the library search path
1447 (via the @option{-L} option). For this, the option @option{--libs} to
1448 @command{pkg-config shishi} can be used. For convenience, this option
1449 also outputs all other options that are required to link the program
1450 with the `Libshishi' libararies (in particular, the @samp{-lshishi}
1451 option). The example shows how to link @file{foo.o} with the `Libshishi'
1452 library to a program @command{foo}.
1455 gcc -o foo foo.o `pkg-config shishi --libs`
1458 Of course you can also combine both examples to a single command by
1459 specifying both options to @command{pkg-config}:
1462 gcc -o foo foo.c `pkg-config shishi --cflags --libs`
1465 @node Autoconf tests
1466 @subsection Autoconf tests
1467 @cindex Autoconf tests
1468 @cindex Configure tests
1470 If you work on a project that uses Autoconf (@pxref{top, GNU
1471 Autoconf,, autoconf}) to help find installed libraries, the
1472 suggestions in the previous section are not the entire story. There
1473 are a few methods to detect and incorporate Shishi into your Autoconf
1474 based package. The preferred approach, is to use Libtool in your
1475 project, and use the normal Autoconf header file and library tests.
1477 @subsubsection Autoconf test via @samp{pkg-config}
1479 If your audience is a typical GNU/Linux desktop, you can often assume
1480 they have the @samp{pkg-config} tool installed, in which you can use
1481 its Autoconf M4 macro to find and set up your package for use with
1482 Shishi. The following illustrate this scenario.
1485 AC_ARG_ENABLE(kerberos_v5,
1486 AC_HELP_STRING([--disable-kerberos_v5],
1487 [don't use the KERBEROS_V5 mechanism]),
1488 kerberos_v5=$enableval)
1489 if test "$kerberos_v5" != "no" ; then
1490 PKG_CHECK_MODULES(SHISHI, shishi >= 0.0.0,
1493 if test "$kerberos_v5" != "yes" ; then
1495 AC_MSG_WARN([shishi not found, disabling Kerberos 5])
1498 AC_DEFINE(USE_KERBEROS_V5, 1,
1499 [Define to 1 if you want Kerberos 5.])
1502 AC_MSG_CHECKING([if Kerberos 5 should be used])
1503 AC_MSG_RESULT($kerberos_v5)
1506 @subsubsection Standalone Autoconf test using Libtool
1508 If your package uses Libtool(@pxref{top, GNU Libtool,, libtool}), you
1509 can use the normal Autoconf tests to find the Shishi library and rely
1510 on the Libtool dependency tracking to include the proper dependency
1511 libraries (e.g., Libidn). The following illustrate this scenario.
1514 AC_CHECK_HEADER(shishi.h,
1515 AC_CHECK_LIB(shishi, shishi_check_version,
1516 [kerberos5=yes AC_SUBST(SHISHI_LIBS, -lshishi)],
1519 AC_ARG_ENABLE(kerberos5,
1520 AC_HELP_STRING([--disable-kerberos5],
1521 [disable Kerberos 5 unconditionally]),
1522 kerberos5=$enableval)
1523 if test "$kerberos5" != "no" ; then
1524 AC_DEFINE(USE_KERBEROS_V5, 1,
1525 [Define to 1 if you want Kerberos 5.])
1527 AC_MSG_WARN([Shishi not found, disabling Kerberos 5])
1529 AC_MSG_CHECKING([if Kerberos 5 should be used])
1530 AC_MSG_RESULT($kerberos5)
1533 @subsubsection Standalone Autoconf test
1535 If your package does not use Libtool, as well as detecting the Shishi
1536 library as in the previous case, you must also detect whatever
1537 dependencies Shishi requires to work (e.g., libidn). Since the
1538 dependencies are in a state of flux, we do not provide an example and
1539 we do not recommend this approach, unless you are experienced
1542 @node Initialization Functions
1543 @section Initialization Functions
1545 @include shishi-api-init.texi
1548 @node Ticket Set Functions
1549 @section Ticket Set Functions
1551 A ``ticket set'' is, as the name implies, a collection of tickets.
1552 Functions are provided to read tickets from file into a ticket set, to
1553 query number of tickets in the set, to extract a given ticket from the
1554 set, to search the ticket set for tickets matching certain criterium,
1555 to write the ticket set to a file, etc. High level functions for
1556 performing a initial authentication (@pxref{AS Functions}) or
1557 subsequent authentication (@pxref{TGS Functions}) and storing the new
1558 ticket in the ticket set are also provided.
1560 To manipulate each individual ticket, @xref{Ticket Functions}. For
1561 low-level ASN.1 manipulation see @xref{Ticket (ASN.1) Functions}.
1563 @include shishi-api-tkts.texi
1566 @node AP-REQ and AP-REP Functions
1567 @section AP-REQ and AP-REP Functions
1569 The ``AP-REQ'' and ``AP-REP'' are ASN.1 structures used by application
1570 client and servers to prove to each other who they are. The
1571 structures contain auxilliary information, together with an
1572 authenticator (@pxref{Authenticator Functions}) which is the real
1573 cryptographic proof. The following illustrates the AP-REQ and AP-REP
1577 AP-REQ ::= [APPLICATION 14] SEQUENCE {
1578 pvno [0] INTEGER (5),
1579 msg-type [1] INTEGER (14),
1580 ap-options [2] APOptions,
1582 authenticator [4] EncryptedData {Authenticator,
1583 { keyuse-pa-TGSReq-authenticator
1584 | keyuse-APReq-authenticator }}
1587 AP-REP ::= [APPLICATION 15] SEQUENCE {
1588 pvno [0] INTEGER (5),
1589 msg-type [1] INTEGER (15),
1590 enc-part [2] EncryptedData {EncAPRepPart,
1591 { keyuse-EncAPRepPart }}
1594 EncAPRepPart ::= [APPLICATION 27] SEQUENCE {
1595 ctime [0] KerberosTime,
1596 cusec [1] Microseconds,
1597 subkey [2] EncryptionKey OPTIONAL,
1598 seq-number [3] UInt32 OPTIONAL
1602 @include shishi-api-ap.texi
1605 @node SAFE and PRIV Functions
1606 @section SAFE and PRIV Functions
1608 The ``KRB-SAFE'' is an ASN.1 structure used by application client and
1609 servers to exchange integrity protected data. The integrity
1610 protection is keyed, usually with a key agreed on via the AP exchange
1611 (@pxref{AP-REQ and AP-REP Functions}). The following illustrates the
1612 KRB-SAFE ASN.1 structure.
1615 KRB-SAFE ::= [APPLICATION 20] SEQUENCE {
1616 pvno [0] INTEGER (5),
1617 msg-type [1] INTEGER (20),
1618 safe-body [2] KRB-SAFE-BODY,
1622 KRB-SAFE-BODY ::= SEQUENCE {
1623 user-data [0] OCTET STRING,
1624 timestamp [1] KerberosTime OPTIONAL,
1625 usec [2] Microseconds OPTIONAL,
1626 seq-number [3] UInt32 OPTIONAL,
1627 s-address [4] HostAddress,
1628 r-address [5] HostAddress OPTIONAL
1632 @include shishi-api-safe.texi
1634 The ``KRB-PRIV'' is an ASN.1 structure used by application client and
1635 servers to exchange confidential data. The confidentiality is keyed,
1636 usually with a key agreed on via the AP exchange (@pxref{AP-REQ and
1637 AP-REP Functions}). The following illustrates the KRB-PRIV ASN.1
1641 KRB-PRIV ::= [APPLICATION 21] SEQUENCE {
1642 pvno [0] INTEGER (5),
1643 msg-type [1] INTEGER (21),
1644 -- NOTE: there is no [2] tag
1645 enc-part [3] EncryptedData -- EncKrbPrivPart
1648 EncKrbPrivPart ::= [APPLICATION 28] SEQUENCE {
1649 user-data [0] OCTET STRING,
1650 timestamp [1] KerberosTime OPTIONAL,
1651 usec [2] Microseconds OPTIONAL,
1652 seq-number [3] UInt32 OPTIONAL,
1653 s-address [4] HostAddress -- sender's addr --,
1654 r-address [5] HostAddress OPTIONAL -- recip's addr
1658 @c @include shishi-api-safe.texi
1661 @node Ticket Functions
1662 @section Ticket Functions
1664 @include shishi-api-tkt.texi
1668 @section AS Functions
1670 The Authentication Service (AS) is used to get an initial ticket using
1671 e.g. your password. The following illustrates the AS-REQ and AS-REP
1677 AS-REQ ::= KDC-REQ {10}
1679 KDC-REQ {INTEGER:tagnum} ::= [APPLICATION tagnum] SEQUENCE {
1680 pvno [1] INTEGER (5) -- first tag is [1], not [0] --,
1681 msg-type [2] INTEGER (tagnum),
1682 padata [3] SEQUENCE OF PA-DATA OPTIONAL,
1683 req-body [4] KDC-REQ-BODY
1686 KDC-REQ-BODY ::= SEQUENCE {
1687 kdc-options [0] KDCOptions,
1688 cname [1] PrincipalName OPTIONAL
1689 -- Used only in AS-REQ --,
1692 -- Also client's in AS-REQ --,
1693 sname [3] PrincipalName OPTIONAL,
1694 from [4] KerberosTime OPTIONAL,
1695 till [5] KerberosTime,
1696 rtime [6] KerberosTime OPTIONAL,
1698 etype [8] SEQUENCE OF Int32 -- EncryptionType
1699 -- in preference order --,
1700 addresses [9] HostAddresses OPTIONAL,
1701 enc-authorization-data [10] EncryptedData {
1703 { keyuse-TGSReqAuthData-sesskey
1704 | keyuse-TGSReqAuthData-subkey }
1706 additional-tickets [11] SEQUENCE OF Ticket OPTIONAL
1711 AS-REP ::= KDC-REP {11, EncASRepPart, {keyuse-EncASRepPart}}
1713 KDC-REP {INTEGER:tagnum,
1715 UInt32:KeyUsages} ::= [APPLICATION tagnum] SEQUENCE {
1716 pvno [0] INTEGER (5),
1717 msg-type [1] INTEGER (tagnum),
1718 padata [2] SEQUENCE OF PA-DATA OPTIONAL,
1720 cname [4] PrincipalName,
1722 enc-part [6] EncryptedData {TypeToEncrypt, KeyUsages}
1725 EncASRepPart ::= [APPLICATION 25] EncKDCRepPart
1727 EncKDCRepPart ::= SEQUENCE {
1728 key [0] EncryptionKey,
1729 last-req [1] LastReq,
1731 key-expiration [3] KerberosTime OPTIONAL,
1732 flags [4] TicketFlags,
1733 authtime [5] KerberosTime,
1734 starttime [6] KerberosTime OPTIONAL,
1735 endtime [7] KerberosTime,
1736 renew-till [8] KerberosTime OPTIONAL,
1738 sname [10] PrincipalName,
1739 caddr [11] HostAddresses OPTIONAL
1743 @include shishi-api-as.texi
1747 @section TGS Functions
1749 The Ticket Granting Service (TGS) is used to get subsequent tickets,
1750 authenticated by other tickets (so called ticket granting tickets).
1751 The following illustrates the TGS-REQ and TGS-REP ASN.1 structures.
1756 TGS-REQ ::= KDC-REQ {12}
1758 KDC-REQ {INTEGER:tagnum} ::= [APPLICATION tagnum] SEQUENCE {
1759 pvno [1] INTEGER (5) -- first tag is [1], not [0] --,
1760 msg-type [2] INTEGER (tagnum),
1761 padata [3] SEQUENCE OF PA-DATA OPTIONAL,
1762 req-body [4] KDC-REQ-BODY
1765 KDC-REQ-BODY ::= SEQUENCE {
1766 kdc-options [0] KDCOptions,
1767 cname [1] PrincipalName OPTIONAL
1768 -- Used only in AS-REQ --,
1771 -- Also client's in AS-REQ --,
1772 sname [3] PrincipalName OPTIONAL,
1773 from [4] KerberosTime OPTIONAL,
1774 till [5] KerberosTime,
1775 rtime [6] KerberosTime OPTIONAL,
1777 etype [8] SEQUENCE OF Int32 -- EncryptionType
1778 -- in preference order --,
1779 addresses [9] HostAddresses OPTIONAL,
1780 enc-authorization-data [10] EncryptedData {
1782 { keyuse-TGSReqAuthData-sesskey
1783 | keyuse-TGSReqAuthData-subkey }
1785 additional-tickets [11] SEQUENCE OF Ticket OPTIONAL
1790 TGS-REP ::= KDC-REP {13, EncTGSRepPart,
1791 { keyuse-EncTGSRepPart-sesskey
1792 | keyuse-EncTGSRepPart-subkey }}
1794 KDC-REP {INTEGER:tagnum,
1796 UInt32:KeyUsages} ::= [APPLICATION tagnum] SEQUENCE {
1797 pvno [0] INTEGER (5),
1798 msg-type [1] INTEGER (tagnum),
1799 padata [2] SEQUENCE OF PA-DATA OPTIONAL,
1801 cname [4] PrincipalName,
1803 enc-part [6] EncryptedData {TypeToEncrypt, KeyUsages}
1806 EncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart
1808 EncKDCRepPart ::= SEQUENCE {
1809 key [0] EncryptionKey,
1810 last-req [1] LastReq,
1812 key-expiration [3] KerberosTime OPTIONAL,
1813 flags [4] TicketFlags,
1814 authtime [5] KerberosTime,
1815 starttime [6] KerberosTime OPTIONAL,
1816 endtime [7] KerberosTime,
1817 renew-till [8] KerberosTime OPTIONAL,
1819 sname [10] PrincipalName,
1820 caddr [11] HostAddresses OPTIONAL
1824 @include shishi-api-tgs.texi
1827 @node Ticket (ASN.1) Functions
1828 @section Ticket (ASN.1) Functions
1830 @include shishi-api-ticket.texi
1832 @node AS/TGS Functions
1833 @section AS/TGS Functions
1835 The Authentication Service (AS) is used to get an initial ticket using
1836 e.g. your password. The Ticket Granting Service (TGS) is used to get
1837 subsequent tickets using other tickets. Protocol wise the procedures
1838 are very similar, which is the reason they are described together.
1839 The following illustrates the AS-REQ, TGS-REQ and AS-REP, TGS-REP
1840 ASN.1 structures. Most of the functions use the mnemonic ``KDC''
1841 instead of either AS or TGS, which means the function operates on both
1842 AS and TGS types. Only where the distinction between AS and TGS is
1843 important are the AS and TGS names used. Remember, these are
1844 low-level functions, and normal applications will likely be satisfied
1845 with the AS (@pxref{AS Functions}) and TGS (@pxref{TGS Functions})
1846 interfaces, or the even more high-level Ticket Set (@pxref{Ticket Set
1847 Functions}) interface.
1852 AS-REQ ::= KDC-REQ {10}
1853 TGS-REQ ::= KDC-REQ {12}
1855 KDC-REQ {INTEGER:tagnum} ::= [APPLICATION tagnum] SEQUENCE {
1856 pvno [1] INTEGER (5) -- first tag is [1], not [0] --,
1857 msg-type [2] INTEGER (tagnum),
1858 padata [3] SEQUENCE OF PA-DATA OPTIONAL,
1859 req-body [4] KDC-REQ-BODY
1862 KDC-REQ-BODY ::= SEQUENCE {
1863 kdc-options [0] KDCOptions,
1864 cname [1] PrincipalName OPTIONAL
1865 -- Used only in AS-REQ --,
1868 -- Also client's in AS-REQ --,
1869 sname [3] PrincipalName OPTIONAL,
1870 from [4] KerberosTime OPTIONAL,
1871 till [5] KerberosTime,
1872 rtime [6] KerberosTime OPTIONAL,
1874 etype [8] SEQUENCE OF Int32 -- EncryptionType
1875 -- in preference order --,
1876 addresses [9] HostAddresses OPTIONAL,
1877 enc-authorization-data [10] EncryptedData {
1879 { keyuse-TGSReqAuthData-sesskey
1880 | keyuse-TGSReqAuthData-subkey }
1882 additional-tickets [11] SEQUENCE OF Ticket OPTIONAL
1887 AS-REP ::= KDC-REP {11, EncASRepPart, {keyuse-EncASRepPart}}
1888 TGS-REP ::= KDC-REP {13, EncTGSRepPart,
1889 { keyuse-EncTGSRepPart-sesskey
1890 | keyuse-EncTGSRepPart-subkey }}
1892 KDC-REP {INTEGER:tagnum,
1894 UInt32:KeyUsages} ::= [APPLICATION tagnum] SEQUENCE {
1895 pvno [0] INTEGER (5),
1896 msg-type [1] INTEGER (tagnum),
1897 padata [2] SEQUENCE OF PA-DATA OPTIONAL,
1899 cname [4] PrincipalName,
1901 enc-part [6] EncryptedData {TypeToEncrypt, KeyUsages}
1904 EncASRepPart ::= [APPLICATION 25] EncKDCRepPart
1905 EncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart
1907 EncKDCRepPart ::= SEQUENCE {
1908 key [0] EncryptionKey,
1909 last-req [1] LastReq,
1911 key-expiration [3] KerberosTime OPTIONAL,
1912 flags [4] TicketFlags,
1913 authtime [5] KerberosTime,
1914 starttime [6] KerberosTime OPTIONAL,
1915 endtime [7] KerberosTime,
1916 renew-till [8] KerberosTime OPTIONAL,
1918 sname [10] PrincipalName,
1919 caddr [11] HostAddresses OPTIONAL
1923 @include shishi-api-kdc.texi
1926 @node Authenticator Functions
1927 @section Authenticator Functions
1929 An ``Authenticator'' is a ASN.1 structure that work as a proof that an
1930 entity owns a ticket. It is usually embedded in the AP-REQ structure
1931 (@pxref{AP-REQ and AP-REP Functions}), and you most likely want to use
1932 an AP-REQ instead of a Authenticator in normal applications. The
1933 following illustrates the Authenticator ASN.1 structure.
1936 Authenticator ::= [APPLICATION 2] SEQUENCE {
1937 authenticator-vno [0] INTEGER (5),
1939 cname [2] PrincipalName,
1940 cksum [3] Checksum OPTIONAL,
1941 cusec [4] Microseconds,
1942 ctime [5] KerberosTime,
1943 subkey [6] EncryptionKey OPTIONAL,
1944 seq-number [7] UInt32 OPTIONAL,
1945 authorization-data [8] AuthorizationData OPTIONAL
1949 @include shishi-api-authenticator.texi
1952 @node Cryptographic Functions
1953 @section Cryptographic Functions
1955 Underneath the high-level functions described earlier, cryptographic
1956 operations are happening. If you need to access these cryptographic
1957 primitives directly, this section describes the functions available.
1959 Most cryptographic operations need keying material, and cryptographic
1960 keys have been isolated into it's own data structure
1961 @code{Shishi_key}. The following illustrates it's contents, but note
1962 that you cannot access it's elements directly but must use the
1963 accessor functions described below.
1968 int type; /* RFC 1510 encryption integer type */
1969 char *value; /* Cryptographic key data */
1970 int version; /* RFC 1510 ``kvno'' */
1974 All functions that operate on this data structure are described now.
1976 @include shishi-api-key.texi
1978 Applications that run uninteractively may need keying material. In
1979 these cases, the keys are stored in a file, a file that is normally
1980 stored on the local host. The file should be protected from
1981 unauthorized access. The file is in ASCII format and contains keys as
1982 outputed by @code{shishi_key_print()}. All functions that handle
1983 these keys sets are described now.
1985 @include shishi-api-keys.texi
1987 The previous functions require that the filename is known. For some
1988 applications, servers, it makes sense to provide a system default.
1989 These key sets used by server applications are known as ``hostkeys''.
1990 Here are the functions that operate on hostkeys (they are mostly
1991 wrappers around generic key sets).
1993 @include shishi-api-hostkeys.texi
1995 After creating the key structure, it can be used to encrypt and
1996 decrypt data, calculate checksum on data etc. All available functions
1999 @include shishi-api-crypto.texi
2002 @node Utility Functions
2003 @section Utility Functions
2005 @include shishi-api-utility.texi
2008 @node Error Handling
2009 @section Error Handling
2010 @cindex Error Handling
2012 Most functions in `Libshishi' are returning an error if they fail.
2013 For this reason, the application should always catch the error
2014 condition and take appropriate measures, for example by releasing the
2015 resources and passing the error up to the caller, or by displaying a
2016 descriptive message to the user and cancelling the operation.
2018 Some error values do not indicate a system error or an error in the
2019 operation, but the result of an operation that failed properly.
2022 * Error Values:: A list of all error values used.
2023 * Error Functions:: Error handling related functions.
2027 @subsection Error Values
2029 Errors are returned as an @code{int}. Except for the SHISHI_OK case,
2030 an application should always use the constants instead of their
2031 numeric value. Applications are encouraged to use the constants even
2032 for SHISHI_OK as it improves readability. Possible values are:
2036 This value indicates success. The value of this error is guaranteed
2037 to always be @code{0} so you may use it in boolean constructs.
2039 @include shishi-api-error-labels.texi
2043 @node Error Functions
2044 @subsection Error Functions
2046 @include shishi-api-error.texi
2052 This section will be extended to contain walk-throughs of example code
2053 that demonstrate how `Shishi' is used to write your own applications
2054 that support Kerberos 5. The rest of the current section consists of
2055 some crude hints for the example client/server applications that is
2056 part of Shishi, taken from an email but saved here for lack of a
2057 better place to put it.
2059 There are two programs: 'client' and 'server' in src/.
2061 The client output an AP-REQ, waits for an AP-REP, and then simply
2062 reads data from stdin.
2064 The server waits for an AP-REQ, parses it and prints an AP-REP, and
2065 then read data from stdin.
2067 Both programs accept a Kerberos server name as the first command line
2068 argument. Your KDC must know this server, since the client tries to
2069 get a ticket for it (first it gets a ticket granting ticket for the
2070 default username), and you must write the key for the server into
2071 /usr/local/etc/shishi.keys on the Shishi format, e.g.:
2074 -----BEGIN SHISHI KEY-----
2075 Keytype: 16 (des3-cbc-sha1-kd)
2076 Principal: sample/latte.josefsson.org
2077 Realm: JOSEFSSON.ORG
2079 8W0VrQQBpxlACPQEqN91EHxbvFFo2ltt
2080 -----END SHISHI KEY-----
2083 You must extract the proper encryption key from the KDC in some way.
2084 (This part will be easier when Shishi include a KDC, a basic one isn't
2085 far away, give me a week or to.)
2087 The intention is that the data read, after the authentication phase,
2088 should be protected using KRB_SAFE (see RFC) but I haven't added this
2091 @node Generic Security Service
2092 @section Generic Security Service
2093 @cindex Generic Security Service
2097 As an alternative to the native Shishi programming API, it is possible
2098 to program Shishi through the Generic Security Services (GSS) API.
2099 The advantage of using GSS-API in your security application, instead
2100 of the native Shishi API, is that it will be easier to port your
2101 application between different Kerberos 5 implementations, and even
2102 beyond Kerberos 5 to different security systems, that support GSS-API.
2103 In the free software world, however, almost the only widely used
2104 security system that supports GSS-API is Kerberos 5, so the last
2105 advantage is somewhat academic. But if you are porting applications
2106 using GSS-API for other Kerberos 5 implementations, or want a more
2107 mature and stable API than the native Shishi API, you may find using
2108 Shishi's GSS-API interface compelling. Note that GSS-API only offer
2109 basic services, for more advanced uses you must use the native API.
2111 Since the GSS-API is not specific to Shishi, it is distributed
2112 independently from Shishi. Further information on the GSS project can
2113 be found at @url{http://josefsson.org/gss/}.
2115 @c **********************************************************
2116 @c ******************* Acknowledgements *******************
2117 @c **********************************************************
2118 @node Acknowledgements
2119 @chapter Acknowledgements
2121 Shishi uses Libtasn1 by Fabio Fiorina, Libnettle by Niels Möller,
2122 Libgcrypt and Libgpg-error by Werner Koch, Libidn by Simon Josefsson,
2123 cvs2cl by Karl Fogel, and gdoc by Michael Zucchi.
2125 Several GNU packages simplified development considerably, those
2126 packages include Autoconf, Automake, Libtool, Gnulib, Gettext, Indent,
2127 CVS, Texinfo, Help2man and Emacs.
2129 Several people reported bugs, sent patches or suggested improvements,
2130 see the file THANKS.
2132 @c **********************************************************
2133 @c ******************* Appendices *************************
2134 @c **********************************************************
2136 @node Copying This Manual
2137 @appendix Copying This Manual
2140 * GNU Free Documentation License:: License for copying this manual.
2148 @unnumbered Concept Index
2152 @node Function and Data Index
2153 @unnumbered Function and Data Index