Home | History | Annotate | Line # | Download | only in comp_match
      1  1.1  lukem Copyright 2004 Sang Seok Lim, IBM . All rights reserved.
      2  1.1  lukem 
      3  1.1  lukem Redistribution and use in source and binary forms, with
      4  1.1  lukem or without modification, are permitted only as authorized
      5  1.1  lukem by the OpenLDAP Public License.
      6  1.1  lukem 
      7  1.1  lukem A copy of this license is available in the file LICENSE in
      8  1.1  lukem the top-level directory of the distribution or, alternatively,
      9  1.1  lukem at <http://www.OpenLDAP.org/license.html>.
     10  1.1  lukem 
     11  1.1  lukem This directory contains a Component Matching module and
     12  1.1  lukem a X.509 Certificate example.  In order to understand Component
     13  1.1  lukem Matching, see RFC 3687 and
     14  1.1  lukem http://www.openldap.org/conf/odd-sandiego-2004/Sangseok.pdf
     15  1.1  lukem 
     16  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     17  1.1  lukem A) Brief introduction about files in this directory
     18  1.1  lukem %%%%%%%%%%55%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     19  1.1  lukem 
     20  1.1  lukem 1) init.c
     21  1.1  lukem module_init() and functions which are dynamically linked
     22  1.1  lukem into the main slapd codes.
     23  1.1  lukem 
     24  1.1  lukem 2) componentlib.c and componentlib.h
     25  1.1  lukem GSER and BER decoder library of each primitive ASN.1 type.
     26  1.1  lukem They use component representation to store ASN.1 values.
     27  1.1  lukem 
     28  1.1  lukem 3) certificate.c/.h authorityKeyIdentifier.c/.h
     29  1.1  lukem eSNACC generated BER and GSER decoder routines of the X.509
     30  1.1  lukem certificate specification and one of its extensions,
     31  1.1  lukem authorityKeyIdentifier.
     32  1.1  lukem 
     33  1.1  lukem 4) asn_to_syn_mr.c asn.h
     34  1.1  lukem An mapping table from ASN.1 types to corresponding Syntaxes,
     35  1.1  lukem matching rules, and component description in slapd.
     36  1.1  lukem 
     37  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     38  1.1  lukem B) How to use Component Matching on X.509 certificates
     39  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     40  1.1  lukem 
     41  1.1  lukem 1) be sure to configure slapd with enable-modules on.
     42  1.1  lukem 2) install the GSER-support eSNACC compiler. You can find
     43  1.1  lukem only in www.openldap.org. At least, you need the library
     44  1.1  lukem (libcasn1.a) and header files for compiling this module.
     45  1.1  lukem 3) modify Makefile accordingly. then run make.
     46  1.1  lukem you will get compmatch.la and other necessary files in ./libs
     47  1.1  lukem 4) modify slapd.conf to include the following module command
     48  1.1  lukem 	moduleload <path to>compmatch.la
     49  1.1  lukem 5) run slapd and perform search operations against
     50  1.1  lukem the attribute, userCertificate. You need to read through
     51  1.1  lukem RFC 3687 in order to understand how to compose component
     52  1.1  lukem filters.
     53  1.1  lukem Ex) component search filter examples
     54  1.1  lukem "(userCertificate:componentFilterMatch:=item:{ component
     55  1.1  lukem \"toBeSigned.serialNumber\", rule integerMatch, value 2 })"
     56  1.1  lukem You can find more examples in "test031-component-filter"
     57  1.1  lukem in the OpenLDAP source directory.
     58  1.1  lukem 
     59  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     60  1.1  lukem C) How to add a new ASN.1 syntax
     61  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     62  1.1  lukem 
     63  1.1  lukem 1) download and install the eSNACC compiler supporting
     64  1.1  lukem Component Matching. You can find the compiler only in
     65  1.1  lukem www.openldap.org.  Before compiling, be sure to define
     66  1.1  lukem the "LDAP_COMPONENT" macro to obtain component
     67  1.1  lukem supported version of C library and back-ends of eSNACC.
     68  1.1  lukem Otherwise compiled library will fail to be linked to
     69  1.1  lukem the module.
     70  1.1  lukem 2) using eSNACC, compile your ASN.1 specifications and
     71  1.1  lukem copy the generated .c and .h files to this directory
     72  1.1  lukem Ex)
     73  1.1  lukem $ esnacc -E BER_COMP -E GSER -t -d -f example.asn 
     74  1.1  lukem For Component Matching, set BOTH BER_COMP and GSER on.
     75  1.1  lukem After compiling, you will get example.c and example.h
     76  1.1  lukem 3) modify example.c accordingly, seeing certificate.c
     77  1.1  lukem and certificate.asn as a reference.
     78  1.1  lukem - add init_module_xxx() located in generated .c file
     79  1.1  lukem into init_module() in init.c.
     80  1.1  lukem - modify the arguments of InstallOidDecoderMapping(...)
     81  1.1  lukem accordingly
     82  1.1  lukem - in the generated .c file, you need to write
     83  1.1  lukem "DecComponentxxxTop(...)" function for yourself.
     84  1.1  lukem You can copy BDecComponentCertificateTop in the 
     85  1.1  lukem generated .c file and modify it accordingly.
     86  1.1  lukem 4) register a new attribute syntax with a new OID
     87  1.1  lukem in a schema file
     88  1.1  lukem 5) then goto 3) of B) section.
     89  1.1  lukem 
     90  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     91  1.1  lukem D) How to configure Component Indexing
     92  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     93  1.1  lukem You can generate indices on each component of
     94  1.1  lukem a given attribute whose values are in either GSER or
     95  1.1  lukem BER. Currently primitive ASN.1 types, DN, and RDN
     96  1.1  lukem can be indexed for equality matching in BDB.
     97  1.1  lukem In order to generate indices, put following line
     98  1.1  lukem in the slapd configuration file, slapd.conf.
     99  1.1  lukem 
    100  1.1  lukem index [attribute name].[component reference] eq
    101  1.1  lukem 
    102  1.1  lukem Ex)
    103  1.1  lukem index userCertificate eq
    104  1.1  lukem index userCertificate.toBeSigned.issuer.rdnSequence eq
    105  1.1  lukem index userCertificate.toBeSigned.serialNumber eq
    106  1.1  lukem index userCertificate.toBeSigned.version eq
    107  1.1  lukem 
    108  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    109  1.1  lukem D) How to configure Attribute Alias
    110  1.1  lukem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    111  1.1  lukem If your client is unable to use component filters,
    112  1.1  lukem attribute aliasing can be used instead. Attribute
    113  1.1  lukem Alias maps a virtual attribute type to an attribute
    114  1.1  lukem component and a component matching rule.
    115  1.1  lukem You can create your own aliases by following steps.
    116  1.1  lukem 
    117  1.1  lukem 1) register aliasing attributes in the schema file.
    118  1.1  lukem Sample aliasing attributes are in test.schema.
    119  1.1  lukem 2) compose component filters for aliasing attributes
    120  1.1  lukem and put them in "preprocessed_comp_filter" array
    121  1.1  lukem in "init.c".
    122  1.1  lukem 3) add "add_aa_entry" function calls in
    123  1.1  lukem "init_attribute_aliasing_table()" in "init.c"
    124  1.1  lukem 4) perform searching against the aliasing attribute
    125  1.1  lukem Ex)
    126  1.1  lukem "(x509CertificateIssuer:distinguishedNameMatch=
    127  1.1  lukem cn=ray,L=yorktown,o=ibm,c=us)"
    128