Close f, from cppcheck
[heimdal.git] / doc / setup.texi
blob8dbb4150b4d80a8249497e721591343ec1f10113
1 @c $Id$
3 @node Setting up a realm, Applications, Building and Installing, Top
5 @chapter Setting up a realm
8 @cindex realm
9 realm is an administrative domain.  The name of a Kerberos realm is
10 usually the Internet domain name in uppercase.  Call your realm the same
11 as your Internet domain name if you do not have strong reasons for not
12 doing so.  It will make life easier for you and everyone else.
14 @menu
15 * Configuration file::
16 * Creating the database::
17 * Modifying the database::
18 * Checking the setup::
19 * keytabs::
20 * Serving Kerberos 4/524/kaserver::
21 * Remote administration::
22 * Password changing::
23 * Testing clients and servers::
24 * Slave Servers::
25 * Incremental propagation::
26 * Encryption types and salting::
27 * Cross realm::
28 * Transit policy::
29 * Setting up DNS::
30 * Using LDAP to store the database::
31 * Providing Kerberos credentials to servers and programs::
32 * Setting up PK-INIT::
33 @end menu
35 @node  Configuration file, Creating the database, Setting up a realm, Setting up a realm
36 @section Configuration file
38 To setup a realm you will first have to create a configuration file:
39 @file{/etc/krb5.conf}. The @file{krb5.conf} file can contain many
40 configuration options, some of which are described here.
42 There is a sample @file{krb5.conf} supplied with the distribution.
44 The configuration file is a hierarchical structure consisting of
45 sections, each containing a list of bindings (either variable
46 assignments or subsections). A section starts with
47 @samp{[@samp{section-name}]}.  A binding consists of a left hand side, an equal sign
48 (@samp{=}) and a right hand side (the left hand side tag must be
49 separated from the equal sign with some whitespace). Subsections have a
50 @samp{@{} as the first non-whitespace character after the equal sign. All
51 other bindings are treated as variable assignments. The value of a
52 variable extends to the end of the line.
54 @example
55 [section1]
56         a-subsection = @{
57                 var = value1
58                 other-var = value with @{@}
59                 sub-sub-section = @{
60                         var = 123
61                 @}
62         @}
63         var = some other value
64 [section2]
65         var = yet another value
66 @end example
68 In this manual, names of sections and bindings will be given as strings
69 separated by slashes (@samp{/}). The @samp{other-var} variable will thus
70 be @samp{section1/a-subsection/other-var}.
72 For in-depth information about the contents of the configuration file, refer to
73 the @file{krb5.conf} manual page. Some of the more important sections
74 are briefly described here.
76 The @samp{libdefaults} section contains a list of library configuration
77 parameters, such as the default realm and the timeout for KDC
78 responses. The @samp{realms} section contains information about specific
79 realms, such as where they hide their KDC@. This section serves the same
80 purpose as the Kerberos 4 @file{krb.conf} file, but can contain more
81 information. Finally the @samp{domain_realm} section contains a list of
82 mappings from domains to realms, equivalent to the Kerberos 4
83 @file{krb.realms} file.
85 To continue with the realm setup, you will have to create a configuration file,
86 with contents similar to the following.
88 @example
89 [libdefaults]
90         default_realm = MY.REALM
91 [realms]
92         MY.REALM = @{
93                 kdc = my.kdc my.slave.kdc
94                 kdc = my.third.kdc
95         @}
96 [domain_realm]
97         .my.domain = MY.REALM
99 @end example
101 If you use a realm name equal to your domain name, you can omit the
102 @samp{libdefaults}, and @samp{domain_realm}, sections. If you have a DNS
103 SRV-record for your realm, or your Kerberos server has DNS CNAME
104 @samp{kerberos.my.realm}, you can omit the @samp{realms} section too.
106 @node Creating the database, Modifying the database, Configuration file, Setting up a realm
107 @section Creating the database
109 The database library will look for the database in the directory
110 @file{@value{dbdir}}, so you should probably create that directory.
111 Make sure the directory has restrictive permissions.
113 @example
114 # mkdir /var/heimdal
115 @end example
117 The keys of all the principals are stored in the database.  If you
118 choose to, these can be encrypted with a master key.  You do not have to
119 remember this key (or password), but just to enter it once and it will
120 be stored in a file (@file{/var/heimdal/m-key}).  If you want to have a
121 master key, run @samp{kstash} to create this master key:
123 @example
124 # kstash
125 Master key:
126 Verifying password - Master key:
127 @end example
129 If you want to generate a random master key you can use the
130 @kbd{--random-key} flag to kstash. This will make sure you have a good key
131 on which attackers can't do a dictionary attack.
133 If you have a master key, make sure you make a backup of your master
134 key file; without it backups of the database are of no use.
136 To initialise the database use the @command{kadmin} program, with the
137 @kbd{-l} option (to enable local database mode). First issue a
138 @kbd{init MY.REALM} command. This will create the database and insert
139 default principals for that realm. You can have more than one realm in
140 one database, so @samp{init} does not destroy any old database.
142 Before creating the database, @samp{init} will ask you some questions
143 about maximum ticket lifetimes.
145 After creating the database you should probably add yourself to it. You
146 do this with the @samp{add} command. It takes as argument the name of a
147 principal. The principal should contain a realm, so if you haven't set up
148 a default realm, you will need to explicitly include the realm.
150 @example
151 # kadmin -l
152 kadmin> init MY.REALM
153 Realm max ticket life [unlimited]:
154 Realm max renewable ticket life [unlimited]:
155 kadmin> add me
156 Max ticket life [unlimited]:
157 Max renewable life [unlimited]:
158 Attributes []:
159 Password:
160 Verifying password - Password:
161 @end example
163 Now start the KDC and try getting a ticket.
165 @example
166 # kdc &
167 # kinit me
168 me@@MY.REALMS's Password:
169 # klist
170 Credentials cache: /tmp/krb5cc_0
171         Principal: me@@MY.REALM
173   Issued           Expires          Principal
174 Aug 25 07:25:55  Aug 25 17:25:55  krbtgt/MY.REALM@@MY.REALM
175 @end example
177 If you are curious you can use the @samp{dump} command to list all the
178 entries in the database.  It should look something similar to the
179 following example (note that the entries here are truncated for
180 typographical reasons):
182 @smallexample
183 kadmin> dump
184 me@@MY.REALM 1:0:1:0b01d3cb7c293b57:-:0:7:8aec316b9d1629e3baf8 ...
185 kadmin/admin@@MY.REALM 1:0:1:e5c8a2675b37a443:-:0:7:cb913ebf85 ...
186 krbtgt/MY.REALM@@MY.REALM 1:0:1:52b53b61c875ce16:-:0:7:c8943be ...
187 kadmin/changepw@@MY.REALM 1:0:1:f48c8af2b340e9fb:-:0:7:e3e6088 ...
188 @end smallexample
190 @node Modifying the database, Checking the setup, Creating the database, Setting up a realm
191 @section Modifying the database
193 All modifications of principals are done with with kadmin.
195 A principal has several attributes and lifetimes associated with it.
197 Principals are added, renamed, modified, and deleted with the kadmin
198 commands @samp{add}, @samp{rename}, @samp{modify}, @samp{delete}.
199 Both interactive editing and command line flags can be used (use --help
200 to list the available options).
202 There are different kinds of types for the fields in the database;
203 attributes, absolute time times and relative times.
205 @subsection Attributes
207 When doing interactive editing, attributes are listed with @samp{?}.
209 The attributes are given in a comma (@samp{,}) separated list.
210 Attributes are removed from the list by prefixing them with @samp{-}.
212 @smallexample
213 kadmin> modify me
214 Max ticket life [1 day]:
215 Max renewable life [1 week]:
216 Principal expiration time [never]:
217 Password expiration time [never]:
218 Attributes [disallow-renewable]: requires-pre-auth,-disallow-renewable
219 kadmin> get me
220             Principal: me@@MY.REALM
221 [...]
222            Attributes: requires-pre-auth
223 @end smallexample
225 @subsection Absolute times
227 The format for absolute times are any of the following:
229 @smallexample
230 never
232 YYYY-mm-dd
233 YYYY-mm-dd HH:MM:SS
234 @end smallexample
237 @subsection Relative times
239 The format for relative times are any of the following combined:
241 @smallexample
242 N year
243 M month
244 O day
245 P hour
246 Q minute
247 R second
248 @end smallexample
250 @c Describe more of kadmin commands here...
252 @node Checking the setup, keytabs, Modifying the database, Setting up a realm
253 @section Checking the setup
255 There are two tools that can check the consistency of the Kerberos
256 configuration file and the Kerberos database.
258 The Kerberos configuration file is checked using
259 @command{verify_krb5_conf}. The tool checks for common errors, but
260 commonly there are several uncommon configuration entries that are
261 never added to the tool and thus generates ``unknown entry'' warnings.
262 This is usually nothing to worry about.
264 The database check is built into the kadmin tool. It will check for
265 common configuration error that will cause problems later. Common
266 check are for existence and flags on important principals. The
267 database check by run by the following command :
269 @example
270 kadmin check REALM.EXAMPLE.ORG
271 @end example
273 @node keytabs, Serving Kerberos 4/524/kaserver, Checking the setup, Setting up a realm
274 @section keytabs
276 To extract a service ticket from the database and put it in a keytab, you
277 need to first create the principal in the database with @samp{ank}
278 (using the @kbd{--random-key} flag to get a random key) and then
279 extract it with @samp{ext_keytab}.
281 @example
282 kadmin> add --random-key host/my.host.name
283 Max ticket life [unlimited]:
284 Max renewable life [unlimited]:
285 Attributes []:
286 kadmin> ext host/my.host.name
287 kadmin> exit
288 # ktutil list
289 Version  Type             Principal
290      1   des-cbc-md5      host/my.host.name@@MY.REALM
291      1   des-cbc-md4      host/my.host.name@@MY.REALM
292      1   des-cbc-crc      host/my.host.name@@MY.REALM
293      1   des3-cbc-sha1    host/my.host.name@@MY.REALM
294 @end example
296 @node Serving Kerberos 4/524/kaserver, Remote administration, keytabs, Setting up a realm
297 @section Serving Kerberos 4/524/kaserver
299 Heimdal can be configured to support 524, Kerberos 4 or kaserver. All
300 these services are turned off by default. Kerberos 4 is always
301 supported by the KDC, but the Kerberos 4 client support also depends
302 on Kerberos 4 support having been included at compile-time, using
303 @kbd{--with-krb4=dir}.
305 @subsection 524
307 524 is a service that allows the KDC to convert Kerberos 5 tickets to
308 Kerberos 4 tickets for backward compatibility. See also Using 2b
309 tokens with AFS in @xref{AFS}.
311 524 can be turned on by adding this to the configuration file
313 @example
314 [kdc]
315         enable-524 = yes
316 @end example
318 @subsection Kerberos 4
320 Kerberos 4 is the predecessor to to Kerberos 5. It only supports
321 single DES@. You should only enable Kerberos 4 support if you have
322 needs for compatibility with an installed base of Kerberos 4
323 clients/servers.
325 Kerberos 4 can be turned on by adding this to the configuration file
327 @example
328 [kdc]
329         enable-kerberos4 = yes
330 @end example
332 @subsection kaserver
334 Kaserver is a Kerberos 4 that is used in AFS@.  The protocol has some
335 extra features over plain Kerberos 4, but like Kerberos 4, only uses
336 single DES@.
338 You should only enable Kaserver support if you have needs for
339 compatibility with an installed base of AFS machines.
341 Kaserver can be turned on by adding this to the configuration file
343 @example
344 [kdc]
345         enable-kaserver = yes
346 @end example
348 @node Remote administration, Password changing, Serving Kerberos 4/524/kaserver, Setting up a realm
349 @section Remote administration
351 The administration server, @command{kadmind}, can be started by
352 @command{inetd} (which isn't recommended) or run as a normal daemon. If you
353 want to start it from @command{inetd} you should add a line similar to the
354 one below to your @file{/etc/inetd.conf}.
356 @example
357 kerberos-adm stream     tcp     nowait  root /usr/heimdal/libexec/kadmind kadmind
358 @end example
360 You might need to add @samp{kerberos-adm} to your @file{/etc/services}
361 as @samp{749/tcp}.
363 Access to the administration server is controlled by an ACL file,
364 (default @file{/var/heimdal/kadmind.acl}.) The file has the following
365 syntax:
366 @smallexample
367 principal       [priv1,priv2,...]       [glob-pattern]
368 @end smallexample
370 The matching is from top to bottom for matching principals (and if given,
371 glob-pattern).  When there is a match, the access rights of that line are
372 applied.
374 The privileges you can assign to a principal are: @samp{add},
375 @samp{change-password} (or @samp{cpw} for short), @samp{delete},
376 @samp{get}, @samp{list}, and @samp{modify}, or the special privilege
377 @samp{all}. All of these roughly correspond to the different commands
378 in @command{kadmin}.
380 If a @var{glob-pattern} is given on a line, it restricts the access
381 rights for the principal to only apply for subjects that match the
382 pattern.  The patterns are of the same type as those used in shell
383 globbing, see @url{none,,fnmatch(3)}.
385 In the example below @samp{lha/admin} can change every principal in the
386 database. @samp{jimmy/admin} can only modify principals that belong to
387 the realm @samp{E.KTH.SE}. @samp{mille/admin} is working at the
388 help desk, so he should only be able to change the passwords for single
389 component principals (ordinary users). He will not be able to change any
390 @samp{/admin} principal.
392 @example
393 lha/admin@@E.KTH.SE     all
394 jimmy/admin@@E.KTH.SE   all             *@@E.KTH.SE
395 jimmy/admin@@E.KTH.SE   all             */*@@E.KTH.SE
396 mille/admin@@E.KTH.SE   change-password *@@E.KTH.SE
397 @end example
399 @node Password changing, Testing clients and servers, Remote administration, Setting up a realm
400 @section Password changing
402 To allow users to change their passwords, you should run @command{kpasswdd}.
403 It is not run from @command{inetd}.
405 You might need to add @samp{kpasswd} to your @file{/etc/services} as
406 @samp{464/udp}.
408 @subsection Password quality assurance
410 It is important that users have good passwords, both to make it harder
411 to guess them and to avoid off-line attacks (although
412 pre-authentication provides some defence against off-line attacks).
413 To ensure that the users choose good passwords, you can enable
414 password quality controls in @command{kpasswdd} and @command{kadmind}.
415 The controls themselves are done in a shared library or an external
416 program that is used by @command{kpasswdd}.  To configure in these
417 controls, add lines similar to the following to your
418 @file{/etc/krb5.conf}:
420 @example
421 [password_quality]
422         policies = external-check builtin:minimum-length module:policyname
423         external_program = /bin/false
424         policy_libraries = @var{library1.so} @var{library2.so}
425 @end example
427 In @samp{[password_quality]policies} the module name is optional if
428 the policy name is unique in all modules (members of
429 @samp{policy_libraries}).
431 The built-in polices are
433 @itemize @bullet
435 @item external-check
437 Executes the program specified by @samp{[password_quality]external_program}.
439 A number of key/value pairs are passed as input to the program, one per
440 line, ending with the string @samp{end}.  The key/value lines are of
441 the form
442 @example
443 principal: @var{principal}
444 new-password: @var{password}
445 @end example
446 where @var{password} is the password to check for the previous
447 @var{principal}.
449 If the external application approves the password, it should return
450 @samp{APPROVED} on standard out and exit with exit code 0.  If it
451 doesn't approve the password, an one line error message explaining the
452 problem should be returned on standard error and the application
453 should exit with exit code 0.  In case of a fatal error, the
454 application should, if possible, print an error message on standard
455 error and exit with a non-zero error code.
457 @item minimum-length
459 The minimum length password quality check reads the configuration file
460 stanza @samp{[password_quality]min_length} and requires the password
461 to be at least this length.
463 @item character-class
465 The character-class password quality check reads the configuration
466 file stanza @samp{[password_quality]min_classes}. The policy requires
467 the password to have characters from at least that many character
468 classes. Default value if not given is 3.
470 The four different characters classes are, uppercase, lowercase,
471 number, special characters.
473 @end itemize
475 If you want to write your own shared object to check password
476 policies, see the manual page @manpage{kadm5_pwcheck,3}.
478 Code for a password quality checking function that uses the cracklib
479 library can be found in @file{lib/kadm5/sample_password_check.c} in
480 the source code distribution.  It requires that the cracklib library
481 be built with the patch available at
482 @url{ftp://ftp.pdc.kth.se/pub/krb/src/cracklib.patch}.
484 A sample policy external program is included in
485 @file{lib/kadm5/check-cracklib.pl}.
487 If no password quality checking function is configured, the only check
488 performed is that the password is at least six characters long.
490 To check the password policy settings, use the command
491 @command{password-quality} in @command{kadmin} program. The password
492 verification is only performed locally, on the client.  It may be
493 convenient to set the environment variable @samp{KRB5_CONFIG} to point
494 to a test version of @file{krb5.conf} while you're testing the
495 @samp{[password_quality]} stanza that way.
497 @node Testing clients and servers, Slave Servers, Password changing, Setting up a realm
498 @section Testing clients and servers
500 Now you should be able to run all the clients and servers.  Refer to the
501 appropriate man pages for information on how to use them.
503 @node Slave Servers, Incremental propagation, Testing clients and servers, Setting up a realm
504 @section Slave servers, Incremental propagation, Testing clients and servers, Setting up a realm
506 It is desirable to have at least one backup (slave) server in case the
507 master server fails. It is possible to have any number of such slave
508 servers but more than three usually doesn't buy much more redundancy.
510 All Kerberos servers for a realm must have the same database so that
511 they present the same service to the users.  The
512 @pindex hprop
513 @command{hprop} program, running on the master, will propagate the database
514 to the slaves, running
515 @pindex hpropd
516 @command{hpropd} processes.
518 Every slave needs a database directory, the master key (if it was used
519 for the database) and a keytab with the principal
520 @samp{hprop/@var{hostname}}.  Add the principal with the
521 @pindex ktutil
522 @command{ktutil} command and start
523 @pindex hpropd
524 @command{hpropd}, as follows:
526 @example
527 slave# ktutil get -p foo/admin hprop/`hostname`
528 slave# mkdir /var/heimdal
529 slave# hpropd
530 @end example
532 The master will use the principal @samp{kadmin/hprop} to authenticate to
533 the slaves.  This principal should be added when running @kbd{kadmin -l
534 init} but if you do not have it in your database for whatever reason,
535 please add it with @kbd{kadmin -l add}.
537 Then run
538 @pindex hprop
539 @code{hprop} on the master:
541 @example
542 master# hprop slave
543 @end example
545 This was just an hands-on example to make sure that everything was
546 working properly.  Doing it manually is of course the wrong way, and to
547 automate this you will want to start
548 @pindex hpropd
549 @command{hpropd} from @command{inetd} on the slave(s) and regularly run
550 @pindex hprop
551 @command{hprop} on the master to regularly propagate the database.
552 Starting the propagation once an hour from @command{cron} is probably a
553 good idea.
555 @node Incremental propagation, Encryption types and salting, Slave Servers, Setting up a realm
556 @section Incremental propagation
558 There is also a newer mechanism for
559 doing incremental propagation in Heimdal.  Instead of sending the whole
560 database regularly, it sends the changes as they happen on the master to
561 the slaves.  The master keeps track of all the changes by assigning a
562 version number to every change to the database.  The slaves know which
563 was the latest version they saw and in this way it can be determined if
564 they are in sync or not.  A log of all the changes is kept on the master,
565 and when a slave is at an older version than the oldest one in the
566 log, the whole database has to be sent.
568 Protocol-wise, all the slaves connect to the master and as a greeting
569 tell it the latest version that they have (@samp{IHAVE} message).  The
570 master then responds by sending all the changes between that version and
571 the current version at the master (a series of @samp{FORYOU} messages)
572 or the whole database in a @samp{TELLYOUEVERYTHING} message.  There is
573 also a keep-alive protocol that makes sure all slaves are up and running.
575 In addition on listening on the network to get connection from new
576 slaves, the ipropd-master also listens on a status unix
577 socket. kadmind and kpasswdd both open that socket when a transation
578 is done and written a notification to the socket. That cause
579 ipropd-master to check for new version in the log file. As a fallback in
580 case a notification is lost by the unix socket, the log file is
581 checked after 30 seconds of no event.
583 @subsection Configuring incremental propagation
585 The program that runs on the master is @command{ipropd-master} and all
586 clients run @command{ipropd-slave}.
588 Create the file @file{/var/heimdal/slaves} on the master containing all
589 the slaves that the database should be propagated to.  Each line contains
590 the full name of the principal (for example
591 @samp{iprop/hemligare.foo.se@@FOO.SE}).
593 You should already have @samp{iprop/tcp} defined as 2121, in your
594 @file{/etc/services}.  Otherwise, or if you need to use a different port
595 for some peculiar reason, you can use the @kbd{--port} option.  This is
596 useful when you have multiple realms to distribute from one server.
598 Then you need to create those principals that you added in the
599 configuration file.  Create one @samp{iprop/hostname} for the master and
600 for every slave.
603 @example
604 master# /usr/heimdal/sbin/ktutil get iprop/`hostname`
605 @end example
607 @example
608 slave# /usr/heimdal/sbin/ktutil get iprop/`hostname`
609 @end example
612 The next step is to start the @command{ipropd-master} process on the master
613 server.  The @command{ipropd-master} listens on the UNIX domain socket
614 @file{/var/heimdal/signal} to know when changes have been made to the
615 database so they can be propagated to the slaves.  There is also a
616 safety feature of testing the version number regularly (every 30
617 seconds) to see if it has been modified by some means that do not raise
618 this signal.  Then, start @command{ipropd-slave} on all the slaves:
620 @example
621 master# /usr/heimdal/libexec/ipropd-master &
622 slave#  /usr/heimdal/libexec/ipropd-slave master &
623 @end example
625 To manage the iprop log file you should use the @command{iprop-log}
626 command. With it you can dump, truncate and replay the logfile.
628 @node Encryption types and salting, Cross realm, Incremental propagation, Setting up a realm
629 @section Encryption types and salting
630 @cindex Salting
631 @cindex Encryption types
633 The encryption types that the KDC is going to assign by default is
634 possible to change. Since the keys used for user authentication is
635 salted the encryption types are described together with the salt
636 strings.
638 Salting is used to make it harder to pre-calculate all possible
639 keys. Using a salt increases the search space to make it almost
640 impossible to pre-calculate all keys. Salting is the process of mixing a
641 public string (the salt) with the password, then sending it through an
642 encryption type specific string-to-key function that will output the
643 fixed size encryption key.
645 In Kerberos 5 the salt is determined by the encryption type, except in
646 some special cases.
648 In @code{des} there is the Kerberos 4 salt
649 (none at all) or the afs-salt (using the cell (realm in
650 AFS lingo)).
652 In @code{arcfour} (the encryption type that Microsoft Windows 2000 uses)
653 there is no salt. This is to be compatible with NTLM keys in Windows
654 NT 4.
656 @code{[kadmin]default_keys} in @file{krb5.conf} controls
657 what salting to use.
659 The syntax of @code{[kadmin]default_keys} is
660 @samp{[etype:]salt-type[:salt-string]}. @samp{etype} is the encryption
661 type (des-cbc-crc, arcfour-hmac-md5, aes256-cts-hmac-sha1-96),
662 @code{salt-type} is the type of salt (pw-salt or afs3-salt), and the
663 salt-string is the string that will be used as salt (remember that if
664 the salt is appended/prepended, the empty salt "" is the same thing as
665 no salt at all).
667 Common types of salting include
669 @itemize @bullet
670 @item @code{v4} (or @code{des:pw-salt:})
672 The Kerberos 4 salting is using no salt at all. Reason there is colon
673 at the end of the salt string is that it makes the salt the empty
674 string (same as no salt).
676 @item @code{v5} (or @code{pw-salt})
678 @code{pw-salt} uses the default salt for each encryption type is
679 specified for. If the encryption type @samp{etype} isn't given, all
680 default encryption will be used.
682 @item @code{afs3-salt}
684 @code{afs3-salt} is the salt that is used with Transarc kaserver. It's
685 the cell name appended to the password.
687 @end itemize
689 @node Cross realm, Transit policy, Encryption types and salting, Setting up a realm
690 @section Cross realm
691 @cindex Cross realm
693 Suppose you reside in the realm @samp{MY.REALM}, how do you
694 authenticate to a server in @samp{OTHER.REALM}? Having valid tickets in
695 @samp{MY.REALM} allows you to communicate with Kerberised services in that
696 realm. However, the computer in the other realm does not have a secret
697 key shared with the Kerberos server in your realm.
699 It is possible to share keys between two realms that trust each
700 other. When a client program, such as @command{telnet} or @command{ssh},
701 finds that the other computer is in a different realm, it will try to
702 get a ticket granting ticket for that other realm, but from the local
703 Kerberos server. With that ticket granting ticket, it will then obtain
704 service tickets from the Kerberos server in the other realm.
706 For a two way trust between @samp{MY.REALM} and @samp{OTHER.REALM}
707 add the following principals to each realm. The principals should be
708 @samp{krbtgt/OTHER.REALM@@MY.REALM} and
709 @samp{krbtgt/MY.REALM@@OTHER.REALM} in @samp{MY.REALM}, and
710 @samp{krbtgt/MY.REALM@@OTHER.REALM} and
711 @samp{krbtgt/OTHER.REALM@@MY.REALM}in @samp{OTHER.REALM}.
713 In Kerberos 5 the trust can be configured to be one way. So that
714 users from @samp{MY.REALM} can authenticate to services in
715 @samp{OTHER.REALM}, but not the opposite. In the example above, the
716 @samp{krbtgt/MY.REALM@@OTHER.REALM} then should be removed.
718 The two principals must have the same key, key version number, and the
719 same set of encryption types. Remember to transfer the two keys in a
720 safe manner.
722 @example
723 vr$ klist
724 Credentials cache: FILE:/tmp/krb5cc_913.console
725         Principal: lha@@E.KTH.SE
727   Issued           Expires          Principal
728 May  3 13:55:52  May  3 23:55:54  krbtgt/E.KTH.SE@@E.KTH.SE
730 vr$ telnet -l lha hummel.it.su.se
731 Trying 2001:6b0:5:1095:250:fcff:fe24:dbf...
732 Connected to hummel.it.su.se.
733 Escape character is '^]'.
734 Waiting for encryption to be negotiated...
735 [ Trying mutual KERBEROS5 (host/hummel.it.su.se@@SU.SE)... ]
736 [ Kerberos V5 accepts you as ``lha@@E.KTH.SE'' ]
737 Encryption negotiated.
738 Last login: Sat May  3 14:11:47 from vr.l.nxs.se
739 hummel$ exit
741 vr$ klist
742 Credentials cache: FILE:/tmp/krb5cc_913.console
743         Principal: lha@@E.KTH.SE
745   Issued           Expires          Principal
746 May  3 13:55:52  May  3 23:55:54  krbtgt/E.KTH.SE@@E.KTH.SE
747 May  3 13:55:56  May  3 23:55:54  krbtgt/SU.SE@@E.KTH.SE
748 May  3 14:10:54  May  3 23:55:54  host/hummel.it.su.se@@SU.SE
750 @end example
752 @node Transit policy, Setting up DNS, Cross realm, Setting up a realm
753 @section Transit policy
754 @cindex Transit policy
756 If you want to use cross realm authentication through an intermediate
757 realm, it must be explicitly allowed by either the KDCs or the server
758 receiving the request. This is done in @file{krb5.conf} in the
759 @code{[capaths]} section.
761 When the ticket transits through a realm to another realm, the
762 destination realm adds its peer to the "transited-realms" field in the
763 ticket. The field is unordered, since there is no way to know if
764 know if one of the transited-realms changed the order of the list.
766 The syntax for @code{[capaths]} section:
768 @example
769 [capaths]
770         CLIENT-REALM = @{
771                 SERVER-REALM = PERMITTED-CROSS-REALMS ...
772         @}
773 @end example
775 The realm @code{STACKEN.KTH.SE} allows clients from @code{SU.SE} and
776 @code{DSV.SU.SE} to cross it. Since @code{STACKEN.KTH.SE} only has
777 direct cross realm setup with @code{KTH.SE}, and @code{DSV.SU.SE} only
778 has direct cross realm setup with @code{SU.SE} they need to use both
779 @code{SU.SE} and @code{KTH.SE} as transit realms.
781 @example
782 [capaths]
783         SU.SE = @{
784                     STACKEN.KTH.SE = KTH.SE
785         @}
786         DSV.SU.SE = @{
787                     STACKEN.KTH.SE = SU.SE KTH.SE
788         @}
790 @end example
792 The order of the @code{PERMITTED-CROSS-REALMS} is not important when
793 doing transit cross realm verification.
795 However, the order is important when the @code{[capaths]} section is used
796 to figure out the intermediate realm to go to when doing multi-realm
797 transit. When figuring out the next realm, the first realm of the list
798 of @code{PERMITTED-CROSS-REALMS} is chosen. This is done in both the
799 client kerberos library and the KDC.
801 @c To test the cross realm configuration, use:
802 @c    kmumble transit-check client server transit-realms ...
804 @node Setting up DNS, Using LDAP to store the database, Transit policy, Setting up a realm
805 @section Setting up DNS
806 @cindex Setting up DNS
808 @subsection Using DNS to find KDC
810 If there is information about where to find the KDC or kadmind for a
811 realm in the @file{krb5.conf} for a realm, that information will be
812 preferred, and DNS will not be queried.
814 Heimdal will try to use DNS to find the KDCs for a realm. First it
815 will try to find a @code{SRV} resource record (RR) for the realm. If no
816 SRV RRs are found, it will fall back to looking for an @code{A} RR for
817 a machine named kerberos.REALM, and then kerberos-1.REALM, etc
819 Adding this information to DNS minimises the client configuration (in
820 the common case, resulting in no configuration needed) and allows the
821 system administrator to change the number of KDCs and on what machines
822 they are running without caring about clients.
824 The downside of using DNS is that the client might be fooled to use the
825 wrong server if someone fakes DNS replies/data, but storing the IP
826 addresses of the KDC on all the clients makes it very hard to change
827 the infrastructure.
829 An example of the configuration for the realm @code{EXAMPLE.COM}:
831 @example
833 $ORIGIN example.com.
834 _kerberos._tcp          SRV     10 1 88 kerberos.example.com.
835 _kerberos._udp          SRV     10 1 88 kerberos.example.com.
836 _kerberos._tcp          SRV     10 1 88 kerberos-1.example.com.
837 _kerberos._udp          SRV     10 1 88 kerberos-1.example.com.
838 _kpasswd._udp           SRV     10 1 464 kerberos.example.com.
839 _kerberos-adm._tcp      SRV     10 1 749 kerberos.example.com.
841 @end example
843 More information about DNS SRV resource records can be found in
844 RFC-2782 (A DNS RR for specifying the location of services (DNS SRV)).
846 @subsection Using DNS to map hostname to Kerberos realm
848 Heimdal also supports a way to lookup a realm from a hostname. This to
849 minimise configuration needed on clients. Using this has the drawback
850 that clients can be redirected by an attacker to realms within the
851 same cross realm trust and made to believe they are talking to the
852 right server (since Kerberos authentication will succeed).
854 An example configuration that informs clients that for the realms
855 it.example.com and srv.example.com, they should use the realm
856 EXAMPLE.COM:
858 @example
860 $ORIGIN example.com.
861 _kerberos.it            TXT     "EXAMPLE.COM"
862 _kerberos.srv           TXT     "EXAMPLE.COM"
864 @end example
866 @node Using LDAP to store the database, Providing Kerberos credentials to servers and programs, Setting up DNS, Setting up a realm
867 @section Using LDAP to store the database
868 @cindex Using the LDAP backend
870 This document describes how to install the LDAP backend for
871 Heimdal. Note that before attempting to configure such an
872 installation, you should be aware of the implications of storing
873 private information (such as users' keys) in a directory service
874 primarily designed for public information. Nonetheless, with a
875 suitable authorisation policy, it is possible to set this up in a
876 secure fashion. A knowledge of LDAP, Kerberos, and C is necessary to
877 install this backend. The HDB schema was devised by Leif Johansson.
879 This assumes, OpenLDAP 2.3 or later.
881 Requirements:
883 @itemize @bullet
885 @item
886 A current release of Heimdal, configured with
887 @code{--with-openldap=/usr/local} (adjust according to where you have
888 installed OpenLDAP).
890 You can verify that you manage to configure LDAP support by running
891 @file{kdc --builtin-hdb}, and checking that @samp{ldap:} is one entry
892 in the list.
894 Its also possible to configure the ldap backend as a shared module,
895 see option --hdb-openldap-module to configure.
897 @item
898 Configure OpenLDAP with @kbd{--enable-local} to enable the local transport.
900 @item
901 Add the hdb schema to the LDAP server, it's included in the source-tree
902 in @file{lib/hdb/hdb.schema}. Example from slapd.conf:
904 @example
905 include /usr/local/etc/openldap/schema/hdb.schema
906 @end example
908 @item
909 Configure the LDAP server ACLs to accept writes from clients over the
910 local transport. For example:
912 @example
913 access to *
914         by dn.exact="uid=heimdal,dc=services,dc=example,dc=com" write
915         ...
917 authz-regexp "gidNumber=.*\\\+uidNumber=0,cn=peercred,cn=external,cn=auth''
918         "uid=heimdal,dc=services,dc=example,dc=com"
920 @end example
922 The sasl-regexp is for mapping between the SASL/EXTERNAL and a user in
923 a tree.  The user that the key is mapped to should be have a
924 krb5Principal aux object with krb5PrincipalName set so that the
925 ``creator'' and ``modifier'' is right in @file{kadmin}.
927 Another option is to create an admins group and add the dn to that
928 group.
930 Since Heimdal talks to the LDAP server over a UNIX domain socket, and
931 uses external sasl authentication, it's not possible to require
932 security layer quality (ssf in cyrus-sasl lingo). So that requirement
933 has to be turned off in OpenLDAP @command{slapd} configuration file
934 @file{slapd.conf}.
936 @example
937 sasl-secprops minssf=0
938 @end example
940 @item
942 Start @command{slapd} with the local listener (as well as the default TCP/IP
943 listener on port 389) as follows:
945 @example
946     slapd -h "ldapi:/// ldap:///"
947 @end example
949 Note: These is a bug in @command{slapd} where it appears to corrupt the krb5Key
950 binary attribute on shutdown. This may be related to our use of the V3
951 schema definition syntax instead of the old UMich-style, V2 syntax.
953 @item
954 You should specify the distinguished name under which your
955 principals will be stored in @file{krb5.conf}. Also you need to
956 enter the path to the kadmin acl file:
959 @example
960 [kdc]
961         database = @{
962                 dbname = ldap:ou=KerberosPrincipals,dc=example,dc=com
963                 hdb-ldap-structural-object = inetOrgPerson
964                 acl_file = /path/to/kadmind.acl
965                 mkey_file = /path/to/mkey
966         @}
967 @end example
969 @samp{mkey_file} can be excluded if you feel that you trust your ldap
970 directory to have the raw keys inside it.  The
971 hdb-ldap-structural-object is not necessary if you do not need Samba
972 comatibility.
976 @item
977 Once you have built Heimdal and started the LDAP server, run kadmin
978 (as usual) to initialise the database. Note that the instructions for
979 stashing a master key are as per any Heimdal installation.
981 @example
982 kdc# kadmin -l
983 kadmin> init EXAMPLE.COM
984 Realm max ticket life [unlimited]:
985 Realm max renewable ticket life [unlimited]:
986 kadmin> ank lukeh
987 Max ticket life [1 day]:
988 Max renewable life [1 week]:
989 Principal expiration time [never]:
990 Password expiration time [never]:
991 Attributes []:
992 lukeh@@EXAMPLE.COM's Password:
993 Verifying password - lukeh@@EXAMPLE.COM's Password:
994 kadmin> exit
995 @end example
997 Verify that the principal database has indeed been stored in the
998 directory with the following command:
1000 @example
1001 kdc# ldapsearch -L -h localhost -D cn=manager \
1002  -w secret -b ou=KerberosPrincipals,dc=example,dc=com \
1003  'objectclass=krb5KDCEntry'
1004 @end example
1006 @item
1007 Now consider adding indexes to the database to speed up the access, at
1008 least theses should be added to slapd.conf.
1010 @example
1011 index   objectClass             eq
1012 index   cn                      eq,sub,pres
1013 index   uid                     eq,sub,pres
1014 index   displayName             eq,sub,pres
1015 index   krb5PrincipalName       eq
1016 @end example
1018 @end itemize
1020 @subsection smbk5pwd overlay
1022 The smbk5pwd overlay, updates the krb5Key and krb5KeyVersionNumber
1023 appropriately when it receives an LDAP Password change Extended
1024 Operation:
1026 @url{http://www.openldap.org/devel/cvsweb.cgi/contrib/slapd-modules/smbk5pwd/README?hideattic=1&sortbydate=0}
1028 @subsection Troubleshooting guide
1030 @url{https://sec.miljovern.no/bin/view/Info/TroubleshootingGuide}
1033 @subsection Using Samba LDAP password database
1034 @cindex Samba
1036 @c @node Using Samba LDAP password database, Providing Kerberos credentials to servers and programs, Using LDAP to store the database, Setting up a realm
1037 @c @section Using Samba LDAP password database
1039 The Samba domain and the Kerberos realm can have different names since
1040 arcfour's string to key functions principal/realm independent.  So now
1041 will be your first and only chance name your Kerberos realm without
1042 needing to deal with old configuration files.
1044 First, you should set up Samba and get that working with LDAP backend.
1046 Now you can proceed as in @xref{Using LDAP to store the database}.
1047 Heimdal will pick up the Samba LDAP entries if they are in the same
1048 search space as the Kerberos entries.
1050 @node Providing Kerberos credentials to servers and programs, Setting up PK-INIT, Using LDAP to store the database, Setting up a realm
1051 @section Providing Kerberos credentials to servers and programs
1053 Some services require Kerberos credentials when they start to make
1054 connections to other services or need to use them when they have started.
1056 The easiest way to get tickets for a service is to store the key in a
1057 keytab. Both ktutil get and kadmin ext can be used to get a
1058 keytab. ktutil get is better in that way it changes the key/password
1059 for the user. This is also the problem with ktutil. If ktutil is used
1060 for the same service principal on several hosts, they keytab will only
1061 be useful on the last host. In that case, run the extract command on
1062 one host and then securely copy the keytab around to all other hosts
1063 that need it.
1065 @example
1066 host# ktutil -k /etc/krb5-service.keytab \
1067       get -p lha/admin@@EXAMPLE.ORG service-principal@@EXAMPLE.ORG
1068 lha/admin@@EXAMPLE.ORG's Password:
1069 @end example
1071 To get a Kerberos credential file for the service, use kinit in the
1072 @kbd{--keytab} mode. This will not ask for a password but instead fetch the
1073 key from the keytab.
1075 @example
1076 service@@host$ kinit --cache=/var/run/service_krb5_cache \
1077                --keytab=/etc/krb5-service.keytab \
1078        service-principal@@EXAMPLE.ORG
1079 @end example
1081 Long running services might need credentials longer then the
1082 expiration time of the tickets. kinit can run in a mode that refreshes
1083 the tickets before they expire. This is useful for services that write
1084 into AFS and other distributed file systems using Kerberos. To run the
1085 long running script, just append the program and arguments (if any)
1086 after the principal. kinit will stop refreshing credentials and remove
1087 the credentials when the script-to-start-service exits.
1089 @example
1090 service@@host$ kinit --cache=/var/run/service_krb5_cache \
1091        --keytab=/etc/krb5-service.keytab \
1092        service-principal@@EXAMPLE.ORG \
1093        script-to-start-service argument1 argument2
1094 @end example
1097 @node Setting up PK-INIT, , Providing Kerberos credentials to servers and programs, Setting up a realm
1098 @section Setting up PK-INIT
1100 PK-INIT is levering the existing PKI infrastructure to use
1101 certificates to get the initial ticket, that is usually the krbtgt.
1103 To use PK-INIT you must first have a PKI, so if you don't have one,
1104 it is time to create it. Note that you should read the whole chapter
1105 of the document to see the requirements on the CA software.
1107 There needs to exist a mapping between the certificate and what
1108 principals that certificate is allowed to use. There are several ways
1109 to do this. The administrator can use a configuration file, storing
1110 the principal in the SubjectAltName extension of the certificate, or store the
1111 mapping in the principals entry in the kerberos database.
1113 @section Certificates
1115 This section documents the requirements on the KDC and client
1116 certificates and the format used in the id-pkinit-san OtherName
1117 extention.
1119 @subsection KDC certificate
1121 The certificate for the KDC have serveral requirements.
1123 First the certificate should have an Extended Key Usage (EKU)
1124 id-pkkdcekuoid (1.3.6.1.5.2.3.5) set. Second there must be a
1125 subjectAltName otherName using oid id-pkinit-san (1.3.6.1.5.2.2) in
1126 the type field and a DER encoded KRB5PrincipalName that matches the
1127 name of the TGS of the target realm.
1129 Both of these two requirements are not required by the standard to be
1130 checked by the client if it have external information what the
1131 certificate the KDC is supposed to be used. So it's in the interest of
1132 minimum amount of configuration on the clients they should be included.
1134 Remember that if the client would accept any certificate as the KDC's
1135 certificate, the client could be fooled into trusting something that
1136 isn't a KDC and thus expose the user to giving away information (like
1137 password or other private information) that it is supposed to secret.
1139 Also, if the certificate has a nameConstraints extention with a
1140 Generalname with dNSName or iPAdress it must match the hostname or
1141 adress of the KDC.
1143 @subsection Client certificate
1145 The client certificate may need to have a EKU id-pkekuoid
1146 (1.3.6.1.5.2.3.4) set depending on the certifiate on the KDC.
1148 It possible to store the principal (if allowed by the KDC) in the
1149 certificate and thus delegate responsibility to do the mapping between
1150 certificates and principals to the CA.
1152 This behavior is controlled by KDC configuration option:
1154 @example
1155 [kdc]
1156         pkinit_principal_in_certificate = yes
1157 @end example
1160 @subsubsection Using KRB5PrincipalName in id-pkinit-san
1162 OtherName extention in the GeneralName is used to do the
1163 mapping between certifiate and principal in the certifiate or storing
1164 the krbtgt principal in the KDC certificate.
1166 The principal is stored in a SubjectAltName in the certificate using
1167 OtherName. The oid in the type is id-pkinit-san.
1169 @example
1170 id-pkinit-san OBJECT IDENTIFIER ::= @{ iso (1) org (3) dod (6)
1171 internet (1) security (5) kerberosv5 (2) 2 @}
1172 @end example
1174 The data part of the OtherName is filled with the following DER
1175 encoded ASN.1 structure:
1177 @example
1178 KRB5PrincipalName ::= SEQUENCE @{
1179         realm [0] Realm,
1180         principalName [1] PrincipalName
1182 @end example
1184 where Realm and PrincipalName is defined by the Kerberos ASN.1 specification.
1186 @section Naming certificate using hx509
1188 hx509 is the X.509 software used in Heimdal to handle
1189 certificates. hx509 uses different syntaxes to specify the different
1190 formats the certificates are stored in and what formats they exist in.
1192 There are several formats that can be used, PEM, embedded into PKCS12
1193 files, embedded into PKCS11 devices and raw DER encoded certificates.
1194 Below is a list of types to use.
1197 @table @asis
1199 @item DIR:
1201 DIR is reading all certificates in a directory that is DER or PEM
1202 formatted.
1204 The main feature of DIR is that the directory is read on demand when
1205 iterating over certificates, that way applictions can for some cases
1206 avoid to store all certificates in memory. It's very useful for tests
1207 that iterate over larger amount of certificates.
1209 Syntax is:
1211 @example
1212 DIR:/path/to/der/files
1213 @end example
1215 @item FILE:
1217 FILE: is used to have the lib pick up a certificate chain and a
1218 private key. The file can be either a PEM (openssl) file or a raw DER
1219 encoded certificate. If it's a PEM file it can contain several keys and
1220 certificates and the code will try to match the private key and
1221 certificate together.
1223 Its useful to have one PEM file that contains all the trust anchors.
1225 Syntax is:
1227 @example
1228 FILE:certificate.pem,private-key.key,other-cert.pem,....
1229 @end example
1231 @item PKCS11:
1233 PKCS11: is used to handle smartcards via PKCS11 drivers, for example
1234 soft-token, opensc, or muscle. The default is to use all slots on the
1235 device/token.
1237 Syntax is:
1239 @example
1240 PKCS11:shared-object.so
1241 @end example
1243 @item PKCS12:
1245 PKCS12: is used to handle PKCS12 files. PKCS12 files commonly have the
1246 extension pfx or p12.
1248 Syntax is:
1250 @example
1251 PKCS12:/path/to/file.pfx
1252 @end example
1254 @end table
1256 @section Configure the Kerberos software
1258 First configure the client's trust anchors and what parameters to
1259 verify, see subsection below how to do that. Now you can use kinit to
1260 get yourself tickets. One example how that can look like is:
1262 @example
1263 $ kinit -C FILE:$HOME/.certs/lha.crt,$HOME/.certs/lha.key lha@@EXAMPLE.ORG
1264 Enter your private key passphrase:
1265 : lha@@nutcracker ; klist
1266 Credentials cache: FILE:/tmp/krb5cc_19100a
1267         Principal: lha@@EXAMPLE.ORG
1269   Issued           Expires          Principal
1270 Apr 20 02:08:08  Apr 20 12:08:08  krbtgt/EXAMPLE.ORG@@EXAMPLE.ORG
1271 @end example
1273 Using PKCS11 it can look like this instead:
1275 @example
1276 $ kinit -C PKCS11:/usr/heimdal/lib/hx509.so lha@@EXAMPLE.ORG
1277 PIN code for SoftToken (slot):
1278 $ klist
1279 Credentials cache: API:4
1280         Principal: lha@@EXAMPLE.ORG
1282   Issued           Expires          Principal
1283 Mar 26 23:40:10  Mar 27 09:40:10  krbtgt/EXAMPLE.ORG@@EXAMPLE.ORG
1284 @end example
1287 Write about the kdc.
1289 @section Configure the client
1291 @example
1292 [appdefaults]
1293         pkinit_anchors = FILE:/path/to/trust-anchors.pem
1295 [realms]
1296         EXAMPLE.COM = @{
1297                 pkinit_require_eku = true
1298                 pkinit_require_krbtgt_otherName = true
1299                 pkinit_win2k = no
1300                 pkinit_win2k_require_binding = yes
1301         @}
1303 @end example
1305 @section Configure the KDC
1307 @example
1308 [kdc]
1309         enable-pkinit = yes
1310         pkinit_identity = FILE:/secure/kdc.crt,/secure/kdc.key
1311         pkinit_anchors = FILE:/path/to/trust-anchors.pem
1312         pkinit_pool = PKCS12:/path/to/useful-intermediate-certs.pfx
1313         pkinit_pool = FILE:/path/to/other-useful-intermediate-certs.pem
1314         pkinit_allow_proxy_certificate = no
1315         pkinit_win2k_require_binding = yes
1316         pkinit_principal_in_certificate = no
1317 @end example
1319 @subsection Using pki-mapping file
1321 Note that the file name is space sensitive.
1323 @example
1324 # cat /var/heimdal/pki-mapping
1325 # comments starts with #
1326 lha@@EXAMPLE.ORG:C=SE,O=Stockholm universitet,CN=Love,UID=lha
1327 lha@@EXAMPLE.ORG:CN=Love,UID=lha
1328 @end example
1330 @subsection Using the Kerberos database
1332 @section Use hxtool to create certificates
1334 @subsection Generate certificates
1336 First you need to generate a CA certificate, change the --subject to
1337 something appropriate, the CA certificate will be valid for 10 years.
1339 You need to change --subject in the command below.
1341 @example
1342 hxtool issue-certificate \
1343     --self-signed \
1344     --issue-ca \
1345     --generate-key=rsa \
1346     --subject="CN=CA,DC=test,DC=h5l,DC=se" \
1347     --lifetime=10years \
1348     --certificate="FILE:ca.pem"
1349 @end example
1351 The KDC needs to have a certificate, so generate a certificate of the
1352 type ``pkinit-kdc'' and set the PK-INIT specifial SubjectAltName to the
1353 name of the krbtgt of the realm.
1355 You need to change --subject and --pk-init-principal in the command below.
1357 @example
1358 hxtool issue-certificate \
1359     --ca-certificate=FILE:ca.pem \
1360     --generate-key=rsa \
1361     --type="pkinit-kdc" \
1362     --pk-init-principal="krbtgt/TEST.H5L.SE@@TEST.H5L.SE" \
1363     --subject="uid=kdc,DC=test,DC=h5l,DC=se" \
1364     --certificate="FILE:kdc.pem"
1365 @end example
1367 The users also needs to have a certificate, so generate a certificate
1368 of the type ``pkinit-client''. The client doesn't need to have the PK-INIT
1369 SubjectAltName set, you can have the Subject DN in the ACL file
1370 (pki-mapping) instead.
1372 You need to change --subject and --pk-init-principal in the command below.
1374 @example
1375 hxtool issue-certificate \
1376     --ca-certificate=FILE:ca.pem \
1377     --generate-key=rsa \
1378     --type="pkinit-client" \
1379     --pk-init-principal="lha@@TEST.H5L.SE" \
1380     --subject="uid=lha,DC=test,DC=h5l,DC=se" \
1381     --certificate="FILE:user.pem"
1382 @end example
1384 @subsection Validate the certificate
1386 hxtool also contains a tool that will validate certificates according to
1387 rules from the PKIX document. These checks are not complete, but a good test
1388 to check if you got all of the basic bits right in your certificates.
1390 @example
1391 hxtool validate FILE:user.pem
1392 @end example
1394 @section Use OpenSSL to create certificates
1396 This section tries to give the CA owners hints how to create
1397 certificates using OpenSSL (or CA software based on OpenSSL).
1399 @subsection Using OpenSSL to create certificates with krb5PrincipalName
1401 To make OpenSSL create certificates with krb5PrincipalName use
1402 @file{openssl.cnf} as described below. To see a complete example of
1403 creating client and KDC certificates, see the test-data generation
1404 script @file{lib/hx509/data/gen-req.sh} in the source-tree. The
1405 certicates it creates are used to test the PK-INIT functionality in
1406 @file{tests/kdc/check-kdc.in}.
1408 To use this example you have to use OpenSSL 0.9.8a or later.
1410 @example
1412 [user_certificate]
1413 subjectAltName=otherName:1.3.6.1.5.2.2;SEQUENCE:princ_name
1415 [princ_name]
1416 realm = EXP:0, GeneralString:MY.REALM
1417 principal_name = EXP:1, SEQUENCE:principal_seq
1419 [principal_seq]
1420 name_type = EXP:0, INTEGER:1
1421 name_string = EXP:1, SEQUENCE:principals
1423 [principals]
1424 princ1 = GeneralString:userid
1426 @end example
1428 Command usage
1430 @example
1431 openssl x509 -extensions user_certificate
1432 openssl ca -extensions user_certificate
1433 @end example
1436 @c --- ms certificate
1438 @c [ new_oids ]
1439 @c msCertificateTemplateName       = 1.3.6.1.4.1.311.20.2
1442 @c [ req_smartcard ]
1443 @c keyUsage                = digitalSignature, keyEncipherment
1444 @c extendedKeyUsage        = msSmartcardLogin, clientAuth
1445 @c msCertificateTemplateName       = ASN1:BMP:SmartcardLogon
1446 @c subjectAltName          = otherName:msUPN;UTF8:lukeh@dsg.padl.com
1447 @c #subjectAltName         = email:copy
1450 @section Using PK-INIT with Windows
1452 @subsection Client configration
1454 Clients using a Windows KDC with PK-INIT need configuration since
1455 windows uses pre-standard format and this can't be autodetected.
1457 The pkinit_win2k_require_binding option requires the reply for the KDC
1458 to be of the new, secure, type that binds the request to reply. Before
1459 clients should fake the reply from the KDC. To use this option you
1460 have to apply a fix from Microsoft.
1462 @example
1463 [realms]
1464         MY.MS.REALM = @{
1465                 pkinit_win2k = yes
1466                 pkinit_win2k_require_binding = no
1467         @}
1468 @end example
1470 @subsection Certificates
1472 The client certificates need to have the extended keyusage ``Microsoft
1473 Smartcardlogin'' (openssl have the oid shortname msSmartcardLogin).
1475 See Microsoft Knowledge Base Article - 281245 ``Guidelines for Enabling
1476 Smart Card Logon with Third-Party Certification Authorities'' for a
1477 more extensive description of how set setup an external CA to it
1478 includes all information that will make a Windows KDC happy.
1480 @subsection Configure Windows 2000 CA
1482 To enable Microsoft Smartcardlogin> for certificates in your Windows
1483 2000 CA, you want to look at Microsoft Knowledge Base Article -
1484 313274 ``HOW TO: Configure a Certification Authority to Issue
1485 Smart Card Certificates in Windows''.