Home | History | Annotate | Line # | Download | only in doc
hx509.texi revision 1.1.1.1
      1 \input texinfo @c -*- texinfo -*-
      2 @c $NetBSD: hx509.texi,v 1.1.1.1 2011/04/13 18:14:33 elric Exp $
      3 @c %**start of header
      4 @c $Id: hx509.texi,v 1.1.1.1 2011/04/13 18:14:33 elric Exp $
      5 @setfilename hx509.info
      6 @settitle HX509
      7 @iftex
      8 @afourpaper
      9 @end iftex
     10 @c some sensible characters, please?
     11 @tex
     12 \input latin1.tex
     13 @end tex
     14 @setchapternewpage on
     15 @syncodeindex pg cp
     16 @c %**end of header
     17 
     18 @include vars.texi
     19 
     20 @set VERSION @value{PACKAGE_VERSION}
     21 @set EDITION 1.0
     22 
     23 @ifinfo
     24 @dircategory Security
     25 @direntry
     26 * hx509: (hx509).               The X.509 distribution from KTH
     27 @end direntry
     28 @end ifinfo
     29 
     30 @c title page
     31 @titlepage
     32 @title HX509
     33 @subtitle X.509 distribution from KTH
     34 @subtitle Edition @value{EDITION}, for version @value{VERSION}
     35 @subtitle 2008
     36 @author Love Hrnquist strand
     37 
     38 @def@copynext{@vskip 20pt plus 1fil}
     39 @def@copyrightstart{}
     40 @def@copyrightend{}
     41 @page
     42 @copyrightstart
     43 Copyright (c) 1994-2008 Kungliga Tekniska Hgskolan
     44 (Royal Institute of Technology, Stockholm, Sweden).
     45 All rights reserved.
     46 
     47 Redistribution and use in source and binary forms, with or without
     48 modification, are permitted provided that the following conditions
     49 are met:
     50 
     51 1. Redistributions of source code must retain the above copyright
     52    notice, this list of conditions and the following disclaimer.
     53 
     54 2. Redistributions in binary form must reproduce the above copyright
     55    notice, this list of conditions and the following disclaimer in the
     56    documentation and/or other materials provided with the distribution.
     57 
     58 3. Neither the name of the Institute nor the names of its contributors
     59    may be used to endorse or promote products derived from this software
     60    without specific prior written permission.
     61 
     62 THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
     63 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     64 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     65 ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
     66 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     67 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     68 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     69 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     70 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     71 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     72 SUCH DAMAGE.
     73 
     74 @copynext
     75 
     76 Copyright (c) 1988, 1990, 1993
     77      The Regents of the University of California.  All rights reserved.
     78 
     79 Redistribution and use in source and binary forms, with or without
     80 modification, are permitted provided that the following conditions
     81 are met:
     82 
     83 1. Redistributions of source code must retain the above copyright
     84    notice, this list of conditions and the following disclaimer.
     85 
     86 2. Redistributions in binary form must reproduce the above copyright
     87    notice, this list of conditions and the following disclaimer in the
     88    documentation and/or other materials provided with the distribution.
     89 
     90 3. Neither the name of the University nor the names of its contributors
     91    may be used to endorse or promote products derived from this software
     92    without specific prior written permission.
     93 
     94 THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     95 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     96 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     97 ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     98 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     99 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    100 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    101 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    102 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    103 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    104 SUCH DAMAGE.
    105 
    106 @copynext
    107 
    108 Copyright 1992 Simmule Turner and Rich Salz.  All rights reserved.
    109 
    110 This software is not subject to any license of the American Telephone
    111 and Telegraph Company or of the Regents of the University of California.
    112 
    113 Permission is granted to anyone to use this software for any purpose on
    114 any computer system, and to alter it and redistribute it freely, subject
    115 to the following restrictions:
    116 
    117 1. The authors are not responsible for the consequences of use of this
    118    software, no matter how awful, even if they arise from flaws in it.
    119 
    120 2. The origin of this software must not be misrepresented, either by
    121    explicit claim or by omission.  Since few users ever read sources,
    122    credits must appear in the documentation.
    123 
    124 3. Altered versions must be plainly marked as such, and must not be
    125    misrepresented as being the original software.  Since few users
    126    ever read sources, credits must appear in the documentation.
    127 
    128 4. This notice may not be removed or altered.
    129 
    130 @copynext
    131 
    132 IMath is Copyright 2002-2005 Michael J. Fromberger
    133 You may use it subject to the following Licensing Terms:
    134 
    135 Permission is hereby granted, free of charge, to any person obtaining
    136 a copy of this software and associated documentation files (the
    137 "Software"), to deal in the Software without restriction, including
    138 without limitation the rights to use, copy, modify, merge, publish,
    139 distribute, sublicense, and/or sell copies of the Software, and to
    140 permit persons to whom the Software is furnished to do so, subject to
    141 the following conditions:
    142 
    143 The above copyright notice and this permission notice shall be
    144 included in all copies or substantial portions of the Software.
    145 
    146 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    147 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    148 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    149 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    150 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    151 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    152 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    153 
    154 @copyrightend
    155 @end titlepage
    156 
    157 @macro manpage{man, section}
    158 @cite{\man\(\section\)}
    159 @end macro
    160 
    161 @c Less filling! Tastes great!
    162 @iftex
    163 @parindent=0pt
    164 @global@parskip 6pt plus 1pt
    165 @global@chapheadingskip = 15pt plus 4pt minus 2pt
    166 @global@secheadingskip = 12pt plus 3pt minus 2pt
    167 @global@subsecheadingskip = 9pt plus 2pt minus 2pt
    168 @end iftex
    169 @ifinfo
    170 @paragraphindent 0
    171 @end ifinfo
    172 
    173 @ifnottex
    174 @node Top, Introduction, (dir), (dir)
    175 @top Heimdal
    176 @end ifnottex
    177 
    178 This manual is for version @value{VERSION} of hx509.
    179 
    180 @menu
    181 * Introduction::
    182 * What is X.509 ?::
    183 * Setting up a CA::
    184 * CMS signing and encryption::
    185 * Certificate matching::
    186 * Software PKCS 11 module::
    187 
    188 @detailmenu
    189  --- The Detailed Node Listing ---
    190 
    191 Setting up a CA
    192 
    193 @c * Issuing certificates::
    194 * Creating a CA certificate::
    195 * Issuing certificates::
    196 * Issuing CRLs::
    197 @c * Issuing a proxy certificate::
    198 @c * Creating a user certificate::
    199 @c * Validating a certificate::
    200 @c * Validating a certificate path::
    201 * Application requirements::
    202 
    203 CMS signing and encryption
    204 
    205 * CMS background::
    206 
    207 Certificate matching
    208 
    209 * Matching syntax::
    210 
    211 Software PKCS 11 module
    212 
    213 * How to use the PKCS11 module::
    214 
    215 @end detailmenu
    216 @end menu
    217 
    218 @node Introduction, What is X.509 ?, Top, Top
    219 @chapter Introduction
    220 
    221 The goals of a PKI infrastructure (as defined in 
    222 <a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280</a>) is to meet 
    223 @emph{the needs of deterministic, automated identification, authentication, access control, and authorization}.
    224 
    225 
    226 The administrator should be aware of certain terminologies as explained by the aforementioned
    227 RFC before attemping to put in place a PKI infrastructure. Briefly, these are: 
    228 
    229 @itemize @bullet
    230 @item CA
    231 Certificate Authority
    232 @item RA
    233 Registration Authority, i.e., an optional system to which a CA delegates certain management functions.
    234 @item CRL Issuer
    235 An optional system to which a CA delegates the publication of certificate revocation lists.
    236 @item Repository
    237 A system or collection of distributed systems that stores certificates and CRLs 
    238 and serves as a means of distributing these certificates and CRLs to end entities
    239 @end itemize
    240 
    241 hx509 (Heimdal x509 support) is a near complete X.509 stack that can
    242 handle CMS messages (crypto system used in S/MIME and Kerberos PK-INIT)
    243 and basic certificate processing tasks, path construction, path
    244 validation, OCSP and CRL validation, PKCS10 message construction, CMS
    245 Encrypted (shared secret encrypted), CMS SignedData (certificate
    246 signed), and CMS EnvelopedData (certificate encrypted).
    247 
    248 hx509 can use PKCS11 tokens, PKCS12 files, PEM files, and/or DER encoded
    249 files.
    250 
    251 @node What is X.509 ?, Setting up a CA, Introduction, Top
    252 @chapter What is X.509, PKIX, PKCS7 and CMS ? 
    253 
    254 X.509 was created by CCITT (later ITU) for the X.500 directory
    255 service. Today, X.509 discussions and implementations commonly reference
    256 the IETF's PKIX Certificate and CRL Profile of the X.509 v3 certificate
    257 standard, as specified in RFC 3280.
    258 
    259 ITU continues to develop the X.509 standard together with the IETF in a 
    260 rather complicated dance.
    261 
    262 X.509 is a public key based security system that has associated data
    263 stored within a so called certificate. Initially, X.509 was a strict
    264 hierarchical system with one root. However, ever evolving requiments and
    265 technology advancements saw the inclusion of multiple policy roots,
    266 bridges and mesh solutions.
    267 
    268 x.509 can also be used as a peer to peer system, though often seen as a
    269 common scenario.
    270 
    271 @section Type of certificates
    272 
    273 There are several flavors of certificate in X.509.
    274 
    275 @itemize @bullet
    276 
    277 @item Trust anchors
    278 
    279 Trust anchors are strictly not certificates, but commonly stored in a
    280 certificate format as they become easier to manage. Trust anchors are
    281 the keys that an end entity would trust to validate other certificates.
    282 This is done by building a path from the certificate you want to
    283 validate to to any of the trust anchors you have.
    284 
    285 @item End Entity (EE) certificates
    286 
    287 End entity certificates are the most common types of certificates. End
    288 entity certificates cannot issue (sign) certificate themselves and are generally
    289 used to authenticate and authorize users and services.
    290 
    291 @item Certification Authority (CA) certificates
    292 
    293 Certificate authority certificates have the right to issue additional
    294 certificates (be it sub-ordinate CA certificates to build an trust anchors
    295 or end entity certificates). There is no limit to how many certificates a CA
    296 may issue, but there might other restrictions, like the maximum path
    297 depth.
    298 
    299 @item Proxy certificates
    300 
    301 Remember the statement "End Entity certificates cannot issue
    302 certificates"?  Well that statement is not entirely true. There is an
    303 extension called proxy certificates defined in RFC3820, that allows
    304 certificates to be issued by end entity certificates. The service that
    305 receives the proxy certificates must have explicitly turned on support
    306 for proxy certificates, so their use is somewhat limited.
    307 
    308 Proxy certificates can be limited by policies stored in the certificate to
    309 what they can be used for. This allows users to delegate the proxy
    310 certificate to services (by sending over the certificate and private
    311 key) so the service can access services on behalf of the user.
    312 
    313 One example of this would be a print service. The user wants to print a
    314 large job in the middle of the night when the printer isn't used that
    315 much, so the user creates a proxy certificate with the policy that it
    316 can only be used to access files related to this print job, creates the
    317 print job description and send both the description and proxy
    318 certificate with key over to print service. Later at night when the
    319 print service initializes (without any user intervention), access to the files 
    320 for the print job is granted via the proxy certificate. As a result of (in-place) 
    321 policy limitations, the certificate cannot be used for any other purposes.
    322 
    323 @end itemize
    324 
    325 @section Building a path
    326 
    327 Before validating a certificate path (or chain), the path needs to be
    328 constructed.  Given a certificate (EE, CA, Proxy, or any other type),
    329 the path construction algorithm will try to find a path to one of the
    330 trust anchors.
    331 
    332 The process starts by looking at the issuing CA of the certificate, by
    333 Name or Key Identifier, and tries to find that certificate while at the
    334 same time evaluting any policies in-place.
    335 
    336 @node Setting up a CA, Creating a CA certificate, What is X.509 ?, Top
    337 @chapter Setting up a CA
    338 
    339 Do not let information overload scare you off! If you are simply testing
    340 or getting started with a PKI infrastructure, skip all this and go to
    341 the next chapter (see: @pxref{Creating a CA certificate}).
    342 
    343 Creating a CA certificate should be more the just creating a
    344 certificate, CA's should define a policy. Again, if you are simply
    345 testing a PKI, policies do not matter so much. However, when it comes to
    346 trust in an organisation, it will probably matter more whom your users
    347 and sysadmins will find it acceptable to trust.
    348 
    349 At the same time, try to keep things simple, it's not very hard to run a
    350 Certificate authority and the process to get new certificates should be simple.
    351 
    352 You may find it helpful to answer the following policy questions for
    353 your organization at a later stage:
    354 
    355 @itemize @bullet
    356 @item How do you trust your CA.
    357 @item What is the CA responsibility.
    358 @item Review of CA activity.
    359 @item How much process should it be to issue certificate.
    360 @item Who is allowed to issue certificates.
    361 @item Who is allowed to requests certificates.
    362 @item How to handle certificate revocation, issuing CRLs and maintain OCSP services.
    363 @end itemize
    364 
    365 @node Creating a CA certificate, Issuing certificates, Setting up a CA, Top
    366 @section Creating a CA certificate
    367 
    368 This section describes how to create a CA certificate and what to think
    369 about.
    370 
    371 @subsection Lifetime CA certificate
    372 
    373 You probably want to create a CA certificate with a long lifetime, 10
    374 years at the very minimum. This is because you don't want to push out the
    375 certificate (as a trust anchor) to all you users again when the old
    376 CA certificate expires. Although a trust anchor can't really expire, not all
    377 software works in accordance with published standards.
    378 
    379 Keep in mind the security requirements might be different 10-20 years
    380 into the future. For example, SHA1 is going to be withdrawn in 2010, so
    381 make sure you have enough buffering in your choice of digest/hash
    382 algorithms, signature algorithms and key lengths.
    383 
    384 @subsection Create a CA certificate
    385 
    386 This command below can be used to generate a self-signed CA certificate.
    387 
    388 @example
    389 hxtool issue-certificate \
    390     --self-signed \
    391     --issue-ca \
    392     --generate-key=rsa \
    393     --subject="CN=CertificateAuthority,DC=test,DC=h5l,DC=se" \
    394     --lifetime=10years \
    395     --certificate="FILE:ca.pem"
    396 @end example
    397 
    398 @subsection Extending the lifetime of a CA certificate
    399 
    400 You just realised that your CA certificate is going to expire soon and
    401 that you need replace it with a new CA. The easiest way to do that
    402 is to extend the lifetime of your existing CA certificate.
    403 
    404 The example below will extend the CA certificate's lifetime by 10 years. 
    405 You should compare this new certificate if it contains all the
    406 special tweaks as the old certificate had.
    407 
    408 @example
    409 hxtool issue-certificate \
    410     --self-signed \
    411     --issue-ca \
    412     --lifetime="10years" \
    413     --template-certificate="FILE:ca.pem" \
    414     --template-fields="serialNumber,notBefore,subject,SPKI" \
    415     --ca-private-key=FILE:ca.pem \
    416     --certificate="FILE:new-ca.pem"
    417 @end example
    418 
    419 @subsection Subordinate CA
    420 
    421 This example below creates a new subordinate certificate authority.
    422 
    423 @example
    424 hxtool issue-certificate \
    425     --ca-certificate=FILE:ca.pem \
    426     --issue-ca \
    427     --generate-key=rsa \
    428     --subject="CN=CertificateAuthority,DC=dev,DC=test,DC=h5l,DC=se" \
    429     --certificate="FILE:dev-ca.pem"
    430 @end example
    431 
    432 
    433 @node Issuing certificates, Issuing CRLs, Creating a CA certificate, Top
    434 @section Issuing certificates
    435 
    436 First you'll create a CA certificate, after that you have to deal with
    437 your users and servers and issue certificates to them.
    438 
    439 @c I think this section needs a bit of clarity. Can I add a separate
    440 @c section which explains CSRs as well?
    441 
    442 
    443 @itemize @bullet
    444 
    445 @item Do all the work themself
    446 
    447 Generate the key for the user. This has the problme that the the CA
    448 knows the private key of the user. For a paranoid user this might leave
    449 feeling of disconfort.
    450 
    451 @item Have the user do part of the work
    452 
    453 Receive PKCS10 certificate requests fromusers. PKCS10 is a request for a
    454 certificate.  The user may specify what DN they want as well as provide
    455 a certificate signing request (CSR).  To prove the user have the key,
    456 the whole request is signed by the private key of the user.
    457 
    458 @end itemize
    459 
    460 @subsection Name space management
    461 
    462 @c The explanation given below is slightly unclear. I will re-read the
    463 @c RFC and document accordingly
    464 
    465 What people might want to see.
    466 
    467 Re-issue certificates just because people moved within the organization.
    468 
    469 Expose privacy information.
    470 
    471 Using Sub-component name (+ notation).
    472 
    473 @subsection Certificate Revocation, CRL and OCSP
    474 
    475 Certificates that a CA issues may need to be revoked at some stage. As
    476 an example, an employee leaves the organization and does not bother
    477 handing in his smart card (or even if the smart card is handed back --
    478 the certificate on it must no longer be acceptable to services; the
    479 employee has left).
    480 
    481 You may also want to revoke a certificate for a service which is no
    482 longer being offered on your network. Overlooking these scenarios can
    483 lead to security holes which will quickly become a nightmare to deal
    484 with.
    485 
    486 There are two primary protocols for dealing with certificate
    487 revokation. Namely:
    488 
    489 @itemize @bullet
    490 @item Certificate Revocation List (CRL)
    491 @item Online Certificate Status Protocol (OCSP)
    492 @end itemize
    493 
    494 If however the certificate in qeustion has been destroyed, there is no
    495 need to revoke the certificate because it can not be used by someone
    496 else. This matter since for each certificate you add to CRL, the
    497 download time and processing time for clients are longer.
    498 
    499 CRLs and OCSP responders however greatly help manage compatible services
    500 which may authenticate and authorize users (or services) on an on-going
    501 basis. As an example, VPN connectivity established via certificates for
    502 connecting clients would require your VPN software to make use of a CRL
    503 or an OCSP service to ensure revoked certificates belonging to former
    504 clients are not allowed access to (formerly subscribed) network
    505 services.
    506 
    507 
    508 @node Issuing CRLs, Application requirements, Issuing certificates, Top
    509 @section Issuing CRLs
    510 
    511 Create an empty CRL with no certificates revoked. Default expiration
    512 value is one year from now.
    513 
    514 @example
    515 hxtool crl-sign \
    516 	--crl-file=crl.der \
    517 	--signer=FILE:ca.pem
    518 @end example
    519 
    520 Create a CRL with all certificates in the directory
    521 @file{/path/to/revoked/dir} included in the CRL as revoked.  Also make
    522 it expire one month from now.
    523 
    524 @example
    525 hxtool crl-sign \
    526 	--crl-file=crl.der \
    527         --signer=FILE:ca.pem \
    528 	--lifetime='1 month' \
    529         DIR:/path/to/revoked/dir
    530 @end example
    531 
    532 @node Application requirements, CMS signing and encryption, Issuing CRLs, Top
    533 @section Application requirements
    534 
    535 Application place different requirements on certificates. This section
    536 tries to expand what they are and how to use hxtool to generate
    537 certificates for those services.
    538 
    539 @subsection HTTPS - server
    540 
    541 @example
    542 hxtool issue-certificate \
    543 	  --subject="CN=www.test.h5l.se,DC=test,DC=h5l,DC=se" \
    544 	  --type="https-server" \
    545           --hostname="www.test.h5l.se" \
    546           --hostname="www2.test.h5l.se" \
    547           ...
    548 @end example
    549 
    550 @subsection HTTPS - client
    551 
    552 @example
    553 hxtool issue-certificate \
    554 	  --subject="UID=testus,DC=test,DC=h5l,DC=se" \
    555 	  --type="https-client" \
    556           ...
    557 @end example
    558 
    559 @subsection S/MIME - email
    560 
    561 There are two things that should be set in S/MIME certificates, one or
    562 more email addresses and an extended eku usage (EKU), emailProtection.
    563 
    564 The email address format used in S/MIME certificates is defined in
    565 RFC2822, section 3.4.1 and it should be an ``addr-spec''.
    566 
    567 There are two ways to specifify email address in certificates. The old
    568 way is in the subject distinguished name, @emph{this should not be used}. The
    569 new way is using a Subject Alternative Name (SAN).
    570 
    571 Even though the email address is stored in certificates, they don't need
    572 to be, email reader programs are required to accept certificates that
    573 doesn't have either of the two methods of storing email in certificates
    574 -- in which case, the email client will try to protect the user by
    575 printing the name of the certificate instead.
    576 
    577 S/MIME certificate can be used in another special way. They can be
    578 issued with a NULL subject distinguished name plus the email in SAN,
    579 this is a valid certificate. This is used when you wont want to share
    580 more information then you need to.
    581 
    582 hx509 issue-certificate supports adding the email SAN to certificate by
    583 using the --email option, --email also gives an implicit emailProtection
    584 eku. If you want to create an certificate without an email address, the
    585 option --type=email will add the emailProtection EKU.
    586 
    587 @example
    588 hxtool issue-certificate \
    589 	  --subject="UID=testus-email,DC=test,DC=h5l,DC=se" \
    590 	  --type=email \
    591 	  --email="testus@@test.h5l.se" \
    592           ...
    593 @end example
    594 
    595 An example of an certificate without and subject distinguished name with
    596 an email address in a SAN.
    597 
    598 @example
    599 hxtool issue-certificate \
    600 	  --subject="" \
    601 	  --type=email \
    602 	  --email="testus@@test.h5l.se" \
    603           ...
    604 @end example
    605 
    606 @subsection PK-INIT
    607 
    608 A PK-INIT infrastructure allows users and services to pick up kerberos
    609 credentials (tickets) based on their certificate. This, for example,
    610 allows users to authenticate to their desktops using smartcards while
    611 acquiring kerberos tickets in the process.
    612 
    613 As an example, an office network which offers centrally controlled
    614 desktop logins, mail, messaging (xmpp) and openafs would give users
    615 single sign-on facilities via smartcard based logins.  Once the kerberos
    616 ticket has been acquired, all kerberized services would immediately
    617 become accessible based on deployed security policies.
    618 
    619 Let's go over the process of initializing a demo PK-INIT framework:
    620 
    621 @example
    622 hxtool issue-certificate \
    623         --type="pkinit-kdc" \
    624         --pk-init-principal="krbtgt/TEST.H5L.SE@@TEST.H5L.SE" \
    625         --hostname=kerberos.test.h5l.se \
    626         --ca-certificate="FILE:ca.pem,ca.key" \
    627         --generate-key=rsa \
    628         --certificate="FILE:kdc.pem" \
    629         --subject="cn=kdc"
    630 @end example
    631 
    632 How to create a certificate for a user.
    633 
    634 @example
    635 hxtool issue-certificate \
    636         --type="pkinit-client" \
    637         --pk-init-principal="user@@TEST.H5L.SE" \
    638         --ca-certificate="FILE:ca.pem,ca.key" \
    639         --generate-key=rsa \
    640         --subject="cn=Test User" \
    641         --certificate="FILE:user.pem"
    642 @end example
    643 
    644 The --type field can be specified multiple times. The same certificate
    645 can hence house extensions for both pkinit-client as well as S/MIME.
    646 
    647 To use the PKCS11 module, please see the section:
    648 @pxref{How to use the PKCS11 module}.
    649 
    650 More about how to configure the KDC, see the documentation in the
    651 Heimdal manual to set up the KDC.
    652 
    653 @subsection XMPP/Jabber
    654 
    655 The jabber server certificate should have a dNSname that is the same as
    656 the user entered into the application, not the same as the host name of
    657 the machine.
    658 
    659 @example
    660 hxtool issue-certificate \
    661 	  --subject="CN=xmpp1.test.h5l.se,DC=test,DC=h5l,DC=se" \
    662           --hostname="xmpp1.test.h5l.se" \
    663           --hostname="test.h5l.se" \
    664           ...
    665 @end example
    666 
    667 The certificate may also contain a jabber identifier (JID) that, if the
    668 receiver allows it, authorises the server or client to use that JID.
    669 
    670 When storing a JID inside the certificate, both for server and client,
    671 it's stored inside a UTF8String within an otherName entity inside the
    672 subjectAltName, using the OID id-on-xmppAddr (1.3.6.1.5.5.7.8.5).
    673 
    674 To read more about the requirements, see RFC3920, Extensible Messaging
    675 and Presence Protocol (XMPP): Core.
    676 
    677 hxtool issue-certificate have support to add jid to the certificate
    678 using the option @kbd{--jid}.
    679 
    680 @example
    681 hxtool issue-certificate \
    682 	  --subject="CN=Love,DC=test,DC=h5l,DC=se" \
    683           --jid="lha@@test.h5l.se" \
    684           ...
    685 @end example
    686 
    687 
    688 @node CMS signing and encryption, CMS background, Application requirements, Top
    689 @chapter CMS signing and encryption
    690 
    691 CMS is the Cryptographic Message System that among other, is used by
    692 S/MIME (secure email) and Kerberos PK-INIT. It's an extended version of
    693 the RSA, Inc standard PKCS7.
    694 
    695 @node CMS background, Certificate matching, CMS signing and encryption, Top
    696 @section CMS background
    697 
    698 
    699 @node Certificate matching, Matching syntax, CMS background, Top
    700 @chapter Certificate matching
    701 
    702 To match certificates hx509 have a special query language to match
    703 certifictes in queries and ACLs.
    704 
    705 @node Matching syntax, Software PKCS 11 module, Certificate matching, Top
    706 @section Matching syntax
    707 
    708 This is the language definitions somewhat slopply descriped:
    709 
    710 @example
    711 
    712 expr = TRUE, 
    713      FALSE,
    714      ! expr,
    715      expr AND expr,
    716      expr OR expr,
    717      ( expr )
    718      compare
    719 
    720 compare =
    721      word == word,
    722      word != word,
    723      word IN ( word [, word ...])
    724      word IN %@{variable.subvariable@}
    725 
    726 word =
    727      STRING,
    728      %@{variable@}
    729 
    730 @end example
    731 
    732 @node Software PKCS 11 module, How to use the PKCS11 module, Matching syntax, Top
    733 @chapter Software PKCS 11 module
    734 
    735 PKCS11 is a standard created by RSA, Inc to support hardware and
    736 software encryption modules. It can be used by smartcard to expose the
    737 crypto primitives inside without exposing the crypto keys.
    738 
    739 Hx509 includes a software implementation of PKCS11 that runs within the
    740 memory space of the process and thus exposes the keys to the
    741 application.
    742 
    743 @node How to use the PKCS11 module, , Software PKCS 11 module, Top
    744 @section How to use the PKCS11 module
    745 
    746 @example
    747 $ cat > ~/.soft-pkcs11.rc <<EOF
    748 mycert	cert	User certificate	FILE:/Users/lha/Private/pkinit.pem
    749 app-fatal	true
    750 EOF
    751 $ kinit -C PKCS11:/usr/heimdal/lib/hx509.so lha@@EXAMPLE.ORG
    752 @end example
    753 
    754 
    755 @c @shortcontents
    756 @contents
    757 
    758 @bye
    759